2019-11-25 01:14:58 +01:00
|
|
|
call plug#begin('~/.config/nvim/bundle')
|
2019-10-24 11:55:49 +02:00
|
|
|
" USEFUL
|
2020-05-23 17:24:20 +02:00
|
|
|
" Editor config
|
|
|
|
Plug 'editorconfig/editorconfig-vim'
|
2019-10-24 17:05:48 +02:00
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" comment plugin
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'tpope/vim-commentary'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" brackets management
|
2020-04-16 15:13:26 +02:00
|
|
|
Plug 'tpope/vim-surround'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" WINDOW MANAGEMENT
|
2019-10-24 12:43:34 +02:00
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" tmux navigator
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'christoomey/vim-tmux-navigator'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" winresizer
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'simeji/winresizer'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
2020-04-21 00:02:30 +02:00
|
|
|
" goyo
|
|
|
|
Plug 'junegunn/goyo.vim'
|
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" FILE MANAGEMENT
|
2020-04-16 20:29:05 +02:00
|
|
|
" nerd-tree
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'scrooloose/nerdtree'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" fzf plugin
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'junegunn/fzf.vim'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
2020-04-16 20:29:05 +02:00
|
|
|
" vimwiki
|
|
|
|
Plug 'vimwiki/vimwiki'
|
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" GIT STUFF
|
|
|
|
" git
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'tpope/vim-fugitive'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" vim gitgutter
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'airblade/vim-gitgutter'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" COLORS
|
2019-10-24 12:43:34 +02:00
|
|
|
" Plastic colorscheme
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'aonemd/kuroi.vim'
|
2019-10-24 12:43:34 +02:00
|
|
|
|
|
|
|
" Color higlighting
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'norcalli/nvim-colorizer.lua'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" powerline
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'vim-airline/vim-airline'
|
2019-10-26 23:23:13 +02:00
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" language packs
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'sheerun/vim-polyglot'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" latex
|
2019-11-25 01:14:58 +01:00
|
|
|
Plug 'lervag/vimtex'
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" All of your Plugins must be added before the following line
|
2019-11-25 01:14:58 +01:00
|
|
|
call plug#end()
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" nvim setup
|
|
|
|
" syntax
|
|
|
|
syntax on
|
|
|
|
let mapleader=" "
|
|
|
|
|
2019-10-24 12:43:34 +02:00
|
|
|
" color settings
|
|
|
|
set termguicolors
|
|
|
|
colorscheme kuroi
|
|
|
|
set background=dark
|
2019-11-26 23:42:54 +01:00
|
|
|
hi MatchParen guibg=NONE guifg=red gui=bold
|
2019-10-24 12:43:34 +02:00
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" random settings
|
|
|
|
set number
|
|
|
|
set clipboard=unnamed
|
|
|
|
set mouse=nvi
|
2020-04-16 20:29:05 +02:00
|
|
|
" set smarttab
|
|
|
|
set expandtab
|
|
|
|
set tabstop=4
|
2019-10-24 11:55:49 +02:00
|
|
|
set visualbell
|
|
|
|
set virtualedit=block
|
|
|
|
set scrolloff=1
|
|
|
|
set wildmenu
|
|
|
|
set autoread
|
|
|
|
set lazyredraw
|
|
|
|
set history=250
|
2020-04-21 00:02:30 +02:00
|
|
|
set noshowmode
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" tabs and line wrap
|
|
|
|
set tabstop=4
|
|
|
|
set wrapmargin=8
|
|
|
|
set softtabstop=0 noexpandtab
|
|
|
|
set shiftwidth=4
|
|
|
|
set backspace=2
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
set encoding=utf-8
|
|
|
|
set autoindent
|
|
|
|
|
|
|
|
" search
|
|
|
|
set incsearch
|
|
|
|
set hlsearch
|
|
|
|
set smartcase
|
|
|
|
|
2020-05-23 17:24:20 +02:00
|
|
|
" REMAPS
|
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" search for visual selection
|
|
|
|
vnoremap // y/<C-R>"<CR>
|
2020-05-23 17:24:20 +02:00
|
|
|
nnoremap H ^
|
|
|
|
|
|
|
|
" ex command
|
|
|
|
cnoremap <C-p> <Up>
|
|
|
|
cnoremap <C-n> <Down>
|
|
|
|
|
|
|
|
" auto expand brackets
|
|
|
|
inoremap (; (<CR>)<C-c>O
|
|
|
|
inoremap (, (<CR>),<C-c>O
|
|
|
|
inoremap {; {<CR>}<C-c>O
|
|
|
|
inoremap {, {<CR>},<C-c>O
|
|
|
|
inoremap [; [<CR>]<C-c>O
|
|
|
|
inoremap [, [<CR>],<C-c>O
|
|
|
|
|
|
|
|
" toggle hybrid mode
|
|
|
|
nnoremap <leader>h :set rnu!<CR>
|
2019-10-24 11:55:49 +02:00
|
|
|
|
|
|
|
" Disable Backup and Swap files
|
|
|
|
set noswapfile
|
|
|
|
set nobackup
|
|
|
|
set nowritebackup
|
|
|
|
|
|
|
|
" setup split
|
|
|
|
set splitbelow
|
|
|
|
set splitright
|
|
|
|
|
|
|
|
" Enable folding
|
|
|
|
set foldmethod=indent
|
|
|
|
set foldlevel=99
|
|
|
|
|
|
|
|
" auto reload .vimrc on write
|
|
|
|
autocmd BufWritePost init.vim source %
|
|
|
|
|
|
|
|
" toggle hybrid number mode
|
|
|
|
:augroup numbertoggle
|
|
|
|
: autocmd!
|
|
|
|
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
|
|
|
|
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
|
|
|
|
:augroup END
|
|
|
|
|
|
|
|
" Delete buffer while keeping window layout (don't close buffer's windows).
|
|
|
|
" Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165
|
|
|
|
if v:version < 700 || exists('loaded_bclose') || &cp
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let loaded_bclose = 1
|
|
|
|
if !exists('bclose_multiple')
|
|
|
|
let bclose_multiple = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Display an error message.
|
|
|
|
function! s:Warn(msg)
|
|
|
|
echohl ErrorMsg
|
|
|
|
echomsg a:msg
|
|
|
|
echohl NONE
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Command ':Bclose' executes ':bd' to delete buffer in current window.
|
|
|
|
" The window will show the alternate buffer (Ctrl-^) if it exists,
|
|
|
|
" or the previous buffer (:bp), or a blank buffer if no previous.
|
|
|
|
" Command ':Bclose!' is the same, but executes ':bd!' (discard changes).
|
|
|
|
" An optional argument can specify which buffer to close (name or number).
|
|
|
|
function! s:Bclose(bang, buffer)
|
|
|
|
if empty(a:buffer)
|
|
|
|
let btarget = bufnr('%')
|
|
|
|
elseif a:buffer =~ '^\d\+$'
|
|
|
|
let btarget = bufnr(str2nr(a:buffer))
|
|
|
|
else
|
|
|
|
let btarget = bufnr(a:buffer)
|
|
|
|
endif
|
|
|
|
if btarget < 0
|
|
|
|
call s:Warn('No matching buffer for '.a:buffer)
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
if empty(a:bang) && getbufvar(btarget, '&modified')
|
|
|
|
call s:Warn('No write since last change for buffer '.btarget.' (use :Bclose!)')
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
" Numbers of windows that view target buffer which we will delete.
|
|
|
|
let wnums = filter(range(1, winnr('$')), 'winbufnr(v:val) == btarget')
|
|
|
|
if !g:bclose_multiple && len(wnums) > 1
|
|
|
|
call s:Warn('Buffer is in multiple windows (use ":let bclose_multiple=1")')
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
let wcurrent = winnr()
|
|
|
|
for w in wnums
|
|
|
|
execute w.'wincmd w'
|
|
|
|
let prevbuf = bufnr('#')
|
|
|
|
if prevbuf > 0 && buflisted(prevbuf) && prevbuf != btarget
|
|
|
|
buffer #
|
|
|
|
else
|
|
|
|
bprevious
|
|
|
|
endif
|
|
|
|
if btarget == bufnr('%')
|
|
|
|
" Numbers of listed buffers which are not the target to be deleted.
|
|
|
|
let blisted = filter(range(1, bufnr('$')), 'buflisted(v:val) && v:val != btarget')
|
|
|
|
" Listed, not target, and not displayed.
|
|
|
|
let bhidden = filter(copy(blisted), 'bufwinnr(v:val) < 0')
|
|
|
|
" Take the first buffer, if any (could be more intelligent).
|
|
|
|
let bjump = (bhidden + blisted + [-1])[0]
|
|
|
|
if bjump > 0
|
|
|
|
execute 'buffer '.bjump
|
|
|
|
else
|
|
|
|
execute 'enew'.a:bang
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
execute 'bdelete'.a:bang.' '.btarget
|
|
|
|
execute wcurrent.'wincmd w'
|
|
|
|
endfunction
|
|
|
|
command! -bang -complete=buffer -nargs=? Bclose call <SID>Bclose(<q-bang>, <q-args>)
|
|
|
|
nnoremap <silent> <Leader>bd :Bclose<CR>
|
|
|
|
|
|
|
|
" PLUGIN SETTINGS
|
2019-10-24 12:43:34 +02:00
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" polyglot setup
|
|
|
|
let g:polyglot_disabled = ["latex"]
|
|
|
|
" nerd tree setup
|
|
|
|
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
|
2020-05-23 17:24:20 +02:00
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
map <leader>e :NERDTreeToggle<CR>
|
|
|
|
|
|
|
|
" AIRLINE SETUP
|
|
|
|
" sections
|
|
|
|
let g:airline_section_y = ""
|
|
|
|
let g:airline_section_z = "%l/%L:%c"
|
|
|
|
let g:airline_section_b = "%{airline#util#wrap(airline#extensions#branch#get_head(),0)}"
|
|
|
|
" other stuff
|
2019-10-24 12:43:34 +02:00
|
|
|
let g:airline_theme='luna'
|
2019-10-24 11:55:49 +02:00
|
|
|
let g:airline_powerline_fonts = 1
|
|
|
|
let g:airline_inactive_collapse=1
|
|
|
|
let g:airline_skip_empty_sections = 1
|
|
|
|
let g:airline#extensions#whitespace#enabled = 0
|
|
|
|
let g:airline#extensions#wordcount#enabled = 0
|
|
|
|
let g:airline#extensions#keymap#enabled = 0
|
|
|
|
set ttimeoutlen=50
|
|
|
|
|
|
|
|
" gitgutter setup
|
|
|
|
let g:gitgutter_sign_added = '∙'
|
|
|
|
let g:gitgutter_sign_modified = '∙'
|
|
|
|
let g:gitgutter_sign_removed = '∙'
|
|
|
|
let g:gitgutter_sign_modified_removed = '∙'
|
|
|
|
augroup VimDiff
|
|
|
|
autocmd!
|
|
|
|
autocmd VimEnter,FilterWritePre * if &diff | GitGutterDisable | endif
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
" fzf setup
|
|
|
|
nmap <C-y> :Buffers<CR>
|
|
|
|
nmap <Leader>f :GFiles<CR>
|
|
|
|
let g:fzf_buffers_jump = 1
|
|
|
|
|
2020-04-16 20:29:05 +02:00
|
|
|
" Vimwiki setup
|
|
|
|
let g:vimwiki_list = [{'path': '~/.wiki/'}]
|
|
|
|
|
2019-10-24 11:55:49 +02:00
|
|
|
" vimtex setup
|
|
|
|
let g:vimtex_compile_progname = 'nvr'
|
|
|
|
|
|
|
|
" colors.lua setup
|
|
|
|
lua require'colorizer'.setup()
|
|
|
|
|
2019-10-26 23:23:13 +02:00
|
|
|
" tmux setup
|
|
|
|
let g:tmuxcomplete#trigger = ''
|
2019-11-26 23:29:59 +01:00
|
|
|
|
2020-04-21 00:02:30 +02:00
|
|
|
" GOYO
|
|
|
|
function! s:goyo_enter()
|
|
|
|
set noshowcmd
|
|
|
|
set scrolloff=999
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:goyo_leave()
|
|
|
|
set showcmd
|
|
|
|
set scrolloff=1
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
autocmd! User GoyoEnter nested call <SID>goyo_enter()
|
|
|
|
autocmd! User GoyoLeave nested call <SID>goyo_leave()
|
|
|
|
|
2020-05-23 17:24:20 +02:00
|
|
|
let g:goyo_linenr = 0
|
|
|
|
|
|
|
|
" Autocompletion
|
|
|
|
if executable('pyls')
|
|
|
|
au User lsp_setup call lsp#register_server({
|
|
|
|
\ 'name': 'pyls',
|
|
|
|
\ 'cmd': {server_info->['pyls']},
|
|
|
|
\ 'whitelist': ['python'],
|
|
|
|
\ })
|
|
|
|
endif
|
|
|
|
|
|
|
|
function! s:on_lsp_buffer_enabled() abort
|
|
|
|
setlocal omnifunc=lsp#complete
|
|
|
|
setlocal signcolumn=yes
|
|
|
|
nmap <buffer> gd <plug>(lsp-definition)
|
|
|
|
nmap <buffer> <f2> <plug>(lsp-rename)
|
|
|
|
" refer to doc to add more commands
|
2019-11-26 23:29:59 +01:00
|
|
|
endfunction
|
|
|
|
|
2020-05-23 17:24:20 +02:00
|
|
|
augroup lsp_install
|
|
|
|
au!
|
|
|
|
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
|
|
|
|
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
|
|
|
|
augroup END
|