2019-01-03 16:38:39 +00:00
|
|
|
" vim: set et sw=2 ts=2 tw=80 :
|
2019-08-14 09:09:37 +00:00
|
|
|
|
2019-09-19 06:33:15 +00:00
|
|
|
set rtp+=$HOME/.local/share/nvim/site
|
2019-08-14 09:09:37 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2019-07-05 12:43:49 +00:00
|
|
|
" 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
|
|
|
|
|
2019-11-01 16:45:16 +00:00
|
|
|
" Disable auto-opening of location list
|
|
|
|
let g:syntastic_auto_loc_list = 0
|
2019-07-05 12:43:49 +00:00
|
|
|
|
2019-11-01 16:45:16 +00:00
|
|
|
" Check on file open
|
|
|
|
let g:syntastic_check_on_open = 0
|
2019-07-05 12:43:49 +00:00
|
|
|
|
2019-11-01 16:45:16 +00:00
|
|
|
" Force python3 when using systastic
|
|
|
|
let g:syntastic_python_checkers=['pylint']
|
2019-07-05 12:43:49 +00:00
|
|
|
|
2019-11-01 16:45:16 +00:00
|
|
|
nnoremap <silent> <Leader>c :SyntasticCheck<CR>
|
2018-12-18 21:22:11 +00:00
|
|
|
|
2019-06-29 14:37:23 +00:00
|
|
|
" FILE MANAGER
|
|
|
|
|
|
|
|
" Override netrw commands with Dirvish
|
|
|
|
let g:loaded_netrwPlugin = 1
|
|
|
|
command! -nargs=? -complete=dir Explore Dirvish <args>
|
|
|
|
command! -nargs=? -complete=dir Sexplore belowright split | silent Dirvish <args>
|
|
|
|
command! -nargs=? -complete=dir Vexplore leftabove vsplit | silent Dirvish <args>
|
|
|
|
|
|
|
|
let g:dirvish_mode = ':sort ,^.*[\/],'
|
|
|
|
|
2019-11-01 16:45:16 +00:00
|
|
|
" 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']
|
|
|
|
|
2018-12-18 21:22:11 +00:00
|
|
|
" SETTINGS
|
|
|
|
|
2018-12-30 19:31:26 +00:00
|
|
|
if !has('nvim')
|
|
|
|
setlocal cm=blowfish2
|
|
|
|
end
|
|
|
|
|
2019-04-18 20:40:57 +00:00
|
|
|
" activate mouse support
|
|
|
|
set mouse=a
|
|
|
|
|
2019-02-14 18:21:26 +00:00
|
|
|
" allow unsaved hidden buffers
|
|
|
|
set hidden
|
|
|
|
|
2019-02-15 21:02:17 +00:00
|
|
|
" set column padding when scrolling from top or bottom
|
|
|
|
set scrolloff=5
|
|
|
|
|
2018-12-10 19:36:10 +00:00
|
|
|
" set relative line numbers
|
|
|
|
set number relativenumber
|
2018-12-18 21:22:11 +00:00
|
|
|
|
|
|
|
" set highlighting and continous search
|
2018-12-10 19:36:10 +00:00
|
|
|
set hlsearch incsearch
|
2018-12-18 21:22:11 +00:00
|
|
|
|
|
|
|
" show n-column limiter when textwidth is set
|
2018-12-10 19:36:10 +00:00
|
|
|
set colorcolumn=+1
|
2018-12-18 21:22:11 +00:00
|
|
|
|
2018-12-30 19:31:26 +00:00
|
|
|
if has('nvim')
|
|
|
|
" prevent terminal buffers to be closed when changing buffer
|
|
|
|
autocmd TermOpen * set bufhidden=hide
|
2018-12-18 21:22:11 +00:00
|
|
|
|
2019-02-14 18:21:26 +00:00
|
|
|
" restore line numbers for all buffers (revert changes of cmd below)
|
|
|
|
autocmd BufCreate * set rnu nu
|
|
|
|
|
|
|
|
" remove line numbers to terminal
|
2018-12-30 19:31:26 +00:00
|
|
|
autocmd TermOpen * set nornu nonu
|
|
|
|
end
|
2018-12-18 21:22:11 +00:00
|
|
|
|
|
|
|
" set autoindent on`
|
|
|
|
set autoindent
|
|
|
|
|
|
|
|
" Make :find work on all files in :pwd
|
|
|
|
set path+=**
|
2019-01-21 19:50:15 +00:00
|
|
|
set wildignore+=**/node_modules/**,*~
|
2018-12-18 21:22:11 +00:00
|
|
|
|
2019-06-29 14:37:23 +00:00
|
|
|
" ADDITIONAL COMMANDS
|
2019-01-20 12:28:38 +00:00
|
|
|
|
2019-06-29 14:37:23 +00:00
|
|
|
command! Q quit
|
|
|
|
command! W write
|
|
|
|
command! WQ wq
|
2019-01-20 12:28:38 +00:00
|
|
|
|
2019-06-29 14:37:23 +00:00
|
|
|
command! WW write suda://%
|
2019-02-05 13:54:59 +00:00
|
|
|
|
2019-06-29 14:37:23 +00:00
|
|
|
command! D call CreateDir()
|
2018-12-18 21:22:11 +00:00
|
|
|
|
2019-06-29 14:37:23 +00:00
|
|
|
function! CreateDir()
|
|
|
|
!mkdir -p '%:p:h'
|
2019-06-27 20:39:08 +00:00
|
|
|
endfunction
|
|
|
|
|
2019-02-02 22:25:50 +00:00
|
|
|
" emulate system clipboard
|
|
|
|
inoremap <C-v> <ESC>"+pa
|
|
|
|
vnoremap <C-c> "+y
|
|
|
|
|
2019-01-03 16:38:39 +00:00
|
|
|
inoremap <S-tab> <C-d>
|
|
|
|
|
2018-12-18 09:15:06 +00:00
|
|
|
" make escape work in terminal and send ESC to terminal with C-Esc
|
|
|
|
tnoremap <Esc> <C-\><C-n>
|
|
|
|
tnoremap <C-Esc> <Esc>
|
|
|
|
|
2019-04-18 20:40:57 +00:00
|
|
|
" Automatically save folds for each file
|
|
|
|
augroup AutoSaveFolds
|
|
|
|
autocmd!
|
2019-06-27 20:39:08 +00:00
|
|
|
autocmd BufWinLeave * silent! mkview
|
2019-08-12 09:25:43 +00:00
|
|
|
autocmd BufWinEnter * silent! loadview | doautocmd BufRead
|
2019-04-18 20:40:57 +00:00
|
|
|
augroup END
|
|
|
|
|
2019-01-03 16:38:39 +00:00
|
|
|
" clear search pattern with F2
|
|
|
|
noremap <F2> :let @/ = ""<CR>
|
2018-12-18 21:22:11 +00:00
|
|
|
|
2018-12-27 12:20:34 +00:00
|
|
|
" Switch between Windows with: Leader w
|
|
|
|
nnoremap <Leader>w <C-w><C-w>
|
|
|
|
|
2019-08-12 09:25:43 +00:00
|
|
|
" Re-read buffer and load modelines with: Leader m
|
|
|
|
nnoremap <Leader>m :doautocmd BufRead<CR>
|
|
|
|
|
2019-07-05 12:43:49 +00:00
|
|
|
" Open fzf with all files in git with: Leader f
|
|
|
|
nnoremap <Leader>f :GFiles<CR>
|
2019-01-03 16:38:39 +00:00
|
|
|
|
|
|
|
" Fix indentation with: Leader i
|
|
|
|
nnoremap <Leader>i mzgg=G`z
|
2018-12-27 12:20:34 +00:00
|
|
|
|
|
|
|
" Delete buffer with: Leader d
|
2019-01-03 21:58:42 +00:00
|
|
|
nnoremap <Leader>d :bp\|bd #<CR>
|
|
|
|
|
|
|
|
" move to next tab with: Leader t
|
|
|
|
tnoremap <C-e> <C-\><C-n>:tabnext<CR>
|
2019-01-03 16:38:39 +00:00
|
|
|
|
|
|
|
" clear trailing spaces in file
|
|
|
|
function! g:ClearTrailingSpaces()
|
2019-04-18 20:40:57 +00:00
|
|
|
silent! %s/\s\s*$//g
|
2019-01-03 16:38:39 +00:00
|
|
|
let @/ = "" " clear last search
|
|
|
|
endfunction
|
2018-12-27 12:20:34 +00:00
|
|
|
|
2019-01-03 16:38:39 +00:00
|
|
|
" remove trailing spaces with: Leader t s
|
2019-01-17 21:24:04 +00:00
|
|
|
nnoremap <silent> <Leader>s :call ClearTrailingSpaces()<CR>
|
2019-01-03 16:38:39 +00:00
|
|
|
|
|
|
|
" automatically remove trailing spaces when saving a file
|
|
|
|
autocmd BufWrite * call ClearTrailingSpaces()
|
2018-12-27 12:20:34 +00:00
|
|
|
|
|
|
|
" Reload config with: Leader R
|
2019-01-03 16:38:39 +00:00
|
|
|
nnoremap <Leader>R :source ~/.config/nvim/init.vim<CR>
|
2018-12-27 12:20:34 +00:00
|
|
|
|
|
|
|
" show Vim's true competitor with: Leader r c m
|
|
|
|
nnoremap <Leader>rcm :!open https://youtu.be/jn40Ugz0vuk<CR><CR>
|
2018-12-18 21:22:11 +00:00
|
|
|
|
2019-01-20 12:28:38 +00:00
|
|
|
" open netrw in directory of current file
|
|
|
|
nnoremap <Leader>e :Ex<CR>
|
|
|
|
|
2019-06-30 12:04:49 +00:00
|
|
|
" Toggle Location and Quickfix windows with these mappings
|
|
|
|
let g:lt_location_list_toggle_map = '<leader>l'
|
|
|
|
let g:lt_quickfix_list_toggle_map = '<leader>q'
|
2019-01-21 19:50:15 +00:00
|
|
|
|
2019-04-18 20:40:57 +00:00
|
|
|
" Insert in the end of file with Leader c
|
2019-11-01 16:45:16 +00:00
|
|
|
nnoremap <Leader>a GA
|
2019-04-18 20:40:57 +00:00
|
|
|
|
2018-12-18 21:22:11 +00:00
|
|
|
" COLORSCHEME
|
|
|
|
|
2018-12-27 12:20:34 +00:00
|
|
|
" set colorscheme to onedark.im for nvim and airline
|
2018-12-18 21:22:11 +00:00
|
|
|
colorscheme onedark
|
|
|
|
let g:airline_theme='onedark'
|
|
|
|
|
|
|
|
" PACKAGES
|
|
|
|
|
|
|
|
" vim-fish setup
|
2018-12-18 09:15:06 +00:00
|
|
|
syntax enable
|
|
|
|
filetype plugin indent on
|
|
|
|
" Set up :make to use fish for syntax checking.
|
|
|
|
autocmd FileType fish compiler fish
|
2018-12-10 19:36:10 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|