From 99ab36799daa2c68e08d737ed7a75ee9214d3635 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Tue, 24 Oct 2017 10:03:57 +0100 Subject: [PATCH] vim: consolidate fswitch settings in c.vim --- vim/ftplugin/c.vim | 9 +++++++-- vim/ftplugin/cpp.vim | 7 ------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/vim/ftplugin/c.vim b/vim/ftplugin/c.vim index 16a9bf6..a4625ac 100644 --- a/vim/ftplugin/c.vim +++ b/vim/ftplugin/c.vim @@ -2,10 +2,15 @@ let b:load_doxygen_syntax = 1 augroup fswitch - au BufEnter *.h let b:fswitchdst = 'c' - au BufEnter *.h let b:fswitchlocs = 'reg:|include.*|source|' + au! + au BufEnter *.h let b:fswitchdst = 'c,cpp' + au BufEnter *.h let b:fswitchlocs = '.,reg:|include.*|src|' au BufEnter *.c let b:fswitchdst = 'h' au BufEnter *.c let b:fswitchlocs = 'reg:|source|include/**|' + au BufEnter *.hpp let b:fswitchdst = 'cpp,c' + au BufEnter *.hpp let b:fswitchlocs = 'reg:|include.*|src|' + au BufEnter *.cpp let b:fswitchdst = 'hpp,h' + au BufEnter *.cpp let b:fswitchlocs = 'reg:|src|include/**|' augroup END nnoremap gd :YcmCompleter GoTo diff --git a/vim/ftplugin/cpp.vim b/vim/ftplugin/cpp.vim index fabf6b9..4d54b7b 100644 --- a/vim/ftplugin/cpp.vim +++ b/vim/ftplugin/cpp.vim @@ -14,13 +14,6 @@ setlocal cinoptions+=:0 " don't indent case labels " Load the doxygen syntax let b:load_doxygen_syntax = 1 -augroup fswitch - au BufEnter *.hpp let b:fswitchdst = 'cpp,c' - au BufEnter *.hpp let b:fswitchlocs = 'reg:|include.*|src|' - au BufEnter *.cpp let b:fswitchdst = 'hpp,h' - au BufEnter *.cpp let b:fswitchlocs = 'reg:|src|include/**|' -augroup END - let g:switch_const_definitions = \ [ { \ '\%(const \)\@!\([[:alnum:]_:<>]\{-}\) \%(&\)\@!': 'const \1 ', -- 2.48.1