Add vimrc
Change-Id: I25f3f01fc24ba0d94aa84f7ae5fab22a282460ae
This commit is contained in:
41
.vim/CurtinIncSw.vim
Normal file
41
.vim/CurtinIncSw.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
function! CurtineIncSw()
|
||||
if match(expand("%"), '\.c') > 0
|
||||
let l:next_file = substitute(".*\\\/" . expand("%:t"), '\.c\(.*\)', '.h[a-z]*', "")
|
||||
elseif match(expand("%"), "\\.h") > 0
|
||||
let l:next_file = substitute(".*\\\/" . expand("%:t"), '\.h\(.*\)', '.c[a-z]*', "")
|
||||
endif
|
||||
|
||||
if exists("b:previous_file") && b:previous_file == l:next_file
|
||||
e#
|
||||
else
|
||||
let l:directory_name = fnamemodify(expand("%:p"), ":h")
|
||||
" At this point cmd might evaluate to something of the format:
|
||||
" /Users/person/ . -type f -iregex ".*\/test_class.h[a-z]*" -print -quit
|
||||
let l:cmd="find " . l:directory_name . " . -type f -iregex \"" . l:next_file . "\" -print -quit"
|
||||
|
||||
" The substitute gets rid of the new line at the end of the result. The
|
||||
" function `filereadable` does not like the newline that `find` puts at
|
||||
" the end of the result and will not acknowledge that the file exists.
|
||||
let l:result = substitute(system(l:cmd), '\n', '', '')
|
||||
|
||||
if filereadable(l:result)
|
||||
exe "e " l:result
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
function! GetCurrentFile()
|
||||
if exists("b:current_file")
|
||||
let b:previous_file = b:current_file
|
||||
endif
|
||||
|
||||
if match(expand("%"), '\.c') > 0
|
||||
let b:current_file = substitute(".*\\\/" . expand("%:t"), '\.c\(.*\)', '.c[a-z]*', "")
|
||||
elseif match(expand("%"), "\\.h") > 0
|
||||
let b:current_file = substitute(".*\\\/" . expand("%:t"), '\.h\(.*\)', '.h[a-z]*', "")
|
||||
endif
|
||||
endfun
|
||||
|
||||
augroup CurtineIncSwCurrentFile
|
||||
autocmd BufWinEnter * call GetCurrentFile()
|
||||
augroup END
|
||||
1
.vim/bundle/CurtineIncSw.vim
Submodule
1
.vim/bundle/CurtineIncSw.vim
Submodule
Submodule .vim/bundle/CurtineIncSw.vim added at 6b32ef621c
1
.vim/bundle/Vundle.vim
Submodule
1
.vim/bundle/Vundle.vim
Submodule
Submodule .vim/bundle/Vundle.vim added at 9a38216a1c
1
.vim/bundle/c.vim
Submodule
1
.vim/bundle/c.vim
Submodule
Submodule .vim/bundle/c.vim added at 69f0368c7d
1
.vim/bundle/ctrlp.vim
Submodule
1
.vim/bundle/ctrlp.vim
Submodule
Submodule .vim/bundle/ctrlp.vim added at 2e773fd8c7
1
.vim/bundle/nerdtree
Submodule
1
.vim/bundle/nerdtree
Submodule
Submodule .vim/bundle/nerdtree added at 33fe2fdf16
1
.vim/bundle/vim-buffergator
Submodule
1
.vim/bundle/vim-buffergator
Submodule
Submodule .vim/bundle/vim-buffergator added at 947b60dca4
1
.vim/bundle/vim-fugitive
Submodule
1
.vim/bundle/vim-fugitive
Submodule
Submodule .vim/bundle/vim-fugitive added at aff3359699
1
.vim/bundle/vim-gutentags
Submodule
1
.vim/bundle/vim-gutentags
Submodule
Submodule .vim/bundle/vim-gutentags added at eecb136fae
Reference in New Issue
Block a user