diff options
Diffstat (limited to 'configs')
-rw-r--r-- | configs/.ctags | 15 | ||||
-rw-r--r-- | configs/.vimrc | 79 |
2 files changed, 69 insertions, 25 deletions
diff --git a/configs/.ctags b/configs/.ctags index 7899e7a21960..c018567f2041 100644 --- a/configs/.ctags +++ b/configs/.ctags @@ -7,6 +7,21 @@ --exclude=tmp +--langdef=Elixir +--langmap=Elixir:.ex.exs +--regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,functions,functions (def ...)/ +--regex-Elixir=/^[ \t]*defcallback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/c,callbacks,callbacks (defcallback ...)/ +--regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegates,delegates (defdelegate ...)/ +--regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exceptions,exceptions (defexception ...)/ +--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementations,implementations (defimpl ...)/ +--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macros,macros (defmacro ...)/ +--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operators,operators (e.g. "defmacro a <<< b")/ +--regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,modules,modules (defmodule ...)/ +--regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocols,protocols (defprotocol...)/ +--regex-Elixir=/^[ \t]*Record\.defrecord[ \t]+:([a-zA-Z0-9_]+)/\1/r,records,records (defrecord...)/ +--regex-Elixir=/^[ \t]*test[ \t]+\"([a-z_][a-zA-Z0-9_?! ]*)\"*/\1/t,tests,tests (test ...)/ + + --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/ diff --git a/configs/.vimrc b/configs/.vimrc index 55b03752c54a..a40b3d62983c 100644 --- a/configs/.vimrc +++ b/configs/.vimrc @@ -21,9 +21,17 @@ Plugin 'Raimondi/delimitMate' " Displays git-tracked C*UD ops within gutter. Plugin 'airblade/vim-gitgutter' + +" Fuzzy-finder Plugin 'kien/ctrlp.vim' + +" Grep file contents Plugin 'mileszs/ack.vim' + +" JS support Plugin 'pangloss/vim-javascript' + +" Visual dir-tree navigation Plugin 'scrooloose/nerdtree' " Syntax Highlighting Support @@ -65,6 +73,9 @@ Plugin 'christoomey/vim-tmux-navigator' " Async `:make` for code linting etc. Plugin 'neomake/neomake' +" Color pack +Plugin 'flazz/vim-colorschemes' + call vundle#end() " required filetype plugin indent on " required @@ -94,6 +105,9 @@ let g:neomake_elixir_credo_maker = { " Enables the list of buffers. let g:airline#extensions#tabline#enabled = 1 +" Buffer numbers alongside files +let g:airline#extensions#tabline#buffer_nr_show = 1 + " Shows the filename only. let g:airline#extensions#tabline#fnamemod = ':t' @@ -101,7 +115,20 @@ let g:airline#extensions#tabline#fnamemod = ':t' let g:airline_powerline_fonts = 1 " Change Airline theme -let g:airline_theme = 'base16_google' +let g:airline_theme = 'hybrid' + + +" Jump to buffers. +nmap <F1> :1b<CR> +nmap <F2> :2b<CR> +nmap <F3> :3b<CR> +nmap <F4> :4b<CR> +nmap <F5> :5b<CR> +nmap <F6> :6b<CR> +nmap <F7> :7b<CR> +nmap <F8> :8b<CR> +nmap <F9> :9b<CR> + " It's the twenty-first century...no swaps. @@ -171,8 +198,7 @@ set mouse=a set hlsearch " Search for gibberish to clear the most recent search -" nnoremap <leader>/ :set hlsearch!<CR> -noremap <leader>/ /__wc_gibberish__<CR> +noremap <leader>/ :silent! /__wc_gibberish__/<CR>:echo "Search cleared."<CR> " Use custom-made snippets. @@ -207,10 +233,10 @@ inoremap <C-e> <Esc>A " Manage Vertical and Horizontal splits -nnoremap vs <Esc>:vs<CR> -nnoremap vv <Esc>:vs<CR> -nnoremap sp <Esc>:sp<CR> -nnoremap ss <Esc>:sp<CR> +nnoremap sl <Esc>:vs<CR><C-w>l +nnoremap sh <Esc>:vs<CR> +nnoremap sj <Esc>:sp<CR><C-w>j +nnoremap sk <Esc>:sp<CR> " Move around splits with <leader> @@ -228,7 +254,7 @@ nnoremap <leader>q :bdelete<CR> " CtrlP config " Set default CtrlP command. -let g:ctrlp_cmd = 'CtrlP' +let g:ctrlp_cmd = 'CtrlPBuffer' " let g:ctrlp_cmd = 'CtrlPMRU' " Set runtime path @@ -268,8 +294,8 @@ nnoremap Y y$ " nnoremap <C-k> k<C-y> -" reload file after git changes -nnoremap <C-r> :e<CR> +" Shorter binding for window rotations +nnoremap <C-r> <C-w><C-r> " Basic settings @@ -281,7 +307,7 @@ set shiftwidth=2 set background=dark syntax enable -colorscheme solarized +colorscheme hybrid set history=1000 set undolevels=1000 @@ -293,6 +319,10 @@ set t_Co=255 highlight Comment cterm=italic +" remap redo key that is eclipsed by `rotate` currently +nnoremap U :redo<CR> + + " Repeat last colon-command nnoremap ;; @:<CR> vnoremap ;; @:<CR> @@ -322,7 +352,7 @@ nnoremap <C-c> V"+y vnoremap <C-c> "+y inoremap <C-v> <Esc>"+pa -nnoremap <C-v> o<Esc>"+p +" nnoremap <C-v> o<Esc>"+p vnoremap <C-v> "+p @@ -396,7 +426,7 @@ vnoremap // y/<C-r>"<CR>N " trim trailing whitespace on save -autocmd BufWritePre *.{js,py,tpl,less,html,ex} :%s/\s\+$//e +autocmd BufWritePre *.{js,py,tpl,less,html,ex,exs,txt} :%s/\s\+$//e " set default font and size @@ -420,24 +450,25 @@ nnoremap <leader>t :call ExTestToggle()<CR> " Jumps from an Elixir module file to an Elixir test file. fun! ExTestToggle() - if expand('%:e') == "ex" - let l:test_file_name = expand('%:t:r') . "_test.exs" - let l:test_file_dir = substitute(expand('%:p:h'), "/lib/core/", "/lib/test/", "") - let l:full_test_path = join([test_file_dir, test_file_name], "/") + + let test_file_name = expand('%:t:r') . "_test.exs" + let test_file_dir = substitute(expand('%:p:h'), "/lib/", "/test/", "") + let full_test_path = join([test_file_dir, test_file_name], "/") e `=full_test_path` elseif match(expand('%:t'), "_test.exs") != -1 - let l:current_file_name = expand('%:t:r') - let l:offset_amt = strlen(current_file_name) - strlen("_test") - let l:module_file_name = strpart(current_file_name, 0, offset_amt) . ".ex" - let l:module_file_dir = substitute(expand('%:p:h'), "/test/", "/lib/core/", "") - let l:full_module_path = join([module_file_dir, module_file_name], "/") + + let test_file_name = expand('%:t:r') + let offset_amt = strlen(test_file_name) - strlen("_test") + let module_file_name = strpart(test_file_name, 0, offset_amt) . ".ex" + let module_file_dir = substitute(expand('%:p:h'), "/test/", "/lib/", "") + let full_module_path = join([module_file_dir, module_file_name], "/") e `=full_module_path` - endif + endif endfun @@ -449,5 +480,3 @@ fun! CreateNonExistingDirsAndFile() w endfun - - |