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 'Xuyuanp/nerdtree-git-plugin' Plug 'https://github.com/tpope/vim-fugitive.git' " Plug 'https://github.com/vim-scripts/LustyJuggler.git' Plug 'lilydjwg/colorizer' Plug 'moll/vim-bbye' " Plug 'vim-syntastic/syntastic' Plug 'terryma/vim-multiple-cursors' Plug 'vim-airline/vim-airline' Plug 'nathanaelkane/vim-indent-guides' Plug 'leafgarland/typescript-vim' Plug 'guns/xterm-color-table.vim' "Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' Plug 'mhinz/vim-hugefile' Plug 'darfink/vim-plist' "Plug 'vimwiki/vimwiki' Plug 'xolox/vim-misc' Plug 'xolox/vim-notes' " Plug 'asciidoc/vim-asciidoc' Plug 'habamax/vim-asciidoctor' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'elmcast/elm-vim' Plug 'ctrlpvim/ctrlp.vim' Plug 'https://gitlab.com/betseg/vim-dcrpc.git' "Plug 'ambv/black', Plug 'rust-lang/rust.vim' Plug 'w0rp/ale' " 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. set laststatus=2 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 " NOTE: this could be confusing to use. It will chdir to the current file " set autochdir "====[ Change various key bindings ]======================= 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 no s c " Replaces s with the :, I prefer having s around... " no s : " no S : " Added benefits no - $ no _ ^ no N no D W no S no H 20 no T 20 no h H no m M no l L map Q "nnoremap :Make nnoremap :w nnoremap :redo nnoremap :set paste! nnoremap :Make command! W :w set backspace=2 set wildchar= wildmenu wildmode=full set wildcharm= " shush the bell set noerrorbells set vb set t_vb= let vim_plug_file=expand("~/.vim/autoload/plug.vim") if !filereadable("~/.vim_backup/") silent !mkdir -p ~/.vim_backup/ endif if !filereadable("~/.vim_swap/") silent !mkdir -p ~/.vim_swap/ endif set backupdir=$HOME/.vim_backup/,/tmp,/var/tmp "put all swap files together in one place set directory=$HOME/.vim_swap/,/tmp,/var/tmp "put all swap files together in one place let mapleader = "," nmap . :LustyJuggler let g:LustyJugglerKeyboardLayout = "dvorak" let g:LustyJugglerSuppressRubyWarning = 1 nnoremap / :nohlsearch nnoremap q :Bdelete! "====[ ctrlp replacement settings ]======================== augroup ctrlp autocmd! nnoremap ` :ls:b nnoremap set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/* let g:ctrlp_user_command = 'find %s -type f' if executable('ack') set grepprg=ack\ -s\ -H\ --nogroup\ --nocolor\ --column set grepformat=%f:%l:%c:%m,%f:%l:%m endif 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}]' let g:syntastic_go_checkers = ['govet', 'errcheck'] "let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } let g:syntastic_python_checkers = ['pyflakes'] "====[ 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=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 Fmt let g:go_disable_autoinstall = 1 let g:go_fmt_command = 'goimports' au FileType go setlocal foldmethod=syntax au FileType go setlocal foldlevel=99 nnoremap :GoTest augroup END "====[ Set NERDTree options ]============================== function! NERDSwitch() if !exists("g:NERDTreeWinPos") let g:NERDTreeWinPos=0 endif if (g:NERDTreeWinPos == 0) let g:NERDTreeWinPos=1 :NERDTreeClose :NERDTreeToggle else let g:NERDTreeWinPos=0 :NERDTreeClose :NERDTreeToggle endif endfunc augroup nerdtree autocmd! let NERDTreeWinPos=1 " Make NERDTree start on startup "autocmd vimenter * if !argc() | NERDTree | endif nnoremap d :NERDTreeFind nnoremap D :call NERDSwitch() nnoremap :NERDTreeToggle " 'Disable' these, they're obnoxious: let NERDTreeMapOpenInTab='zzzzzz' let NERDTreeMapOpenInTabSilent='zzzzzzz' " Experimental: let NERDTreeHijackNetrw=1 augroup END let g:airline_powerline_fonts=1 let g:airline_enable_syntastic=1 "let g:airline_theme='dark' "====[ 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 :set list! "nnoremap :set list! "====[ Enable dragging ]================================== vmap DVB_Drag('left') vmap DVB_Drag('right') vmap DVB_Drag('up') vmap DVB_Drag('down') vmap D DVB_Duplicate() "====[ Python settings ]================================== " For NeoVIM "let g:python2_host_prog = '/usr/bin/python' let g:loaded_python_provider = 1 "let g:python3_host_prog = '/Users/cws/src/gitlab.com/chrissexton/research/.direnv/python-3.6.5/bin/python' "let g:python3_host_prog = '/usr/local/bin/python3' " This one is sort of large, so disabling unless I really need it. "Plug 'python-mode/python-mode', { 'branch': 'develop' } let g:pymode_python = 'python3' let g:pymode_indent = 1 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 au FileType python set expandtab au FileType python set tabstop=4 "====[ fsharp settings ]================================== au FileType fsharp set expandtab au FileType fsharp 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='' "====[ Task List Settings ]=============================== map t :TaskList "====[ 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 :IndentGuidesToggle "====[ 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" "====[ UltiSnips ]======================================== let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" " If you want :UltiSnipsEdit to split your window. let g:UltiSnipsEditSplit="vertical" "====[ Nice Commands ]==================================== command! -bang -nargs=* -bar Make silent w | silent make | unsilent redraw! | cwindow command! -bang -nargs=* -complete=file -bar Grep silent! grep! | unsilent redraw! | cwindow "====[ VIM Wiki ]========================================= let wiki_1 = {} let wiki_1.path = '~/Dropbox/Notes/vimwiki' let g:vimwiki_list = [wiki_1] "====[ VIM Notes ]======================================== let g:notes_directories = ['~/Documents/vimnotes'] let g:notes_suffix = '.txt' no n :Note index no t :Note todo if has("autocmd") augroup templates autocmd BufNewFile *.adoc 0r ~/.templates/note.adoc augroup END endif "====[ ALE Options ]====================================== let g:ale_linters = { \ 'asciidoc': [], \ 'typescript': [], \ 'javascript': [], \} set clipboard=unnamed