diff --git a/nvim/.config/nvim/after/ftplugin/c.lua b/nvim/.config/nvim/after/ftplugin/c.lua index 6ece482..22b3704 100644 --- a/nvim/.config/nvim/after/ftplugin/c.lua +++ b/nvim/.config/nvim/after/ftplugin/c.lua @@ -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", { noremap=true, buffer=0 }) +vim.keymap.set('n', 'gq', ":!gst-indent %" , { noremap=true, buffer=0 }) diff --git a/nvim/.config/nvim/after/ftplugin/c.vim b/nvim/.config/nvim/after/ftplugin/c.vim deleted file mode 100644 index e93181d..0000000 --- a/nvim/.config/nvim/after/ftplugin/c.vim +++ /dev/null @@ -1,12 +0,0 @@ -setlocal makeprg=ninja\ -C\ build - -nmap gh :ClangdSwitchSourceHeader - -" 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() diff --git a/nvim/.config/nvim/autoload/c.vim b/nvim/.config/nvim/autoload/c.vim deleted file mode 100644 index 389dbaf..0000000 --- a/nvim/.config/nvim/autoload/c.vim +++ /dev/null @@ -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