" vim: set et sw=2 ts=2 tw=80 : set rtp+=$HOME/.local/share/nvim/site if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif source ~/.config/nvim/plugins.vim " Use "," as leader let mapleader = "," let maplocalleader = " " set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* let g:syntastic_always_populate_loc_list = 1 let g:syntastic_check_on_wq = 0 " Disable auto-opening of location list let g:syntastic_auto_loc_list = 0 " Check on file open let g:syntastic_check_on_open = 0 " Force python3 when using systastic let g:syntastic_python_checkers=['pylint'] nnoremap c :SyntasticCheck " FILE MANAGER " Override netrw commands with Dirvish let g:loaded_netrwPlugin = 1 command! -nargs=? -complete=dir Explore Dirvish command! -nargs=? -complete=dir Sexplore belowright split | silent Dirvish command! -nargs=? -complete=dir Vexplore leftabove vsplit | silent Dirvish let g:dirvish_mode = ':sort ,^.*[\/],' " DEOPLETE let g:deoplete#enable_at_startup = 1 let g:deoplete#omni#functions = {} let g:deoplete#omni#functions.javascript = [ \ 'tern#Complete', \ 'jspc#omni' \] set completeopt=longest,menuone,preview let g:deoplete#sources = {} let g:deoplete#sources['javascript.jsx'] = ['file', 'ultisnips', 'ternjs'] " SETTINGS if !has('nvim') setlocal cm=blowfish2 end " activate mouse support set mouse=a " allow unsaved hidden buffers set hidden " set column padding when scrolling from top or bottom set scrolloff=5 " set relative line numbers set number relativenumber " set highlighting and continous search set hlsearch incsearch " show n-column limiter when textwidth is set set colorcolumn=+1 if has('nvim') " prevent terminal buffers to be closed when changing buffer autocmd TermOpen * set bufhidden=hide " restore line numbers for all buffers (revert changes of cmd below) autocmd BufCreate * set rnu nu " remove line numbers to terminal autocmd TermOpen * set nornu nonu end " set autoindent on` set autoindent " Make :find work on all files in :pwd set path+=** set wildignore+=**/node_modules/**,*~ " ADDITIONAL COMMANDS command! Q quit command! W write command! WQ wq command! WW write suda://% command! D call CreateDir() function! CreateDir() !mkdir -p '%:p:h' endfunction " emulate system clipboard inoremap "+pa vnoremap "+y inoremap " make escape work in terminal and send ESC to terminal with C-Esc tnoremap tnoremap " Automatically save folds for each file augroup AutoSaveFolds autocmd! autocmd BufWinLeave * silent! mkview autocmd BufWinEnter * silent! loadview | doautocmd BufRead augroup END " clear search pattern with F2 noremap :let @/ = "" " Switch between Windows with: Leader w nnoremap w " Re-read buffer and load modelines with: Leader m nnoremap m :doautocmd BufRead " Open fzf with all files in git with: Leader f nnoremap f :GFiles " Fix indentation with: Leader i nnoremap i mzgg=G`z " Delete buffer with: Leader d nnoremap d :bp\|bd # " move to next tab with: Leader t tnoremap :tabnext " clear trailing spaces in file function! g:ClearTrailingSpaces() silent! %s/\s\s*$//g let @/ = "" " clear last search endfunction " remove trailing spaces with: Leader t s nnoremap s :call ClearTrailingSpaces() " automatically remove trailing spaces when saving a file autocmd BufWrite * call ClearTrailingSpaces() " Reload config with: Leader R nnoremap R :source ~/.config/nvim/init.vim " show Vim's true competitor with: Leader r c m nnoremap rcm :!open https://youtu.be/jn40Ugz0vuk " open netrw in directory of current file nnoremap e :Ex " Toggle Location and Quickfix windows with these mappings let g:lt_location_list_toggle_map = 'l' let g:lt_quickfix_list_toggle_map = 'q' " Insert in the end of file with Leader c nnoremap a GA " COLORSCHEME " set colorscheme to onedark.im for nvim and airline colorscheme onedark let g:airline_theme='onedark' " PACKAGES " vim-fish setup syntax enable filetype plugin indent on " Set up :make to use fish for syntax checking. autocmd FileType fish compiler fish if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file (restore to previous version) if has('persistent_undo') set undofile " keep an undo file (undo changes after closing) endif endif