summaryrefslogtreecommitdiff
path: root/.vim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.vim/cscope.vim53
-rw-r--r--.vimrc16
2 files changed, 68 insertions, 1 deletions
diff --git a/.vim/cscope.vim b/.vim/cscope.vim
new file mode 100644
index 0000000..53e4dd9
--- /dev/null
+++ b/.vim/cscope.vim
@@ -0,0 +1,53 @@
+if has("cscope")
+ set cscopetag
+ set csto=0
+ if $CSCOPE_DB != ""
+ cs add $CSCOPE_DB
+ else
+ let dirs = split($PWD, '/')
+ let paths = ['/']
+ for d in dirs
+ let paths = add(paths, paths[len(paths) - 1] . d . '/')
+ endfor
+
+ for d in reverse(paths)
+ let cscope_file = d . "/cscope.out"
+ if filereadable(cscope_file)
+ execute('cs add ' . cscope_file)
+ break
+ endif
+ endfor
+ endif
+
+ set cscopeverbose
+
+ nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>e :cs find e <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-\>f :cs find f <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-\>S :cs find t struct <C-R>=expand("<cword>")<CR> {<CR>
+
+ nmap <C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@>S :vert scs find t struct <C-R>=expand("<cword>")<CR> {<CR>
+
+ nmap <C-@><C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
+ nmap <C-@><C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
+ nmap <C-@><C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
+ nmap <C-@><C-@>S :scs find t struct <C-R>=expand("<cword>")<CR> {<CR>
+endif
diff --git a/.vimrc b/.vimrc
index 86f383d..6138962 100644
--- a/.vimrc
+++ b/.vimrc
@@ -65,6 +65,8 @@ set splitright
" NERDTree stuffs
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
+let g:NERDTreeDirArrowExpandable = ''
+let g:NERDTreeDirArrowCollapsible = ''
let NERDTreeIgnore = ['\.o$','\.so$','\.class$','\.png$','\.jpg$']
" Completion
@@ -78,6 +80,18 @@ set wildignore+=vendor/cache/**
set wildignore+=log/**
set wildignore+=tmp/**
set wildignore+=*.png,*.jpeg,*.gif
+set wildignore+=*/tmp/*,*.so,*.swp,*.zip
+
+" Ctrlp
+let g:ctrlp_map = '<c-p>'
+let g:ctrlp_cmd = 'CtrlP'
+let g:ctrlp_working_path_mode = 'ra'
+let g:ctrlp_user_command = 'find %s -type f'
+let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
+let g:ctrlp_custom_ignore = {
+ \'dir': '\v[\/]\.(git|hg|svn)$',
+ \'file': '\v\.(exe|so|dll)$',
+ \ }
" Scrolling
set scrolloff=8
@@ -101,11 +115,11 @@ vno <Left> <Nop>
vno <Right> <Nop>
vno <Delete> <Nop>
nmap <Leader>s :source ~/.vimrc<CR>
+vnoremap <C-X> <Esc>`.``gvP``P
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
-nnoremap <silent> <Leader>b :TagbarToggle<CR>
nnoremap <silent> <Leader>n :NERDTreeToggle<CR>
nnoremap <silent> <Leader>c :silent !ctags -R .<CR><C-L>
nnoremap <silent> <Leader>t :tag