nvim: Disable automatic formatting on save
Had to disable automatic formatting since it was messing with my contributions to other git projects, if they did either not have a formatter enabled (most of the time) or had different formatters or those set up differently than this setup (fixable, but I don't think it's worth the time). Instead, formatting can be invoked with `<localleader>f`/`F` to format or format and save respectively.
This commit is contained in:
parent
ea37793997
commit
b33ae09a33
2 changed files with 14 additions and 7 deletions
|
@ -184,6 +184,11 @@ map.n.nore.silent['<localleader>q'] = 'gqap'
|
||||||
map.x.nore.silent['<localleader>q'] = 'gq'
|
map.x.nore.silent['<localleader>q'] = 'gq'
|
||||||
map.n.nore.silent['<localleader>Q'] = 'vapJgqap'
|
map.n.nore.silent['<localleader>Q'] = 'vapJgqap'
|
||||||
|
|
||||||
|
-- FORMAT code with
|
||||||
|
-- PLUGIN: formatter.nvim
|
||||||
|
map.n.nore.silent['<localleader>f'] = ':FormatLock<cr>'
|
||||||
|
map.n.nore.silent['<localleader>F'] = ':FormatWriteLock<cr>'
|
||||||
|
|
||||||
-- Enter distraction free prose mode with F11
|
-- Enter distraction free prose mode with F11
|
||||||
map.n.nore.silent['<F11>'] = ':ZenMode<cr>'
|
map.n.nore.silent['<F11>'] = ':ZenMode<cr>'
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,13 @@ local formatters = {
|
||||||
require('formatter').setup({ logging = false, filetype = formatters })
|
require('formatter').setup({ logging = false, filetype = formatters })
|
||||||
|
|
||||||
-- Format on save:
|
-- Format on save:
|
||||||
|
-- DISABLED FOR NOW, due to messing with git contributions if they
|
||||||
|
-- do not use a formatter. Instead, formatting with key mapping used.
|
||||||
-- gather filetypes to autocorrect for each activated formatter above
|
-- gather filetypes to autocorrect for each activated formatter above
|
||||||
for k, _ in pairs(formatters) do
|
-- for k, _ in pairs(formatters) do
|
||||||
vim.api.nvim_create_autocmd({"Filetype " .. k}, {
|
-- vim.api.nvim_create_autocmd({"Filetype " .. k}, {
|
||||||
command = "autocmd BufWritePost <buffer> FormatWrite",
|
-- command = "autocmd BufWritePost <buffer> FormatWrite",
|
||||||
desc = "Automatically format on write",
|
-- desc = "Automatically format on write",
|
||||||
group = vim.api.nvim_create_augroup('formatonsave', {clear = true})
|
-- group = vim.api.nvim_create_augroup('formatonsave', {clear = true})
|
||||||
})
|
-- })
|
||||||
end
|
-- end
|
||||||
|
|
Loading…
Reference in a new issue