# Install Neovim apt-get install software-properties-common -y apt-get install -y neovim # Need to backport from sid apt-get install -y #python-neovim python3-neovim # python-neovim if notavailableasapackage #pip2 install --user --upgrade neovim #pip3 install --user --upgrade neovim #ln -s ~/.vim ~/.config/nvim mkdir -p ~/.config/nvim # https://github.com/Netherdrake/Dotfiles/blob/master/config/nvim/init.vim #ln -s ~/.vimrc ~/.config/nvim/init.vim # wget -c --directory-prefix ~/.config/nvim https://raw.githubusercontent.com/Netherdrake/Dotfiles/master/config/nvim/init.vim cat > ~/.config/nvim/init.vim << 'EOF' """""""""""""""""""""""""""""""" " " PACKAGE MANAGEMENT " """""""""""""""""""""""""""""""" " not a vi set encoding=utf-8 " start vundler filetype off set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " core plugins Bundle "gmarik/vundle" Bundle "flazz/vim-colorschemes" "Bundle "kien/ctrlp.vim" Bundle "ctrlpvim/ctrlp.vim" " vim main plugins Bundle "sjl/gundo.vim" Bundle "bling/vim-airline" Bundle "vim-airline/vim-airline-themes" Bundle "ryanoasis/vim-devicons" Bundle "jlanzarotta/bufexplorer" Bundle "scrooloose/syntastic.git" Bundle "vim-scripts/tComment" Bundle "tpope/vim-surround" Bundle "mileszs/ack.vim" Bundle "rking/ag.vim" Bundle "edsono/vim-matchit" Bundle "tpope/vim-fugitive" Bundle 'jreybert/vimagit' Bundle "henrik/vim-indexed-search" Bundle "tpope/vim-abolish" Bundle "tpope/vim-repeat" Bundle "jiangmiao/auto-pairs" Bundle "xolox/vim-session" Bundle "xolox/vim-misc" Bundle "editorconfig/editorconfig-vim" Bundle "godlygeek/tabular" Bundle "airblade/vim-gitgutter" Bundle "Lokaltog/vim-easymotion" Bundle "rhysd/clever-f.vim" " togglable panels Bundle "scrooloose/nerdtree" Bundle "tpope/vim-vinegar" Bundle "vim-scripts/taglist.vim" Bundle "majutsushi/tagbar" Bundle "sbdchd/neoformat" " language vundles Bundle "pangloss/vim-javascript" Bundle "marijnh/tern_for_vim" Bundle "othree/javascript-libraries-syntax.vim" Bundle "fatih/vim-go" " Bundle "klen/python-mode" Bundle "plasticboy/vim-markdown" Bundle "vim-scripts/c.vim" " databases Bundle "vim-scripts/SQLUtilities" Bundle "NagatoPain/AutoSQLUpperCase.vim" " autocomplete " Bundle "Valloric/YouCompleteMe" Bundle 'davidhalter/jedi-vim' Bundle "MarcWeber/vim-addon-mw-utils" Bundle "tomtom/tlib_vim" " snippets Bundle "SirVer/ultisnips" Bundle "honza/vim-snippets" " enable all the plugins filetype plugin indent on """""""""""""""""""""""""""""""" " " SETTINGS & KEYBINDINGS " """""""""""""""""""""""""""""""" set expandtab set smarttab set shiftwidth=4 set softtabstop=4 set tabstop=4 set autoindent set ruler set hidden set ignorecase set smartcase set showmatch set incsearch set hls set relativenumber set ls=2 set cursorline set nowrap set backspace=indent,eol,start set shell=/bin/bash set completeopt -=preview set textwidth=100 set wildmenu set noshowmode set cmdheight=1 " set autoread " backup/persistance settings set undodir=~/.vim/tmp/undo// set backupdir=~/.vim/tmp/backup// set directory=~/.vim/tmp/swap// set backupskip=/tmp/*,/private/tmp/*" set backup set writebackup set noswapfile " persist (g)undo tree between sessions set undofile set history=100 set undolevels=100 " set let mapleader="," " enable mouse set mouse=a " show trailing whitespaces set list set listchars=tab:▸\ ,trail:¬,nbsp:.,extends:❯,precedes:❮ augroup ListChars2 au! autocmd filetype go set listchars+=tab:\ \ autocmd ColorScheme * hi! link SpecialKey Normal augroup END " syntax highlighting syntax on colorscheme candyman " session management let g:session_directory = "~/.vim/session" let g:session_autoload = "no" let g:session_autosave = "no" let g:session_command_aliases = 1 nnoremap so :OpenSession nnoremap ss :SaveSession nnoremap sd :DeleteSession nnoremap sc :CloseSession " togglables without FN keys nnoremap 1 :GundoToggle set pastetoggle=2 nnoremap 3 :TlistToggle nnoremap 4 :TagbarToggle nnoremap 5 :NERDTreeToggle " visual reselect of just pasted nnoremap gp `[v`] "make enter break and do newlines nnoremap Oj nnoremap j i== "make space in normal mode add space nnoremap il " better scrolling nnoremap nnoremap " consistent menu navigation inoremap inoremap " intellij style autocomplete shortcut inoremap inoremap " ctrlP config let g:ctrlp_map = "" nnoremap t :CtrlPMRU nnoremap bp :CtrlPBuffer " easy motion rebinded nmap f (easymotion-f2) nmap F (easymotion-F2) " open vimrc nnoremap v :e ~/.config/nvim/init.vim nnoremap V :tabnew ~/.config/nvim/init.vim " reload all open buffers nnoremap Ra :tabdo exec "windo e!" "map next-previous jumps nnoremap m nnoremap . " Keep search matches in the middle of the window. nnoremap n nzzzv nnoremap N Nzzzv " Use sane regexes nnoremap / /\v vnoremap / /\v " Use :Subvert search nnoremap // :S / vnoremap // :S / " Use regular replace nnoremap s :%s / vnoremap s :%s / " Use :Subvert replace nnoremap S :%S / vnoremap S :%S / " clever-f prompt let g:clever_f_show_prompt = 1 let g:clever_f_across_no_line = 1 " airline if !exists("g:airline_symbols") let g:airline_symbols = {} endif let g:airline_theme="powerlineish" let g:airline_powerline_fonts=1 let g:airline#extensions#branch#empty_message = "no .git" let g:airline#extensions#whitespace#enabled = 0 let g:airline#extensions#syntastic#enabled = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#tab_nr_type = 1 " tab number let g:airline#extensions#tabline#fnamecollapse = 1 " /a/m/model.rb let g:airline#extensions#hunks#non_zero_only = 1 " git gutter " Syntastic " show list of errors and warnings on the current file nmap e :Errors " turn to next or previous errors, after open errors list nmap n :lnext nmap p :lprevious set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* " check also when just opened the file let g:syntastic_check_on_open = 1 let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_enable_signs = 1 " syntastic checker for javascript. " eslint is the only tool support JSX. " If you don't need write JSX, you can use jshint. " And eslint is slow, but not a hindrance let g:syntastic_javascript_checkers = ['jshint'] " let g:syntastic_javascript_checkers = ['eslint'] " syntastic checker for python. " let g:syntastic_python_checkers = ["pylint"] " let g:syntastic_python_checkers = ["flake8"] let g:syntastic_python_checkers = ['prospector'] " don't put icons on the sign column (it hides the vcs status icons of signify) let g:syntastic_enable_signs = 1 " custom icons (enable them if you use a patched font, and enable the previous " setting) let g:syntastic_error_symbol = '✗' let g:syntastic_warning_symbol = '⚠' let g:syntastic_style_error_symbol = '✗' let g:syntastic_style_warning_symbol = '⚠' " YouCompleteMe "let g:ycm_filetype_blacklist = {} "let g:ycm_key_list_select_completion = [] "let g:ycm_key_list_previous_completion = [] "let g:ycm_key_invoke_completion = "" "let g:ycm_collect_identifiers_from_tags_files = 1 if executable("ag") let g:ackprg = "ag --nogroup --column" let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' endif " reload ctags nnoremap C :!ctags -R --fields=+l --exclude=.git --exclude=log --exclude=tmp * " git and ack stuff let g:gitgutter_enabled = 1 let g:gitgutter_realtime = 0 let g:gitgutter_eager = 0 nnoremap G mG:Git! nnoremap g :Git nnoremap A :!ag nnoremap a :Ag! """""""""""""""""""""""""""""""" " " PROGRAMMING LANGUAGES " """""""""""""""""""""""""""""""" " vim-go settings let g:go_fmt_command = "goimports" let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 let g:go_highlight_structs = 1 " vim-go bindings augroup FileType go au! au FileType go nmap gd (go-def) au FileType go nmap dd (go-def-vertical) au FileType go nmap dv (go-doc-vertical) au FileType go nmap db (go-doc-browser) au FileType go nmap i (go-info) au FileType go nmap r (go-run) au FileType go nmap b (go-build) au FileType go nmap t (go-test) augroup END " General file runners for various languages function! LangRunner() if(&ft=="python") nnoremap r :!python % elseif(&ft=="ruby") nnoremap r :!ruby % elseif(&ft=="javascript") nnoremap r :!node % elseif(&ft=="php") nnoremap r :!php % elseif(&ft=="c") nnoremap r :!make run endif endfunction au BufEnter * call LangRunner() " enable angular syntax let g:used_javascript_libs = 'jquery,angularjs' """""""""""""""""""""""""""""""" " " COOL HACKS " """""""""""""""""""""""""""""""" " Make sure Vim returns to the same line when you reopen a file. augroup line_return au! au BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ execute 'normal! g`"zvzz' | \ endif augroup END " Visual Mode */# from Scrooloose function! s:VSetSearch() let temp = @@ norm! gvy let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') let @@ = temp endfunction vnoremap * :call VSetSearch()// vnoremap # :call VSetSearch()?? " Text Highlighter = h[1-4] function! HiInterestingWord(n) " Save our location. normal! mz " Yank the current word into the z register. normal! "zyiw " Calculate an arbitrary match ID. Hopefully nothing else is using it. let mid = 86750 + a:n " Clear existing matches, but don't worry if they don't exist. silent! call matchdelete(mid) " Construct a literal pattern that has to match at boundaries. let pat = '\V\<' . escape(@z, '\') . '\>' " Actually match the words. call matchadd("InterestingWord" . a:n, pat, 1, mid) " Move back to our original location. normal! `z endfunction nnoremap hh :call clearmatches():noh nnoremap h1 :call HiInterestingWord(1) nnoremap h2 :call HiInterestingWord(2) nnoremap h3 :call HiInterestingWord(3) nnoremap h4 :call HiInterestingWord(4) nnoremap h5 :call HiInterestingWord(5) nnoremap h6 :call HiInterestingWord(6) hi def InterestingWord1 guifg=#000000 ctermfg=16 guibg=#ffa724 ctermbg=214 hi def InterestingWord2 guifg=#000000 ctermfg=16 guibg=#aeee00 ctermbg=154 hi def InterestingWord3 guifg=#000000 ctermfg=16 guibg=#8cffba ctermbg=121 hi def InterestingWord4 guifg=#000000 ctermfg=16 guibg=#b88853 ctermbg=137 hi def InterestingWord5 guifg=#000000 ctermfg=16 guibg=#ff9eb8 ctermbg=211 hi def InterestingWord6 guifg=#000000 ctermfg=16 guibg=#ff2c4b ctermbg=195 highlight search ctermfg=white ctermbg=3423513 " better retab fu! Retab() :retab :%s/\s\+$// endfunction """""""""""""""""""""""""""""""" " " BUG WORKAROUNDS " """""""""""""""""""""""""""""""" " realign buffers when iterm goes fullscreen augroup FixProportionsOnResize au! au VimResized * exe "normal! \=" augroup END " vim mode-switch lag fix if ! has("gui_running") set ttimeoutlen=10 augroup FastEscape autocmd! au InsertEnter * set timeoutlen=0 au InsertLeave * set timeoutlen=1000 augroup END endif " macos vs linux clipboard if has("mac") set clipboard+=unnamed else set clipboard=unnamedplus endif " make C-a, C-x work properly set nrformats= " potential lag fix let g:matchparen_insert_timeout=1 " fix bufexplorer bug with hidden let g:bufExplorerFindActive=0 EOF # Only if you want to replace vim #update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60 #update-alternatives --config vi #update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60 #update-alternatives --config vim #update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 60 #update-alternatives --config editor