nvim: after/ftplugin/C: Do not run gst-indent after buffer save

This seems to interfere with git signs tracking among other things.
While at it move the remaining configuration to Lua.
This commit is contained in:
Sanchayan Maity 2024-03-30 15:49:56 +05:30
parent 78e62011f6
commit 84f729f3c7
Signed by: sanchayanmaity
GPG Key ID: 6F6A0609C12038F3
3 changed files with 5 additions and 17 deletions

View File

@ -2,3 +2,8 @@ local lsp_utils = require('lsp-utils')
local clangd_config = lsp_utils.clangd_config()
vim.lsp.start(clangd_config)
vim.bo.makeprg = 'meson compile -C build'
vim.keymap.set('n', 'gh', ":ClangdSwitchSourceHeader<CR>", { noremap=true, buffer=0 })
vim.keymap.set('n', 'gq', ":!gst-indent %<CR>" , { noremap=true, buffer=0 })

View File

@ -1,12 +0,0 @@
setlocal makeprg=ninja\ -C\ build
nmap <buffer> <silent> gh :ClangdSwitchSourceHeader<CR>
" If we are working with any of the gstreamer projects in C, run gst-ident
" before saving. Assume gst-ident from gstreamer/tools/gst-indent has been
" made available in path.
"
" The '!' after autocmd is required without which, the command gets triggered
" multiple times. Basically, we clear the autocmd.
autocmd! BufWritePost */gst-*/*.c call c#format_with_gst_indent()
autocmd! BufWritePost */gstreamer-*/*.c call c#format_with_gst_indent()

View File

@ -1,5 +0,0 @@
function! c#format_with_gst_indent() abort
let file = expand('%:p')
silent execute "!gst-indent " . file
silent execute "e" . file
endfunction