Skip to content

Commit

Permalink
vimrc: support python and golang for ctags and cscope
Browse files Browse the repository at this point in the history
Signed-off-by: lilei <[email protected]>
  • Loading branch information
lilei committed Dec 6, 2019
1 parent 6604557 commit 37763f7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Empty file modified install.sh
100644 → 100755
Empty file.
13 changes: 11 additions & 2 deletions vim/bundle/ll.vim/plugin/ll.vim
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
4 changes: 4 additions & 0 deletions vim/plugin/autoload_cscope.vim
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ augroup autoload_cscope
au!
au BufEnter *.[chly] call <SID>Cycle_csdb() | call <SID>Cycle_macros_menus()
au BufEnter *.cc call <SID>Cycle_csdb() | call <SID>Cycle_macros_menus()
au BufEnter *.py call <SID>Cycle_csdb() | call <SID>Cycle_macros_menus()
au BufEnter *.go call <SID>Cycle_csdb() | call <SID>Cycle_macros_menus()
au BufUnload *.[chly] call <SID>Unload_csdb() | call <SID>Cycle_macros_menus()
au BufUnload *.cc call <SID>Unload_csdb() | call <SID>Cycle_macros_menus()
au BufUnload *.py call <SID>Unload_csdb() | call <SID>Cycle_macros_menus()
au BufUnload *.go call <SID>Unload_csdb() | call <SID>Cycle_macros_menus()
augroup END

let &cpo = s:save_cpo
Expand Down
2 changes: 1 addition & 1 deletion vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ endif
nmap <F3> :cp<cr>
nmap <F4> :cn<cr>
nmap <F6> :call AutoloadcsQuickfixToggle()<cr>
nmap <F8> :silent !ctags -R --fields=+lS && cscope -Rbqk<cr>
nmap <F8> :call LeeCtagsCscope()<cr>

0 comments on commit 37763f7

Please sign in to comment.