2021-11-01 00:20:50 +01:00
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
" Download vim-plug
|
|
|
|
""""""""""""""""""""""""""""""""
|
2021-10-01 20:00:15 +02:00
|
|
|
if has('nvim')
|
|
|
|
if ! filereadable(system('echo -n "$HOME/.config/nvim/autoload/plug.vim"'))
|
|
|
|
silent !mkdir -p $HOME/.config/nvim/autoload/
|
|
|
|
silent !curl --silent "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > $HOME/.config/nvim/autoload/plug.vim
|
|
|
|
autocmd VimEnter * PlugInstall
|
|
|
|
endif
|
2021-04-04 17:35:42 +02:00
|
|
|
endif
|
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
" Default settings nvim
|
|
|
|
""""""""""""""""""""""""""""""""
|
2021-10-17 21:06:19 +02:00
|
|
|
let g:python3_host_prog = expand('/usr/bin/python3')
|
|
|
|
let g:loaded_python_provider = 0
|
|
|
|
let g:python_host_prog = ''
|
2021-09-29 20:17:26 +02:00
|
|
|
set autoindent
|
|
|
|
set noexpandtab
|
2021-04-04 17:35:42 +02:00
|
|
|
set softtabstop=4
|
|
|
|
set tabstop=4
|
2021-04-11 01:33:00 +02:00
|
|
|
set nocompatible
|
|
|
|
set noshowmode
|
2021-10-31 23:57:39 +01:00
|
|
|
set noerrorbells
|
|
|
|
set nowrap
|
|
|
|
set hidden
|
2021-04-11 01:33:00 +02:00
|
|
|
set cmdheight=1
|
|
|
|
set encoding=utf-8
|
|
|
|
set undofile
|
|
|
|
set incsearch
|
|
|
|
set scrolloff=8
|
2021-09-22 14:44:51 +02:00
|
|
|
set t_BE=
|
2021-04-04 17:35:42 +02:00
|
|
|
au BufWritePre * let &bex = '@' . strftime("%F.%H:%M")
|
2021-04-11 01:33:00 +02:00
|
|
|
filetype plugin indent on
|
|
|
|
syntax on
|
2021-04-04 17:35:42 +02:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Disable by default indent line
|
|
|
|
" let g:indentLine_enabled = 0
|
|
|
|
|
|
|
|
" ansible
|
|
|
|
let g:ansible_extra_keywords_highlight = 1
|
|
|
|
|
|
|
|
" line numbers
|
|
|
|
set number
|
|
|
|
set ruler
|
|
|
|
set title
|
|
|
|
|
|
|
|
" indent
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
set shiftwidth=4
|
|
|
|
set list listchars=nbsp:¬,tab:»·,trail:·,extends:>
|
|
|
|
|
|
|
|
" editing
|
|
|
|
runtime! macros/matchit.vim
|
|
|
|
|
|
|
|
" visual feedback
|
|
|
|
set laststatus=2
|
|
|
|
set showmode
|
|
|
|
set showcmd
|
|
|
|
|
|
|
|
" off mouse
|
|
|
|
set mouse-=a
|
|
|
|
|
|
|
|
" disable pcspkr beep
|
|
|
|
set visualbell
|
|
|
|
set t_vb=
|
|
|
|
|
|
|
|
" searching
|
|
|
|
set smartcase
|
|
|
|
set ic
|
|
|
|
|
|
|
|
" cursor
|
|
|
|
let &t_SI = "\<esc>[6 q"
|
|
|
|
let &t_EI = "\<esc>[2 q"
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
" Plugins
|
|
|
|
""""""""""""""""""""""""""""""""
|
2021-04-04 17:35:42 +02:00
|
|
|
call plug#begin('~/.config/nvim/plugged')
|
2021-04-06 12:18:53 +02:00
|
|
|
" Markdown
|
|
|
|
Plug 'tpope/vim-markdown'
|
|
|
|
|
|
|
|
" Nerd Tree
|
|
|
|
Plug 'preservim/nerdtree'
|
2021-05-24 10:32:14 +02:00
|
|
|
Plug 'ryanoasis/vim-devicons'
|
2021-04-06 12:18:53 +02:00
|
|
|
Plug 'nmante/vim-latex-live-preview'
|
|
|
|
|
|
|
|
" Goyo plugin for writing mutt mail
|
|
|
|
Plug 'junegunn/goyo.vim'
|
|
|
|
|
2021-10-30 23:48:37 +02:00
|
|
|
" Themes
|
2021-09-22 14:44:51 +02:00
|
|
|
Plug 'gruvbox-community/gruvbox', { 'as': 'gruvbox'}
|
2021-04-06 12:18:53 +02:00
|
|
|
|
|
|
|
" Fzf plugin
|
2021-10-30 10:02:01 +02:00
|
|
|
Plug 'junegunn/fzf.vim'
|
|
|
|
Plug 'junegunn/fzf'
|
2021-10-24 15:48:54 +02:00
|
|
|
|
2021-04-06 12:18:53 +02:00
|
|
|
" CSS
|
|
|
|
Plug 'ap/vim-css-color'
|
|
|
|
|
|
|
|
" coc
|
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
|
2021-09-12 19:41:57 +02:00
|
|
|
" PyRight
|
2021-05-18 11:59:01 +02:00
|
|
|
Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh' }
|
2021-04-06 12:18:53 +02:00
|
|
|
|
2021-09-12 19:41:57 +02:00
|
|
|
" Ansible yaml
|
2021-08-13 16:54:13 +02:00
|
|
|
Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh' }
|
2021-10-30 22:45:48 +02:00
|
|
|
Plug 'Yggdroot/indentLine'
|
2021-04-06 12:18:53 +02:00
|
|
|
|
2021-07-19 07:59:42 +02:00
|
|
|
" Multiple cursors
|
|
|
|
Plug 'terryma/vim-multiple-cursors'
|
|
|
|
|
2021-04-11 01:33:00 +02:00
|
|
|
" Enable gentoo-syntax in vim
|
|
|
|
Plug 'gentoo/gentoo-syntax'
|
2021-04-06 12:18:53 +02:00
|
|
|
Plug 'tpope/vim-commentary'
|
|
|
|
Plug 'tpope/vim-surround'
|
2021-09-22 14:44:51 +02:00
|
|
|
Plug 'junegunn/vim-easy-align'
|
2021-04-04 17:35:42 +02:00
|
|
|
call plug#end()
|
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Coc
|
2021-09-12 19:41:57 +02:00
|
|
|
let g:coc_global_extensions = ['coc-solargraph', 'coc-go', 'coc-yaml', 'coc-pyright', 'coc-json' , 'coc-markdownlint' , 'coc-sh', 'coc-prettier', 'coc-diagnostic', 'coc-perl']
|
|
|
|
|
2021-10-30 23:18:43 +02:00
|
|
|
inoremap <silent><expr> <Nul> coc#refresh()
|
|
|
|
|
2021-10-24 15:47:37 +02:00
|
|
|
function! s:check_back_space() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
endfunction
|
2021-10-24 15:47:54 +02:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Enable show hidden in NerdTree
|
|
|
|
let NERDTreeShowHidden=1
|
2021-10-24 15:47:37 +02:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" latex
|
|
|
|
let g:tex_flavor = "latex"
|
2021-10-24 15:48:14 +02:00
|
|
|
|
2021-10-30 10:02:29 +02:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
" Theme
|
|
|
|
""""""""""""""""""""""""""""""""
|
2021-11-14 01:03:33 +01:00
|
|
|
"colorscheme gruvbox
|
|
|
|
colorscheme default
|
2021-11-01 00:20:50 +01:00
|
|
|
let g:gruvbox_invert_selection='0'
|
|
|
|
let g:gruvbox_contrast_dark = 'hard'
|
|
|
|
set background=dark
|
|
|
|
"hi Normal ctermbg=NONE
|
|
|
|
hi Pmenu ctermfg=NONE ctermbg=236 cterm=NONE guifg=NONE guibg=#64666d gui=NONE
|
|
|
|
hi PmenuSel ctermfg=NONE ctermbg=246 cterm=NONE guifg=NONE guibg=#204a87 gui=NONE
|
|
|
|
hi CursorLine cterm=NONE term=NONE ctermbg=NONE guibg=NONE
|
|
|
|
hi CursorLine ctermbg=235
|
|
|
|
hi DiffAdd cterm=BOLD ctermfg=NONE ctermbg=22
|
|
|
|
hi DiffDelete cterm=BOLD ctermfg=NONE ctermbg=52
|
|
|
|
hi DiffChange cterm=BOLD ctermfg=NONE ctermbg=23
|
|
|
|
hi DiffText cterm=BOLD ctermfg=NONE ctermbg=23
|
2021-10-31 22:26:14 +01:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" columne
|
|
|
|
set textwidth=80
|
|
|
|
set colorcolumn=80
|
|
|
|
" highlight ColorColumn ctermbg=235
|
|
|
|
highlight ColorColumn ctermbg=236
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
" Status Line
|
|
|
|
""""""""""""""""""""""""""""""""
|
2021-04-04 17:35:42 +02:00
|
|
|
set statusline=
|
|
|
|
set statusline+=%#IncSearch#
|
|
|
|
set statusline+=\ %y
|
2021-06-15 10:52:17 +02:00
|
|
|
set statusline+=\ %m
|
2021-04-04 17:35:42 +02:00
|
|
|
set statusline+=\ %r
|
|
|
|
set statusline+=%#CursorLineNr#
|
|
|
|
set statusline+=\ %F
|
|
|
|
set statusline+=%= "Right side settings
|
|
|
|
set statusline+=%#Search#
|
|
|
|
set statusline+=\ %l/%L
|
|
|
|
set statusline+=\ [%c]
|
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
" Keyboard shortcuts
|
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
let mapleader = "\<Space>"
|
2021-11-01 10:42:47 +01:00
|
|
|
nmap <leader>a :CocAction<CR>
|
2021-11-01 10:42:41 +01:00
|
|
|
nmap <leader>2 :w!<cr>
|
2021-08-13 16:54:13 +02:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Go to definition
|
|
|
|
nmap <leader>gd <Plug>(coc-definition)
|
|
|
|
nmap <leader>gy <Plug>(coc-type-definition)
|
|
|
|
nmap <leader>gi <Plug>(coc-implementation)
|
|
|
|
nmap <leader>gr <Plug>(coc-references)
|
|
|
|
nmap <leader>rr <Plug>(coc-rename)
|
|
|
|
nmap <silent> <leader>gp <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> <leader>gn <Plug>(coc-diagnostic-next)
|
|
|
|
nnoremap <leader>cr :CocRestart
|
|
|
|
xmap <leader>c <Plug>Commentary
|
|
|
|
nmap <leader>c <Plug>Commentary
|
|
|
|
omap <leader>c <Plug>Commentary
|
|
|
|
nmap <leader>cc <Plug>CommentaryLine
|
2021-04-11 01:33:00 +02:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Better tab
|
|
|
|
vnoremap <Tab> >
|
|
|
|
vnoremap <S-Tab> <
|
|
|
|
|
|
|
|
" FZF
|
2021-10-30 10:02:01 +02:00
|
|
|
nmap <Leader>e :Buffers<CR>
|
|
|
|
nmap <Leader>q :Rg<CR>
|
|
|
|
nmap <Leader>w :Files<CR>
|
2021-10-24 15:48:54 +02:00
|
|
|
|
2021-04-12 00:16:32 +02:00
|
|
|
" Resize window
|
2021-08-08 17:40:14 +02:00
|
|
|
nnoremap <C-L> :vertical resize +5<CR>
|
|
|
|
nnoremap <C-H> :vertical resize -5<CR>
|
|
|
|
nnoremap <C-J> :res +5<CR>
|
|
|
|
nnoremap <C-K> :res -5<CR>
|
2021-04-12 00:16:32 +02:00
|
|
|
|
|
|
|
" Split window
|
|
|
|
nnoremap _ :vsp <CR>
|
|
|
|
nnoremap - :split <CR>
|
|
|
|
|
|
|
|
" Reload file
|
|
|
|
nnoremap <F5> :edit <CR>
|
|
|
|
nnoremap <Leader><F5> :edit! <CR>
|
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
2021-04-04 17:35:42 +02:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Tab in the coc to help select right autocomplete
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
|
|
\ coc#refresh()
|
2021-04-04 17:35:42 +02:00
|
|
|
|
2021-04-05 00:20:37 +02:00
|
|
|
"" Moving line up or down using alt
|
|
|
|
nnoremap <A-Up> :m-2<CR>
|
|
|
|
nnoremap <A-Down> :m+<CR>
|
|
|
|
inoremap <A-Up> <Esc>:m-2<CR>
|
|
|
|
inoremap <A-Down> <Esc>:m+<CR>
|
2021-04-05 22:48:00 +02:00
|
|
|
vnoremap <A-Down> :m '>+1<CR>gv=gv
|
|
|
|
vnoremap <A-Up> :m '<-2<CR>gv=gv
|
2021-04-05 00:20:37 +02:00
|
|
|
|
2021-09-07 10:58:06 +02:00
|
|
|
nnoremap Ż :m-2<CR>
|
|
|
|
nnoremap ∆ :m+<CR>
|
|
|
|
vnoremap ∆ :m '>+1<CR>gv=gv
|
|
|
|
vnoremap Ż :m '<-2<CR>gv=gv
|
|
|
|
|
2021-07-19 07:59:42 +02:00
|
|
|
nnoremap <A-k> :m-2<CR>
|
|
|
|
nnoremap <A-j> :m+<CR>
|
|
|
|
inoremap <A-k> <Esc>:m-2<CR>
|
|
|
|
inoremap <A-j> <Esc>:m+<CR>
|
|
|
|
vnoremap <A-j> :m '>+1<CR>gv=gv
|
|
|
|
vnoremap <A-k> :m '<-2<CR>gv=gv
|
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Better replace
|
2021-11-14 01:03:49 +01:00
|
|
|
nnoremap s :%s//g<Left><Left>
|
|
|
|
vnoremap s :s//g<Left><Left>
|
2021-04-04 17:35:42 +02:00
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Better adding into begging and ending line
|
|
|
|
vnoremap F <C-v>$A
|
|
|
|
vnoremap f <C-v>0I
|
|
|
|
|
|
|
|
" Better management of tabs
|
2021-11-01 10:42:26 +01:00
|
|
|
nnoremap <Leader>7 :tabprevious<CR>
|
|
|
|
nnoremap <Leader>8 :tabnext<CR>
|
2021-04-06 11:08:04 +02:00
|
|
|
|
2021-11-01 10:42:34 +01:00
|
|
|
" Better moving
|
|
|
|
nnoremap J }
|
|
|
|
nnoremap K {
|
|
|
|
|
2021-10-05 10:08:49 +02:00
|
|
|
" Copy into system
|
|
|
|
noremap <Leader>y "*y
|
|
|
|
noremap <Leader>p "*p
|
|
|
|
|
2021-09-22 14:44:51 +02:00
|
|
|
" Code
|
|
|
|
map <Leader><Tab> Vgaip= <CR>
|
2021-11-01 00:20:50 +01:00
|
|
|
|
|
|
|
" Multiple cursors
|
|
|
|
let g:multi_cursor_start_word_key = '<C-n>'
|
|
|
|
let g:multi_cursor_select_all_word_key = '<A-n>'
|
|
|
|
let g:multi_cursor_start_key = 'g<C-n>'
|
|
|
|
let g:multi_cursor_select_all_key = 'g<A-n>'
|
|
|
|
let g:multi_cursor_next_key = '<C-n>'
|
|
|
|
let g:multi_cursor_prev_key = '<C-p>'
|
|
|
|
let g:multi_cursor_skip_key = '<C-x>'
|
|
|
|
let g:multi_cursor_quit_key = '<Esc>'
|
|
|
|
|
|
|
|
" Others
|
|
|
|
nnoremap ee :!mupdf $(echo % \| sed 's/tex$/pdf/') & disown<CR><CR>
|
|
|
|
map <C-d> :NERDTreeToggle<CR>
|
|
|
|
nnoremap <silent> <C-t> :tabnew <CR>
|
|
|
|
nnoremap <F11> :Goyo <CR>
|
|
|
|
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
|
|
|
|
map <F3> :setlocal spell! spelllang=en_gb<CR>
|
|
|
|
map <F4> :setlocal spell! spelllang=pl<CR>
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
" Files
|
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
|
|
|
|
" Ansible
|
|
|
|
au BufRead,BufNewFile *.yml set filetype=yaml.ansible
|
2021-05-19 00:22:23 +02:00
|
|
|
|
2021-10-24 08:33:51 +02:00
|
|
|
" Python
|
|
|
|
autocmd BufRead,BufNewFile *.py set textwidth=0
|
|
|
|
autocmd BufRead,BufNewFile *.py set fo-=t
|
|
|
|
|
2021-11-14 01:04:03 +01:00
|
|
|
" Newsboat
|
|
|
|
autocmd BufRead,BufNewFile urls set textwidth=0
|
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Latex
|
2021-04-04 17:35:42 +02:00
|
|
|
autocmd BufWritePost *.tex silent! execute "!pdflatex --shell-escape -synctex=1 -interaction=nonstopmode % > /dev/null " | redraw!
|
|
|
|
autocmd BufWritePost *.tex silent! execute "!latexmk -pdf -silent % > /dev/null" | redraw!
|
|
|
|
autocmd BufWritePost *.tex silent! execute "!sudo rm -rf *.fls *.ilg *.nav *.snm *.toc *.idx *.lof *.lot *.synctex.gz *.aux *.fdb_latexmk *.fls *.log *.out > /dev/null" | redraw!
|
|
|
|
autocmd BufWritePost *.tex silent! execute "!sudo pkill -HUP mupdf > /dev/null" | redraw!
|
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Mutt
|
2021-04-04 17:35:42 +02:00
|
|
|
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
|
|
|
|
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo
|
|
|
|
autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR>
|
|
|
|
autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q!<CR>
|
|
|
|
|
2021-11-01 00:20:50 +01:00
|
|
|
" Yaml
|
|
|
|
autocmd BufRead,BufNewFile *.yaml let g:indentLine_enabled = 1
|
|
|
|
autocmd BufRead,BufNewFile *.yaml let g:indentLine_char = '⦙'
|
|
|
|
|
|
|
|
" Conf
|
|
|
|
au BufNewFile,BufRead *.conf setfiletype conf
|
|
|
|
|
2021-04-04 17:35:42 +02:00
|
|
|
" Automatically deletes all trailing whitespace and newlines at end of file on save.
|
|
|
|
autocmd BufWritePre * %s/\s\+$//e
|
|
|
|
autocmd BufWritepre * %s/\n\+\%$//e
|
2021-11-01 00:20:50 +01:00
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
" FZF
|
|
|
|
""""""""""""""""""""""""""""""""
|
|
|
|
let $FZF_DEFAULT_COMMAND = 'find . -type f -not -path "*/\.git/*" -not -path "*/\.local/share/nvim/*" -not -path "./Library/*" '
|
|
|
|
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --color "always" '.shellescape(<q-args>), 1, <bang>0)
|
|
|
|
command! -bang -nargs=* FindCurrentWord call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --color "always" '.shellescape(expand('<cword>')), 1, <bang>0)
|
|
|
|
set grepprg=rg\ --vimgrep
|