From 37763f7f8dbfda650d65a9ad0ba384ae608b62ea Mon Sep 17 00:00:00 2001 From: lilei Date: Fri, 6 Dec 2019 05:55:53 -0500 Subject: [PATCH] vimrc: support python and golang for ctags and cscope Signed-off-by: lilei --- install.sh | 0 vim/bundle/ll.vim/plugin/ll.vim | 13 +++++++++++-- vim/plugin/autoload_cscope.vim | 4 ++++ vimrc | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 diff --git a/vim/bundle/ll.vim/plugin/ll.vim b/vim/bundle/ll.vim/plugin/ll.vim index 395c8e4..2dccac0 100644 --- a/vim/bundle/ll.vim/plugin/ll.vim +++ b/vim/bundle/ll.vim/plugin/ll.vim @@ -1,5 +1,5 @@ -autocmd BufNewFile *.sh,*.py exec ":call AutoSetFileHead()" -function! AutoSetFileHead() +autocmd BufNewFile *.sh,*.py exec ":call LeeAutoSetFileHead()" +function! LeeAutoSetFileHead() if &filetype == 'sh' call setline(1, "\#!/bin/bash") elseif &filetype == 'python' @@ -18,3 +18,12 @@ if ((filereadable("Kconfig"))&&(filereadable("Makefile"))) set shiftwidth=8 | set noexpandtab endif + +function! LeeCtagsCscope() + if $filetype == 'go' + :silent !find . -name "*.go" >> cscope.files + elseif &filetype == 'python' + :silent !find . -name "*.py" >> cscope.files + endif + :silent !ctags -R --fields=+lS && cscope -Rbqk +endfunction diff --git a/vim/plugin/autoload_cscope.vim b/vim/plugin/autoload_cscope.vim index 5a1b05f..b7f3b3a 100644 --- a/vim/plugin/autoload_cscope.vim +++ b/vim/plugin/autoload_cscope.vim @@ -196,8 +196,12 @@ augroup autoload_cscope au! au BufEnter *.[chly] call Cycle_csdb() | call Cycle_macros_menus() au BufEnter *.cc call Cycle_csdb() | call Cycle_macros_menus() + au BufEnter *.py call Cycle_csdb() | call Cycle_macros_menus() + au BufEnter *.go call Cycle_csdb() | call Cycle_macros_menus() au BufUnload *.[chly] call Unload_csdb() | call Cycle_macros_menus() au BufUnload *.cc call Unload_csdb() | call Cycle_macros_menus() + au BufUnload *.py call Unload_csdb() | call Cycle_macros_menus() + au BufUnload *.go call Unload_csdb() | call Cycle_macros_menus() augroup END let &cpo = s:save_cpo diff --git a/vimrc b/vimrc index cfd4aad..2c4760c 100644 --- a/vimrc +++ b/vimrc @@ -115,4 +115,4 @@ endif nmap :cp nmap :cn nmap :call AutoloadcsQuickfixToggle() -nmap :silent !ctags -R --fields=+lS && cscope -Rbqk +nmap :call LeeCtagsCscope()