dotfiles
bugabingas dorkfiles
owned by bugabinga
neovim: fix format command on windows
bf4ba57dd64d8851269b5698fc43467205d2486b
Oliver Krylow <o.krylow@isp-insoft.de> ·
unsigned
Browse filesCompare with HEAD
Changed files (2)
15 15 'This configuration assumes NeoVim version ' .. 16 16 expected.major
.. '.' .. expected.minor
.. ', but it is ' .. version.major
.. '.' .. version.minor
.. '!',
17 - vim.log.levels.ERROR)
17 + vim.log.levels.ERROR )
33 33 events
= 'VimEnter',
34 34 description
= 'Measure startup time of neovim.',
36 - command = function()
36 + command = function ()
37 37 local end_time
= vim.uv.hrtime()
38 38 local time_elapsed
= end_time
- start_time
39 - vim.schedule(
function()
40 - vim.notify(
string.
format(
'Neovim started in (%d ms).', time_elapsed
/ 1e6), vim.log.levels.INFO)
39 + vim.schedule(
function ()
40 + vim.notify(
string.
format(
'Neovim started in (%d ms).', time_elapsed
/ 1e6 ), vim.log.levels.INFO )
neovim/lua/bugabinga/format.lua
Modified 3 3 local puk
= require 'std.puk' 4 4 local dbg
= require 'std.dbg' 5 5 local map
= require 'std.map' 6 6 local user_command
= require 'std.user_command' 8 -local format = function()
9 - require 'conform'.format({
async =
false,
lsp_fallback =
true },
function(err)
8 +local format = function ()
9 + require 'conform'.format( {
async =
false },
function ( err )
10 10 if err
and dbg.get()
then 11 - vim.print(
'Format failed', err)
11 + vim.print(
'Format failed', err )
15 + vim.lsp.buf.format {
16 + filter =
function ( client )
17 + local ok
= client.supports_method
'textDocument/formatting' 18 + if ok
and dbg.get()
then print(
'Using LSP formatter: ' .. client.name )
end 21 -user_command.Format
'Format the current buffer' (format)
30 +user_command.Format
'Format the current buffer' ( format )
23 32 vim.o.formatexpr
= "v:lua.require'conform'.formatexpr()" 25 -puk.defer
'conform' (
function(conform)
34 +puk.defer
'conform' (
function ( conform )
27 36 formatters_by_ft = {
28 37 toml = {
'taplo' },
44 53 log_level
= dbg.get()
and vim.log.levels.TRACE
or vim.log.levels.INFO,