2021-04-04 17:35:42 +02:00
|
|
|
" settings
|
|
|
|
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-11 01:33:00 +02:00
|
|
|
let mapleader = " "
|
|
|
|
let g:python3_host_prog = expand('/usr/src/python')
|
2021-04-04 17:35:42 +02:00
|
|
|
set laststatus=2
|
|
|
|
set shiftwidth=4
|
|
|
|
set softtabstop=4
|
|
|
|
set tabstop=4
|
2021-04-11 01:33:00 +02:00
|
|
|
set nocompatible
|
|
|
|
set nohlsearch
|
|
|
|
set incsearch
|
|
|
|
set noshowmode
|
|
|
|
set cmdheight=1
|
|
|
|
set encoding=utf-8
|
|
|
|
set guicursor=
|
|
|
|
set undofile
|
|
|
|
set incsearch
|
|
|
|
set scrolloff=8
|
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
|
|
|
|
|
|
|
" plugins
|
|
|
|
call plug#begin('~/.config/nvim/plugged')
|
2021-04-06 12:18:53 +02:00
|
|
|
" Markdown
|
|
|
|
Plug 'tpope/vim-markdown'
|
|
|
|
|
|
|
|
" Nerd Tree
|
|
|
|
Plug 'preservim/nerdtree'
|
|
|
|
Plug 'nmante/vim-latex-live-preview'
|
|
|
|
|
|
|
|
" Goyo plugin for writing mutt mail
|
|
|
|
Plug 'junegunn/goyo.vim'
|
|
|
|
|
|
|
|
" Theme dracula and zenburn
|
|
|
|
Plug 'dracula/vim', { 'as': 'dracula'}
|
|
|
|
Plug 'jnurmine/Zenburn', { 'as': 'zenburn'}
|
|
|
|
|
|
|
|
" Fzf plugin
|
|
|
|
Plug 'junegunn/fzf.vim'
|
|
|
|
Plug 'junegunn/fzf'
|
|
|
|
|
|
|
|
" CSS
|
|
|
|
Plug 'ap/vim-css-color'
|
|
|
|
|
|
|
|
" coc
|
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
|
|
|
|
" coc for ruby
|
|
|
|
Plug 'neoclide/coc-solargraph', {'do': 'gem install solargraph'}
|
|
|
|
|
|
|
|
" coc for python
|
2021-04-07 13:33:11 +02:00
|
|
|
Plug 'fannheyward/coc-pyright', {'do': 'yarn install --frozen-lockfile; npm i -D npx-run; pip install --user jedi; pip install --user black'}
|
2021-04-06 12:18:53 +02:00
|
|
|
|
|
|
|
" coc for yaml
|
|
|
|
Plug 'neoclide/coc-yaml', {'do': 'yarn install --frozen-lockfile'}
|
|
|
|
|
|
|
|
" coc for json
|
|
|
|
Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
|
|
|
|
|
|
|
|
" coc for markdownlint
|
|
|
|
Plug 'fannheyward/coc-markdownlint', {'do': 'yarn install --frozen-lockfile; npm i -D markdownlint --save-dev'}
|
|
|
|
|
|
|
|
" coc for bash
|
2021-04-14 13:15:05 +02:00
|
|
|
Plug 'josa42/coc-sh', {'do': 'yarn install --frozen-lockfile; npm i -D coc-sh; npm i -D bash-language-server'}
|
2021-04-06 12:18:53 +02:00
|
|
|
|
|
|
|
" coc for prettier
|
|
|
|
Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile'}
|
|
|
|
|
2021-04-14 13:15:05 +02:00
|
|
|
" coc-diagnostic
|
|
|
|
Plug 'iamcco/coc-diagnostic'
|
|
|
|
|
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-04-04 17:35:42 +02:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" Status-line
|
|
|
|
set statusline=
|
|
|
|
set statusline+=%#IncSearch#
|
|
|
|
set statusline+=\ %y
|
|
|
|
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-04-05 00:20:37 +02:00
|
|
|
" fzf
|
2021-04-06 09:25:31 +02:00
|
|
|
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
|
2021-04-11 01:33:00 +02:00
|
|
|
nmap <Leader>a :Buffers<CR>
|
|
|
|
nmap <Leader>s :Rg<CR>
|
|
|
|
nmap <Leader>d :Files<CR>
|
|
|
|
|
2021-04-12 00:16:32 +02:00
|
|
|
" Resize window
|
|
|
|
nnoremap L :vertical resize +5<CR>
|
|
|
|
nnoremap H :vertical resize -5<CR>
|
|
|
|
nnoremap J :res +5<CR>
|
|
|
|
nnoremap K :res -5<CR>
|
|
|
|
|
|
|
|
" Split window
|
|
|
|
nnoremap _ :vsp <CR>
|
|
|
|
nnoremap - :split <CR>
|
|
|
|
|
|
|
|
" Reload file
|
|
|
|
nnoremap <F5> :edit <CR>
|
|
|
|
nnoremap <Leader><F5> :edit! <CR>
|
|
|
|
|
|
|
|
" Copy using <Leader> anc c
|
|
|
|
nnoremap <Leader>c :w !xclip<CR><CR>
|
|
|
|
vnoremap <Leader>c "*y
|
2021-04-05 00:20:37 +02:00
|
|
|
|
2021-04-04 17:35:42 +02:00
|
|
|
" livepreviewer
|
|
|
|
let g:livepreview_previewer = 'mupdf'
|
|
|
|
|
|
|
|
" markdown preview
|
|
|
|
let g:mkdp_browser = '/home/yorune/.local/bin/browser-x'
|
|
|
|
let g:mkdp_echo_preview_url = 1
|
2021-04-05 00:20:37 +02:00
|
|
|
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
|
|
|
|
let g:markdown_minlines = 1
|
|
|
|
autocmd FileType markdown set foldexpr=NestedMarkdownFolds()
|
2021-04-04 17:35:42 +02:00
|
|
|
|
2021-04-05 22:48:00 +02:00
|
|
|
au BufNewFile,BufRead *.conf setfiletype conf
|
|
|
|
|
2021-04-04 17:35:42 +02:00
|
|
|
" line numbers
|
|
|
|
set number
|
|
|
|
set ruler
|
|
|
|
set title
|
|
|
|
|
|
|
|
" indent
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
set shiftwidth=4
|
|
|
|
set expandtab
|
2021-04-06 11:12:20 +02:00
|
|
|
set list listchars=nbsp:¬,tab:»·,trail:·,extends:>
|
2021-04-04 17:35:42 +02:00
|
|
|
|
|
|
|
" editing
|
|
|
|
runtime! macros/matchit.vim
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
|
|
|
|
" 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"
|
|
|
|
|
|
|
|
" colors
|
|
|
|
hi Pmenu ctermfg=NONE ctermbg=236 cterm=NONE guifg=NONE guibg=#64666d gui=NONE
|
|
|
|
hi PmenuSel ctermfg=NONE ctermbg=24 cterm=NONE guifg=NONE guibg=#204a87 gui=NONE
|
|
|
|
set bg=dark
|
2021-04-12 00:16:32 +02:00
|
|
|
"hi Normal ctermbg=NONE
|
2021-04-04 17:35:42 +02:00
|
|
|
hi CursorLine cterm=NONE term=NONE ctermbg=NONE guibg=NONE
|
|
|
|
hi CursorLine ctermbg=235
|
2021-04-05 00:29:43 +02:00
|
|
|
colorscheme zenburn
|
2021-04-04 17:35:42 +02:00
|
|
|
|
|
|
|
" columne
|
|
|
|
set textwidth=80
|
|
|
|
set colorcolumn=-3
|
|
|
|
highlight ColorColumn ctermbg=235
|
|
|
|
|
|
|
|
" map
|
|
|
|
nnoremap S :%s//g<Left><Left>
|
|
|
|
nnoremap ee :!mupdf $(echo % \| sed 's/tex$/pdf/') & disown<CR><CR>
|
|
|
|
map <C-n> :NERDTreeToggle<CR>
|
|
|
|
nnoremap <silent> <C-t> :tabnew <CR>
|
|
|
|
nnoremap <F11> :Goyo <CR>
|
|
|
|
nnoremap <F7> :tabprevious<CR>
|
|
|
|
nnoremap <F8> :tabnext<CR>
|
|
|
|
|
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-04-04 17:35:42 +02:00
|
|
|
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
|
|
|
|
|
2021-04-12 00:16:32 +02:00
|
|
|
map <F3> :setlocal spell! spelllang=en_gb<CR>
|
|
|
|
map <F4> :setlocal spell! spelllang=pl<CR>
|
2021-04-06 11:08:04 +02:00
|
|
|
|
2021-04-04 17:35:42 +02:00
|
|
|
" latex
|
|
|
|
let g:tex_flavor = "latex"
|
|
|
|
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!
|
|
|
|
|
|
|
|
" mutt
|
|
|
|
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>
|
|
|
|
|
|
|
|
" Automatically deletes all trailing whitespace and newlines at end of file on save.
|
|
|
|
autocmd BufWritePre * %s/\s\+$//e
|
|
|
|
autocmd BufWritepre * %s/\n\+\%$//e
|