From ccd11f71971cfabd9f61666f403161a553266693 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Thu, 10 Nov 2016 10:57:18 -0500 Subject: [PATCH] Updates config to support ctags --- configs/.ctags | 89 ++++++++++++++++++++++++++++++++++++++++ configs/setup_configs.sh | 21 +++++++++- usbify/vim/.vimrc | 23 +++++++++++ 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 configs/.ctags diff --git a/configs/.ctags b/configs/.ctags new file mode 100644 index 000000000..7899e7a21 --- /dev/null +++ b/configs/.ctags @@ -0,0 +1,89 @@ +--recurse=yes +--exclude=.git +--exclude=vendor/ +--exclude=node_modules +--exclude=db +--exclude=log +--exclude=tmp + + +--regex-ruby=/.*alias(_method)?[[:space:]]+:([[:alnum:]_=!?]+),?[[:space:]]+:([[:alnum:]_=!]+)/\2/f,function/ +--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/ +--regex-ruby=/(^|;)[ \t]*(has_many|belongs_to|has_one|has_and_belongs_to_many)\(? *:([[:alnum:]_]+)/\3/f,function,association/ +--regex-ruby=/(^|;)[ \t]*(named_)?scope\(? *:([[:alnum:]_]+)/\3/f,function,named_scope/ +--regex-ruby=/(^|;)[ \t]*expose\(? *:([[:alnum:]_]+)/\2/f,function,exposure/ +--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2/f,function,aasm_event/ +--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/ +--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function,aasm_event/ + +--langmap=Ruby:+(Rakefile) + +--langdef=js +--langmap=js:.js +--langmap=js:+.jsx + +--regex-js=/[ \t.]([A-Z][A-Z0-9._$]+)[ \t]*[=:][ \t]*([0-9"'\[\{]|null)/\1/n,constant/ + +--regex-js=/\.([A-Za-z0-9._$]+)[ \t]*=[ \t]*\{/\1/o,object/ +--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*[ \t]*:[ \t]*\{/\1/o,object/ +--regex-js=/([A-Za-z0-9._$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*\{/\1\.\2/o,object/ + +--regex-js=/([A-Za-z0-9._$]+)[ \t]*=[ \t]*\(function\(\)/\1/c,class/ +--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*:[ \t]*\(function\(\)/\1/c,class/ +--regex-js=/class[ \t]+([A-Za-z0-9._$]+)[ \t]*/\1/c,class/ +--regex-js=/([A-Za-z$][A-Za-z0-9_$()]+)[ \t]*=[ \t]*[Rr]eact.createClass[ \t]*\(/\1/c,class/ +--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*=[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/ +--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*:[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/ + +--regex-js=/([A-Za-z$][A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\1/f,function/ + +--regex-js=/(function)*[ \t]*([A-Za-z$_][A-Za-z0-9_$]+)[ \t]*\([^)]*\)[ \t]*\{/\2/f,function/ +--regex-js=/['"]*([A-Za-z$][A-Za-z0-9_$]+)['"]*:[ \t]*function[ \t]*\(/\1/m,method/ +--regex-js=/([A-Za-z0-9_$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*function[ \t]*\(/\2/m,method/ + + +--langdef=haskell +--langmap=haskell:.hs +--regex-haskell=/^module[ \t]*([A-Z][a-zA-Z0-9'_.]*)/\1/m,module/ +--regex-haskell=/^(new)?type[ \t]*([A-Z][a-zA-Z0-9'_]*)./\2/t,type/ +--regex-haskell=/^class[ \t]*([A-Z][a-zA-Z0-9'_]*)/\1/c,class/ +--regex-haskell=/^data[ \t]*([A-Z][a-zA-Z0-9'_]*)/\1/d,data/ +--regex-haskell=/^([a-z_][a-zA-Z0-9'_]*).*=/\1/v,function/ + +--langmap=C++:+.mm + +--langdef=golang +--langmap=golang:.go +--regex-golang=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/d,func/ +--regex-golang=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,var/ +--regex-golang=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,type/ + +--langdef=Rust +--langmap=Rust:.rs +--regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\6/f,functions,function definitions/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\2/T,types,type definitions/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?static[ \t]+([a-zA-Z0-9_]+)/\2/c,consts,static constants/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\2/t,traits,traits/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([a-zA-Z0-9_]+)/\4 \6 \7/i,impls,trait implementations/ +--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/ + +--langdef=typescript +--langmap=typescript:.ts +--regex-typescript=/^[ \t]*(export)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/ +--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/ +--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/ +--regex-typescript=/^[ \t]*export[ \t]+var[ \t]+([a-zA-Z0-9_]+)/\1/v,variables/ +--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/ +--regex-typescript=/^[ \t]*(export)?[ \t]*(public|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/ +--regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/ +--regex-typescript=/^[ \t]*(export)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/ +--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_]+)/\1/I,imports/ + +--langdef=elm +--langmap=elm:.elm +--regex-elm=/^module[ \t]*([A-Z][a-zA-Z0-9'_.]*)/\1/m,module/ +--regex-elm=/^type[ \t]*([A-Z][a-zA-Z0-9'_]*)./\1/t,type/ +--regex-elm=/^([a-z_][a-zA-Z0-9'_]*).*=/\1/v,function/ diff --git a/configs/setup_configs.sh b/configs/setup_configs.sh index e1a742c4b..2dbe15e11 100755 --- a/configs/setup_configs.sh +++ b/configs/setup_configs.sh @@ -20,7 +20,7 @@ else fi -# backup .tmux.conf +# .tmux.conf if [ -f "$HOME"/.tmux.conf ] && [ ! -L "$HOME"/.tmux.conf ]; then echo -n "Backing up .tmux.conf ... " && \ mv "$HOME"/.tmux.conf "$HOME"/.tmux.conf.bak && \ @@ -37,3 +37,22 @@ else echo "Done." fi + +# .ctags +if [ -f "$HOME"/.ctags ] && [ ! -L "$HOME"/.ctags ]; then + # backup .ctags + echo -n "Backing up .ctags ... " && \ + mv "$HOME"/.ctags "$HOME"/.ctags.bak && \ + echo "Done." +fi + +if [ -L "$HOME"/.ctags ]; then + # TODO: make sure that .ctags is symlinked to the correct location. + echo ".ctags is already symlinked." +else + # create symlink to pc_settings .ctags + echo -n "Symlinking to pc_settings/configs/.ctags ... " && \ + ln -s "$HOME"/pc_settings/configs/.ctags "$HOME"/.ctags && \ + echo "Done." +fi + diff --git a/usbify/vim/.vimrc b/usbify/vim/.vimrc index 236d79bc0..151391950 100644 --- a/usbify/vim/.vimrc +++ b/usbify/vim/.vimrc @@ -67,6 +67,14 @@ let g:airline_powerline_fonts = 1 set noswapfile +" Allow visual tab completion in command mode +set wildmenu + + +" Show Vim commands as they're being input. +set showcmd + + " Changes to character. let mapleader = " " @@ -81,6 +89,10 @@ set hlsearch nnoremap / :set hlsearch! +" Use custom-made snippets. +nnoremap ,jsfn :-1read $HOME/.vim/function_skeleton.jso + + " backspace settings set backspace=2 set backspace=indent,eol,start @@ -305,6 +317,7 @@ nnoremap w :set wrap! " Resize split to 10,20,...,100 chars " Uncomment the next lines for support at those sizes. " These bindings interfere with the highlight groups, however. +" Increases the width of a vertical split. " nnoremap 1 :vertical resize 10 " nnoremap 2 :vertical resize 20 nnoremap 3 :vertical resize 30 @@ -316,6 +329,16 @@ nnoremap 8 :vertical resize 80 nnoremap 9 :vertical resize 90 nnoremap 0 :vertical resize 100 +" Increases the height of a horizontal split. +nnoremap v1 :resize 5 +nnoremap v2 :resize 10 +nnoremap v3 :resize 15 +nnoremap v4 :resize 20 +nnoremap v5 :resize 25 +nnoremap v6 :resize 30 +nnoremap v7 :resize 35 +nnoremap v8 :resize 40 + " View Directory tree with ctrl + \ nnoremap :NERDTreeToggle