2015-03-05 17:26:59 +00:00
|
|
|
set nocompatible " be iMproved
|
|
|
|
|
|
|
|
let iCanHazPlugged=1
|
|
|
|
let vim_plug_file=expand("~/.vim/autoload/plug.vim")
|
|
|
|
if !filereadable(vim_plug_file)
|
|
|
|
echo "Installing vim-plug"
|
|
|
|
echo ""
|
|
|
|
silent !mkdir -p ~/.vim/autoload
|
|
|
|
silent !curl -fLo ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
let iCanHazPlugged=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
call plug#begin()
|
|
|
|
|
|
|
|
" My Plugs here:
|
|
|
|
"
|
|
|
|
" original repos on github
|
|
|
|
Plug 'majutsushi/tagbar'
|
|
|
|
" Plug 'altercation/vim-colors-solarized'
|
|
|
|
|
|
|
|
" Github repos of the user 'vim-scripts'
|
|
|
|
" => can omit the username part for some plugins
|
|
|
|
Plug 'Raimondi/delimitMate'
|
|
|
|
Plug 'ervandew/supertab'
|
|
|
|
Plug 'fisadev/FixedTaskList.vim'
|
|
|
|
Plug 'fatih/vim-go'
|
|
|
|
Plug 'https://github.com/scrooloose/nerdtree.git', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
|
|
|
|
Plug 'https://github.com/tpope/vim-fugitive.git'
|
|
|
|
Plug 'https://github.com/vim-scripts/LustyJuggler.git'
|
|
|
|
Plug 'lilydjwg/colorizer'
|
|
|
|
Plug 'moll/vim-bbye'
|
|
|
|
Plug 'syntastic'
|
|
|
|
Plug 'terryma/vim-multiple-cursors'
|
|
|
|
Plug 'vim-airline'
|
|
|
|
Plug 'nathanaelkane/vim-indent-guides'
|
|
|
|
Plug 'leafgarland/typescript-vim'
|
|
|
|
Plug 'guns/xterm-color-table.vim'
|
2016-12-05 20:35:07 +00:00
|
|
|
Plug 'SirVer/ultisnips'
|
|
|
|
Plug 'honza/vim-snippets'
|
|
|
|
Plug 'mhinz/vim-hugefile'
|
|
|
|
Plug 'darfink/vim-plist'
|
2015-03-05 17:26:59 +00:00
|
|
|
|
|
|
|
" This one is sort of large, so disabling unless I really need it.
|
2016-12-05 20:35:07 +00:00
|
|
|
Plug 'klen/python-mode'
|
2015-03-05 17:26:59 +00:00
|
|
|
|
|
|
|
" non github repos
|
|
|
|
" Plug 'git://git.wincent.com/command-t.git'
|
|
|
|
" ...
|
|
|
|
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
if iCanHazPlugged == 0
|
|
|
|
echo "Installing plugs"
|
|
|
|
echo ""
|
|
|
|
:PlugUpdate
|
|
|
|
endif
|
|
|
|
|
|
|
|
"====[ Set various behavior preferences ]==================
|
|
|
|
|
|
|
|
set tabstop=4
|
|
|
|
set shiftwidth=4
|
|
|
|
set softtabstop=4
|
|
|
|
set noexpandtab
|
|
|
|
set smartindent
|
|
|
|
filetype indent off
|
|
|
|
filetype plugin on
|
|
|
|
|
|
|
|
syntax on
|
|
|
|
set t_Co=256
|
|
|
|
set background=dark
|
|
|
|
|
|
|
|
" The following are commented out as they cause vim to behave a lot
|
|
|
|
" differently from regular Vi. They are highly recommended though.
|
|
|
|
"set showcmd " Show (partial) command in status line.
|
2016-12-05 20:35:07 +00:00
|
|
|
set laststatus=2
|
2015-03-05 17:26:59 +00:00
|
|
|
set showmatch " Show matching brackets.
|
|
|
|
set ignorecase " Do case insensitive matching
|
|
|
|
set smartcase " Do smart case matching
|
|
|
|
"set incsearch " Incremental search
|
|
|
|
set autowrite " Automatically save before commands like :next and :make
|
|
|
|
set hidden " Hide buffers when they are abandoned
|
|
|
|
set mouse=a " Enable mouse usage (all modes) in terminals
|
|
|
|
set scrolloff=3
|
|
|
|
set hls
|
|
|
|
|
|
|
|
set browsedir=buffer
|
|
|
|
|
|
|
|
colorscheme desert
|
|
|
|
|
|
|
|
"====[ Change various key bindings ]=======================
|
|
|
|
|
|
|
|
vnoremap < <gv
|
|
|
|
vnoremap > >gv
|
|
|
|
|
|
|
|
nnoremap < <<
|
|
|
|
nnoremap > >>
|
|
|
|
|
|
|
|
set nu
|
|
|
|
|
|
|
|
" Dvorak it!
|
|
|
|
no d h
|
|
|
|
no h j
|
|
|
|
no t k
|
|
|
|
no n l
|
|
|
|
no j d
|
|
|
|
no l n
|
|
|
|
no L N
|
|
|
|
" Replaces s with the :, I prefer having s around...
|
|
|
|
" no s :
|
|
|
|
" no S :
|
|
|
|
|
|
|
|
" Added benefits
|
|
|
|
no - $
|
|
|
|
no _ ^
|
|
|
|
|
|
|
|
no N <C-w><C-w>
|
|
|
|
no D <C-w>W
|
|
|
|
no S <C-w><C-r>
|
|
|
|
|
|
|
|
no H 20<down>
|
|
|
|
no T 20<up>
|
|
|
|
|
|
|
|
no <Leader>h H
|
|
|
|
no <Leader>m M
|
|
|
|
no <Leader>l L
|
|
|
|
|
|
|
|
map Q <Nop>
|
|
|
|
|
|
|
|
nnoremap <C-u> :redo<cr>
|
|
|
|
nnoremap <F5> :set paste!<CR>
|
|
|
|
command! W :w
|
|
|
|
|
|
|
|
set backspace=2
|
|
|
|
|
|
|
|
set wildchar=<Tab> wildmenu wildmode=full
|
|
|
|
set wildcharm=<C-Z>
|
|
|
|
|
|
|
|
" shush the bell
|
|
|
|
set noerrorbells
|
|
|
|
set vb
|
|
|
|
set t_vb=
|
|
|
|
|
|
|
|
set directory^=$HOME/.vim_swap/ "put all swap files together in one place
|
|
|
|
|
|
|
|
let mapleader = ","
|
|
|
|
|
|
|
|
nmap <silent> <Leader>. :LustyJuggler<CR>
|
|
|
|
let g:LustyJugglerKeyboardLayout = "dvorak"
|
2016-12-05 20:35:07 +00:00
|
|
|
let g:LustyJugglerSuppressRubyWarning = 1
|
2015-03-05 17:26:59 +00:00
|
|
|
|
|
|
|
nnoremap <silent> <Leader>/ :nohlsearch<CR>
|
|
|
|
|
|
|
|
nnoremap <Leader>q :Bdelete!<CR>
|
|
|
|
|
2016-12-05 20:35:07 +00:00
|
|
|
"====[ ctrlp replacement settings ]========================
|
2015-03-05 17:26:59 +00:00
|
|
|
|
|
|
|
augroup ctrlp
|
|
|
|
autocmd!
|
|
|
|
|
2016-12-05 20:35:07 +00:00
|
|
|
nnoremap ' :ls<cr>:b
|
|
|
|
nnoremap <BS> <C-^>
|
2015-03-05 17:26:59 +00:00
|
|
|
|
2016-12-05 20:35:07 +00:00
|
|
|
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/*
|
|
|
|
|
|
|
|
if executable('ack')
|
|
|
|
set grepprg=ack\ -s\ -H\ --nogroup\ --nocolor\ --column
|
|
|
|
set grepformat=%f:%l:%c:%m,%f:%l:%m
|
|
|
|
endif
|
2015-03-05 17:26:59 +00:00
|
|
|
augroup END
|
|
|
|
|
|
|
|
"====[ Set syntastic options ]=============================
|
|
|
|
|
|
|
|
" Syntastic options
|
|
|
|
let g:syntastic_check_on_open=1
|
|
|
|
let g:syntastic_enable_signs=1
|
|
|
|
|
|
|
|
let g:syntastic_error_symbol='✗'
|
|
|
|
let g:syntastic_warning_symbol='⚠'
|
|
|
|
|
|
|
|
let g:syntastic_enable_balloons = 1
|
|
|
|
let g:syntastic_auto_loc_list=2
|
|
|
|
|
|
|
|
let g:syntastic_loc_list_height=6
|
|
|
|
|
|
|
|
let g:syntastic_cpp_checkers = ['clang_checker -std=c++1y']
|
|
|
|
let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
|
2016-12-05 20:35:07 +00:00
|
|
|
|
|
|
|
let g:syntastic_go_checkers = ['govet', 'errcheck']
|
|
|
|
"let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
|
2015-03-05 17:26:59 +00:00
|
|
|
|
|
|
|
"====[ Set JavaScript options ]============================
|
|
|
|
|
|
|
|
augroup jsopts
|
|
|
|
autocmd!
|
|
|
|
autocmd BufNewFile,BufRead *.json set ft=javascript
|
|
|
|
function! TrimWhiteSpace()
|
|
|
|
%s/\s\+$//e
|
|
|
|
endfunction
|
|
|
|
let g:tlist_javascript_settings = 'javascript;a:array;b:boolean;c:class;f:function;m:method;n:number;o:object;p:property;s:string;v:variable'
|
|
|
|
au FileType javascript setlocal equalprg=~/local/bin/js-beautify\ -f\ -\ -q\ -t\ -w\ 120\ -b\ \"end-expand\"
|
|
|
|
au FileType javascript set suffixesadd=.js,.json
|
|
|
|
au FileType javascript set includeexpr=FindRequire(v:fname)
|
|
|
|
autocmd FileType javascript autocmd FileWritePre * :call TrimWhiteSpace()
|
|
|
|
autocmd FileType javascript autocmd FileAppendPre * :call TrimWhiteSpace()
|
|
|
|
autocmd FileType javascript autocmd FilterWritePre * :call TrimWhiteSpace()
|
|
|
|
autocmd FileType javascript autocmd BufWritePre * :call TrimWhiteSpace()
|
|
|
|
let g:syntastic_javascript_checkers = ['jshint']
|
|
|
|
"let g:syntastic_javascript_jshint_args = "--config ~/.jshintrc"
|
|
|
|
" Code Folding
|
|
|
|
au FileType javascript syntax region foldBraces start=/{/ end=/}/ transparent fold keepend extend
|
|
|
|
au FileType javascript setlocal foldmethod=syntax
|
|
|
|
au FileType javascript setlocal foldlevel=99
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
"====[ Set golang options ]================================
|
|
|
|
|
|
|
|
augroup golang
|
|
|
|
autocmd!
|
|
|
|
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
|
|
|
|
let g:go_disable_autoinstall = 1
|
|
|
|
let g:go_fmt_command = 'goimports'
|
2016-12-05 20:35:07 +00:00
|
|
|
au FileType go setlocal foldmethod=syntax
|
|
|
|
au FileType go setlocal foldlevel=99
|
2015-03-05 17:26:59 +00:00
|
|
|
augroup END
|
|
|
|
|
|
|
|
"====[ Set NERDTree options ]==============================
|
|
|
|
|
|
|
|
augroup nerdtree
|
|
|
|
autocmd!
|
|
|
|
|
|
|
|
" Make NERDTree start on startup
|
|
|
|
"autocmd vimenter * if !argc() | NERDTree | endif
|
|
|
|
|
|
|
|
nnoremap <silent> <Leader>d :NERDTreeFind<CR>
|
|
|
|
nnoremap <C-d> :NERDTreeToggle<CR>
|
|
|
|
|
|
|
|
" 'Disable' these, they're obnoxious:
|
|
|
|
let NERDTreeMapOpenInTab='zzzzzz'
|
|
|
|
let NERDTreeMapOpenInTabSilent='zzzzzzz'
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
let g:airline_powerline_fonts=1
|
|
|
|
let g:airline_enable_syntastic=1
|
|
|
|
"let g:airline_theme='dark'
|
|
|
|
|
|
|
|
"====[ Enable relative line numbers ]======================
|
|
|
|
|
|
|
|
function! NumberToggle()
|
|
|
|
if(&relativenumber == 1)
|
|
|
|
set number
|
|
|
|
set norelativenumber
|
|
|
|
else
|
|
|
|
set number
|
|
|
|
set relativenumber
|
|
|
|
endif
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
nnoremap <C-r> :call NumberToggle()<cr>
|
|
|
|
|
|
|
|
"====[ Make the 81st column stand out ]====================
|
|
|
|
|
|
|
|
" EITHER the entire 81st column, full-screen...
|
|
|
|
"highlight ColorColumn ctermbg=magenta
|
|
|
|
"set colorcolumn=81
|
|
|
|
|
|
|
|
" OR ELSE just the 81st column of wide lines...
|
|
|
|
highlight ColorColumn ctermbg=magenta
|
|
|
|
call matchadd('ColorColumn', '\%81v', 100)
|
|
|
|
|
|
|
|
" OR ELSE on April Fools day...
|
|
|
|
"highlight ColorColumn ctermbg=red ctermfg=blue
|
|
|
|
"exec 'set colorcolumn=' . join(range(2,80,3), ',')
|
|
|
|
|
|
|
|
"====[ Fix listchars ]====================================
|
|
|
|
|
|
|
|
exec "set listchars=tab:\uBB\uBB,trail:\uB7,nbsp:~"
|
|
|
|
nnoremap <F6> :set list!<CR>
|
|
|
|
"nnoremap <C-l> :set list!<CR>
|
|
|
|
|
|
|
|
"====[ Enable dragging ]==================================
|
|
|
|
|
|
|
|
vmap <expr> <LEFT> DVB_Drag('left')
|
|
|
|
vmap <expr> <RIGHT> DVB_Drag('right')
|
|
|
|
vmap <expr> <UP> DVB_Drag('up')
|
|
|
|
vmap <expr> <DOWN> DVB_Drag('down')
|
|
|
|
vmap <expr> D DVB_Duplicate()
|
|
|
|
|
|
|
|
"====[ Python settings ]==================================
|
|
|
|
|
2016-12-05 20:35:07 +00:00
|
|
|
let g:pymode_indent = 1
|
2015-03-05 17:26:59 +00:00
|
|
|
let g:pymode_rope = 0
|
|
|
|
let g:pymode_folding = 0
|
|
|
|
let g:pymode_lint_ignore = "W191,E251,E203,E221,E126,E128"
|
|
|
|
let NERDTreeIgnore=['.pyc$']
|
|
|
|
let g:pymode_doc = 0
|
2016-12-05 20:35:07 +00:00
|
|
|
au FileType python set expandtab
|
2015-03-05 17:26:59 +00:00
|
|
|
au FileType python set tabstop=4
|
|
|
|
|
|
|
|
"====[ General Text Editing settings ]====================
|
|
|
|
au BufNewFile,BufRead *.md set filetype=markdown
|
|
|
|
command! Check new|0read !check
|
|
|
|
|
|
|
|
"====[ Supertab settings ]================================
|
|
|
|
let g:SuperTabDefaultCompletionType = "context"
|
|
|
|
|
|
|
|
"====[ Mulitple Cursors Settings ]========================
|
|
|
|
let g:multi_cursor_next_key='<C-n>'
|
|
|
|
|
|
|
|
"====[ Task List Settings ]===============================
|
|
|
|
map <leader>t :TaskList<CR>
|
|
|
|
|
|
|
|
"====[ Indent Guides ]====================================
|
|
|
|
let g:indent_guides_guide_size = 1
|
|
|
|
autocmd VimEnter * :IndentGuidesEnable
|
|
|
|
let g:indent_guides_auto_colors = 0
|
|
|
|
hi IndentGuidesOdd ctermbg=0
|
|
|
|
hi IndentGuidesEven ctermbg=235
|
|
|
|
nnoremap <C-l> :IndentGuidesToggle<CR>
|
|
|
|
|
|
|
|
"====[ TypeScript ]=======================================
|
|
|
|
autocmd BufNewFile,BufRead *.ts set ft=typescript
|
|
|
|
let g:typescript_compiler_options = " -t ES5 -m commonjs"
|
|
|
|
let g:syntastic_typescript_tsc_args = "-t ES5 -m commonjs"
|
|
|
|
|
2016-12-05 20:35:07 +00:00
|
|
|
"====[ UltiSnips ]========================================
|
|
|
|
let g:UltiSnipsExpandTrigger="<tab>"
|
|
|
|
let g:UltiSnipsJumpForwardTrigger="<c-b>"
|
|
|
|
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|
|
|
|
|
|
|
|
" If you want :UltiSnipsEdit to split your window.
|
|
|
|
let g:UltiSnipsEditSplit="vertical"
|
|
|
|
|
|
|
|
"====[ Nice Commands ]====================================
|
|
|
|
command! -bang -nargs=* -bar Make silent w | silent make <args> | unsilent redraw! | cwindow
|
|
|
|
command! -bang -nargs=* -complete=file -bar Grep silent! grep! <args> | unsilent redraw! | cwindow
|