Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| " vim: ft=vim foldmethod=marker | |
| " | |
| let g:plug_url_format = 'git://github.com/%s.git' | |
| call plug#begin( g:vim_home . "/plugged") | |
| "===================Plug loading starts======================================== | |
| "------------------------------------------------------------------------------- | |
| " readability " | |
| "------------------------------------------------------------------------------- | |
| Plug 'ryanoasis/vim-devicons' | |
| Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } "{{{ | |
| nmap <F4> :NERDTreeToggle<CR> | |
| autocmd StdinReadPre * let s:std_in=1 | |
| " auto start nerd tree when no file is open, conflicts with startify | |
| " autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
| " automatically close vim when last window is NERDTree | |
| autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
| " Automatically delete the buffer of the file you just deleted with NerdTree: | |
| let NERDTreeAutoDeleteBuffer = 1 | |
| let NERDTreeMinimalUI = 1 | |
| let NERDTreeDirArrows = 1 | |
| " find current file | |
| nnoremap <silent> <Leader>z :NERDTreeFind<CR> | |
| Plug 'Xuyuanp/nerdtree-git-plugin' | |
| Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
| let g:NERDTreeFileExtensionHighlightFullName = 1 | |
| let g:NERDTreeExactMatchHighlightFullName = 1 | |
| let g:NERDTreePatternMatchHighlightFullName = 1 | |
| " }}} | |
| Plug 'kien/rainbow_parentheses.vim' "{{{ | |
| let g:rbpt_colorpairs = [ | |
| \ ['brown', 'RoyalBlue3'], | |
| \ ['Darkblue', 'SeaGreen3'], | |
| \ ['darkgray', 'DarkOrchid3'], | |
| \ ['darkgreen', 'firebrick3'], | |
| \ ['darkcyan', 'RoyalBlue3'], | |
| \ ['darkred', 'SeaGreen3'], | |
| \ ['darkmagenta', 'DarkOrchid3'], | |
| \ ['brown', 'firebrick3'], | |
| \ ['gray', 'RoyalBlue3'], | |
| \ ['black', 'SeaGreen3'], | |
| \ ['darkmagenta', 'DarkOrchid3'], | |
| \ ['Darkblue', 'firebrick3'], | |
| \ ['darkgreen', 'RoyalBlue3'], | |
| \ ['darkcyan', 'SeaGreen3'], | |
| \ ['darkred', 'DarkOrchid3'], | |
| \ ['red', 'firebrick3'], | |
| \ ] | |
| "call :RainbowParenthesesToggle() | |
| nmap <leader>r :RainbowParenthesesToggle<cr> | |
| au VimEnter * RainbowParenthesesToggle | |
| "au Syntax * RainbowParenthesesLoadRound | |
| au Syntax * RainbowParenthesesLoadSquare | |
| au Syntax * RainbowParenthesesLoadBraces | |
| " }}} | |
| Plug 'itchyny/lightline.vim' "{{{ | |
| " https://apw-bash-settings.readthedocs.io/en/latest/tipstricks.html | |
| if ! has('gui_running') | |
| set ttimeoutlen=10 | |
| augroup FastEscape | |
| autocmd! | |
| au InsertEnter * set timeoutlen=0 | |
| au InsertLeave * set timeoutlen=1000 | |
| augroup END | |
| endif | |
| let g:lightline = { | |
| \ 'active': { | |
| \ 'left': [ [ 'mode', 'paste' ], | |
| \ [ 'fugitive'],[ 'dir', 'filename' ] ] | |
| \ }, | |
| \ 'component_function': { | |
| \ 'fugitive': 'LLFugitive', | |
| \ 'readonly': 'LLReadonly', | |
| \ 'modified': 'LLModified', | |
| \ 'filename': 'LLFilename', | |
| \ 'mode': 'LLMode', | |
| \ 'dir': 'LLDir', | |
| \ } | |
| \ } | |
| function! LLMode() | |
| let fname = expand('%:t') | |
| return fname == '__Tagbar__' ? 'Tagbar' : | |
| \ fname == 'ControlP' ? 'CtrlP' : | |
| \ lightline#mode() == 'NORMAL' ? 'N' : | |
| \ lightline#mode() == 'INSERT' ? 'I' : | |
| \ lightline#mode() == 'VISUAL' ? 'V' : | |
| \ lightline#mode() == 'V-LINE' ? 'VL' : | |
| \ lightline#mode() == 'V-BLOCK' ? 'VB' : | |
| \ lightline#mode() == 'REPLACE' ? 'R' : lightline#mode() | |
| endfunction | |
| function! LLModified() | |
| if &filetype == "help" | |
| return "" | |
| elseif &modified | |
| return "+" | |
| elseif &modifiable | |
| return "" | |
| else | |
| return "" | |
| endif | |
| endfunction | |
| function! LLReadonly() | |
| if &filetype == "help" | |
| return "" | |
| elseif &readonly | |
| return "!" | |
| else | |
| return "" | |
| endif | |
| endfunction | |
| function! LLFugitive() | |
| return exists('*fugitive#head') ? fugitive#head() : '' | |
| endfunction | |
| function! LLDir() | |
| return pathshorten(substitute(getcwd(), $HOME, "~", "")) | |
| endfunction | |
| function! LLFilename() | |
| return ('' != LLReadonly() ? LLReadonly() . ' ' : '') . | |
| \ ('' != expand('%:t') ? expand('%:t') : '[No Name]') . | |
| \ ('' != LLModified() ? ' ' . LLModified() : '') | |
| endfunction | |
| " }}} | |
| Plug 'airblade/vim-gitgutter', { 'for': ['elixir', 'ruby'] } | |
| let g:gitgutter_max_signs = 200 | |
| " theme | |
| Plug 'morhetz/gruvbox' | |
| Plug 'blueyed/vim-diminactive' | |
| "------------------------------------------------------------------------------- | |
| " operability " | |
| "------------------------------------------------------------------------------- | |
| Plug 'airblade/vim-rooter' | |
| " comment / uncomment | |
| Plug 'tomtom/tcomment_vim' " {{{ | |
| vmap <F9> :TComment<CR> | |
| nmap <F9> :TComment<CR> | |
| " }}} | |
| " make stuff organized | |
| Plug 'junegunn/vim-easy-align' "{{{ | |
| vmap <Enter> <Plug>(EasyAlign) | |
| nmap ga <Plug>(EasyAlign) | |
| " }}} | |
| " easymotion | |
| " Plug 'easymotion/vim-easymotion' | |
| " distraction free writing | |
| Plug 'junegunn/goyo.vim', { 'for': 'markdown' } | |
| " drawings | |
| Plug 'vim-scripts/DrawIt', { 'on': 'DrawIt' } | |
| " syntax checking, slow | |
| " Plug 'vim-syntastic/syntastic' | |
| " grammar checking | |
| " Plug 'rhysd/vim-grammarous' | |
| " Split in tmux | |
| " Plug 'benmills/vimux' " {{{ | |
| " map tr :VimuxPromptCommand<CR> | |
| " map tl :VimuxRunLastCommand<CR> | |
| " map tz :VimuxZoomRunner<CR> | |
| " use c-h/j/k/l for split navigation, no matter in vim or tmux | |
| Plug 'christoomey/vim-tmux-navigator' | |
| if has('nvim') | |
| nnoremap <silent> <BS> :TmuxNavigateLeft<cr> | |
| endif | |
| " }}} | |
| " parentheses and ends | |
| Plug 'jiangmiao/auto-pairs' | |
| let g:AutoPairsShortcutFastWrap = '<C-y>' | |
| Plug 'tpope/vim-endwise' | |
| " git interoperability | |
| " Plug 'tpope/vim-fugitive' | |
| " automatic tag generation with easytags | |
| " Plug 'xolox/vim-easytags' " {{{ | |
| " Plug 'xolox/vim-misc' | |
| " let g:easytags_dynamic_files = 2 | |
| " let g:easytags_events = ['BufWritePost'] | |
| " }}} | |
| Plug 'ledger/vim-ledger', { 'for' : 'ledger' } | |
| autocmd FileType ledger nnoremap j jzz | |
| autocmd FileType ledger nnoremap k kzz | |
| autocmd FileType ledger nnoremap G Gzz | |
| Plug 'slim-template/vim-slim', {'for': 'slim'} | |
| autocmd FileType slim setlocal textwidth=999 | |
| autocmd BufNewFile,BufRead *.markdown,*mkd setfiletype octopress | |
| Plug 'tangledhelix/vim-octopress', {'for' : 'octopress'} | |
| Plug 'elixir-lang/vim-elixir', { 'for' : 'elixir' } | |
| autocmd FileType elixir setlocal nofoldenable | |
| Plug 'gorodinskiy/vim-coloresque', {'for': ['css', 'sass', 'scss']} | |
| Plug 'vim-scripts/openssl.vim' | |
| " }}} | |
| Plug 'Konfekt/FastFold' " fix for vim's slow fdm=syntax | |
| if has("nvim") | |
| Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
| let g:deoplete#enable_at_startup = 1 | |
| let g:deoplete#omni#input_patterns = {} | |
| let g:deoplete#omni#input_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' | |
| let g:deoplete#omni#input_patterns.ledger = '^\s\+\(\S \S\|\S\|:\)\+' | |
| let g:deoplete = '~/.config/nvim/.cache/deoplete' | |
| let g:deoplete#enable_auto_delimiter = 1 | |
| autocmd FileType eruby let b:deoplete_disable_auto_complete=1 | |
| else | |
| Plug 'Shougo/neocomplete.vim' | |
| let g:neocomplete#enable_at_startup=1 | |
| let g:neocomplete#sources#omni#input_patterns = {} | |
| let g:neocomplete#sources#omni#input_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' | |
| let g:neocomplete#sources#omni#input_patterns.ledger = '^\s\+\(\S \S\|\S\|:\)\+' | |
| " let g:neocomplete#data_directory='~/.vim/.cache/neocomplete' | |
| let g:neocomplete#enable_auto_delimiter=1 | |
| endif | |
| Plug 'SirVer/ultisnips' " {{{ | |
| " add personal snippet directory to search path, note that snippets is reserved and could not be used | |
| let g:UltiSnipsSnippetDirectories=["snips", "UltiSnips"] | |
| let g:UltiSnipsSnippetsDir= g:vim_home . '/snips' | |
| let g:UltiSnipsEditSplit= 'vertical' | |
| " }}} Plug 'SirVer/ultisnips' " | |
| " Plug fzf {{{ | |
| Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } | |
| Plug 'junegunn/fzf.vim' | |
| nnoremap <silent> <leader>f :Files<CR> | |
| nnoremap <silent> <leader>b :Buffers<CR> | |
| nnoremap <silent> <leader>/ :call SearchWordWithAg()<CR> | |
| vnoremap <silent> <leader>/ :call SearchSelectionWithAg()<CR> | |
| imap <C-x><C-f> <plug>(fzf-complete-file-ag) | |
| imap <C-x><C-l> <plug>(fzf-complete-line) | |
| function! SearchWordWithAg() | |
| execute 'Ag' expand('<cword>') | |
| endfunction | |
| function! SearchSelectionWithAg() range | |
| let old_reg = getreg('"') | |
| let old_regtype = getregtype('"') | |
| let old_clipboard = &clipboard | |
| set clipboard& | |
| normal! ""gvy | |
| let selection = getreg('"') | |
| call setreg('"', old_reg, old_regtype) | |
| let &clipboard = old_clipboard | |
| execute 'Ag' selection | |
| endfunction | |
| let g:fzf_colors = | |
| \ { 'fg': ['fg', 'Normal'], | |
| \ 'bg': ['bg', 'Normal'], | |
| \ 'hl': ['fg', 'Comment'], | |
| \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | |
| \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | |
| \ 'hl+': ['fg', 'Statement'], | |
| \ 'info': ['fg', 'PreProc'], | |
| \ 'prompt': ['fg', 'Conditional'], | |
| \ 'pointer': ['fg', 'Exception'], | |
| \ 'marker': ['fg', 'Keyword'], | |
| \ 'spinner': ['fg', 'Label'], | |
| \ 'header': ['fg', 'Comment'] } | |
| let g:fzf_history_dir = $HOME . "/.backup/fzf_history" | |
| if !isdirectory( g:fzf_history_dir ) | |
| call mkdir( g:fzf_history_dir , "p") | |
| endif | |
| " }}} | |
| "------------------------------------------------------------------------------- | |
| " file types " | |
| "------------------------------------------------------------------------------- | |
| " rails stuff {{{ " | |
| Plug 'tpope/vim-rails', { 'for': 'ruby' } | |
| Plug 'othree/html5.vim', { 'for': 'html' } | |
| Plug 'thoughtbot/vim-rspec' | |
| Plug 'tpope/vim-dispatch' | |
| let g:rspec_command = "Dispatch rspec {spec}" | |
| nnoremap <Leader>t :call RunCurrentSpecFile()<CR> | |
| nnoremap <Leader>s :call RunNearestSpec()<CR> | |
| nnoremap <Leader>l :call RunLastSpec()<CR> | |
| " }}} rails stuff " | |
| Plug 'chase/vim-ansible-yaml' | |
| Plug 'hashivim/vim-terraform' | |
| Plug 'posva/vim-vue' | |
| Plug 'digitaltoad/vim-pug' | |
| "===================Plug loading ends========================================== | |
| call plug#end() | |
| "if has 256 colour, use a 256 colour theme | |
| if $TERM =~ '^\(xterm\|screen\)' || $TERM =~ '256color$' || has("gui_running") | |
| if !has("gui_running") | |
| set t_Co=256 | |
| endif | |
| set t_8f=[38;2;%lu;%lu;%lum | |
| set t_8b=[48;2;%lu;%lu;%lum | |
| colorscheme gruvbox | |
| " colorscheme Tomorrow-Night-Eighties | |
| " colorscheme SpacegrayEighties | |
| else | |
| colorscheme tango | |
| endif |