nvim: ftplugin/autoload: C: Run gst-indent on save
This commit is contained in:
parent
893b06defb
commit
d7c2ca6e43
2 changed files with 14 additions and 0 deletions
|
@ -18,3 +18,12 @@ nmap <buffer> <silent> <LocalLeader>e <Plug>(quickr_cscope_egrep)
|
|||
nmap <buffer> <silent> <LocalLeader>f <Plug>(quickr_cscope_files)
|
||||
nmap <buffer> <silent> <LocalLeader>i <Plug>(quickr_cscope_includes)
|
||||
nmap <buffer> <silent> <LocalLeader>a <Plug>(quickr_cscope_assignments)
|
||||
|
||||
" 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()
|
||||
|
|
5
nvim/.config/nvim/autoload/c.vim
Normal file
5
nvim/.config/nvim/autoload/c.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
function! c#format_with_gst_indent() abort
|
||||
let file = expand('%:p')
|
||||
silent execute "!gst-indent " . file
|
||||
silent execute "e" . file
|
||||
endfunction
|
Loading…
Reference in a new issue