|
|
|
@ -1,4 +1,6 @@ |
|
|
|
" Begin Plugin section |
|
|
|
let mapleader ="," |
|
|
|
|
|
|
|
""" Begin Plugin section |
|
|
|
if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) |
|
|
|
echo "Downloading junegunn/vim-plug to manage plugins..." |
|
|
|
silent !mkdir -p ~/.config/nvim/autoload/ |
|
|
|
@ -7,61 +9,113 @@ if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) |
|
|
|
endif |
|
|
|
|
|
|
|
call plug#begin('~/.local/share/nvim/plugged') |
|
|
|
Plug 'lervag/vimtex' , {'for' : 'tex'} " Tex library for autocompletion |
|
|
|
Plug 'donRaphaco/neotex' , {'for': 'tex'} " Asynchronous pdf rendering |
|
|
|
Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} " Filetree |
|
|
|
Plug 'majutsushi/tagbar' " Show tags |
|
|
|
Plug 'airblade/vim-gitgutter' " Git Upgrades |
|
|
|
Plug 'qpkorr/vim-renamer' " Bulk renamer |
|
|
|
Plug 'sirver/ultisnips' " Snippets |
|
|
|
Plug 'uiiaoo/java-syntax.vim' , {'for': 'java'} " Better syntax highlight for java than default |
|
|
|
Plug 'frazrepo/vim-rainbow' " Colorized matching brackets |
|
|
|
Plug 'junegunn/fzf.vim' " Quickly jump files using fzf |
|
|
|
Plug 'ryanoasis/vim-devicons' " Enable Icons for vim |
|
|
|
Plug 'rrethy/vim-hexokinase' , {'do': 'make hexokinase'} " Color Preview |
|
|
|
Plug 'airblade/vim-gitgutter' " git upgrades |
|
|
|
Plug 'alvan/vim-closetag' " auto close HTML tags |
|
|
|
Plug 'donRaphaco/neotex' , {'for': 'tex'} " asynchronous pdf rendering |
|
|
|
Plug 'frazrepo/vim-rainbow' " colorized matching brackets |
|
|
|
Plug 'junegunn/fzf.vim' " quickly jump files using fzf |
|
|
|
Plug 'lervag/vimtex' , {'for' : 'tex'} " tex library for autocompletion |
|
|
|
Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'} " show tags |
|
|
|
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} " autocompletion |
|
|
|
Plug 'qpkorr/vim-renamer' " bulk renamer |
|
|
|
Plug 'raimondi/delimitmate' " automatic closing of brackets |
|
|
|
"Plug 'rakr/vim-one' " adding colorscheme |
|
|
|
Plug 'rrethy/vim-hexokinase' , {'do': 'make hexokinase'} " color Preview |
|
|
|
Plug 'ryanoasis/vim-devicons' " enable icons for vim |
|
|
|
Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} " filetree |
|
|
|
Plug 'sirver/ultisnips' " snippets |
|
|
|
Plug 'tomasiser/vim-code-dark' " adding colorscheme |
|
|
|
"Plug 'blueshirts/darcula' |
|
|
|
Plug 'godlygeek/tabular' " Tabularizing things |
|
|
|
Plug 'plasticboy/vim-markdown' , {'for': 'md'} " Helps for markdown |
|
|
|
Plug 'tpope/vim-surround' " Help for quotes/parantheses |
|
|
|
Plug 'alvan/vim-closetag' " Auto close HTML tags |
|
|
|
Plug 'tpope/vim-fugitive' " git wrapper |
|
|
|
Plug 'tpope/vim-surround' " help for quotes/parantheses |
|
|
|
Plug 'uiiaoo/java-syntax.vim' , {'for': 'java'} " better syntax highlight for java than default |
|
|
|
Plug 'whonore/coqtail' , {'for': 'v'} " coq interactive proof |
|
|
|
call plug#end() |
|
|
|
|
|
|
|
" Colorscheme |
|
|
|
colorscheme codedark |
|
|
|
" alvan/vim-closetag |
|
|
|
let g:closetag_filenames = '*.html,*.xhtml,*.phtml' |
|
|
|
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx' |
|
|
|
let g:closetag_filetypes = 'html,xhtml,phtml' |
|
|
|
let g:closetag_xhtml_filetypes = 'xhtml,jsx' |
|
|
|
let g:closetag_emptyTags_caseSensitive = 1 |
|
|
|
let g:closetag_regions = { |
|
|
|
\ 'typescript.tsx': 'jsxRegion,tsxRegion', |
|
|
|
\ 'javascript.jsx': 'jsxRegion', |
|
|
|
\ } |
|
|
|
let g:closetag_shortcut = '>' |
|
|
|
let g:closetag_close_shortcut = '<leader>>' |
|
|
|
|
|
|
|
" Rainbow |
|
|
|
au FileType java,c,cpp,py,h call rainbow#load() |
|
|
|
|
|
|
|
" You complete me |
|
|
|
let g:ycm_global_ycm_extra_conf = '/home/tiynger/.config/nvim/ycm_extra_conf.py' |
|
|
|
let g:ycm_autoclose_preview_window_after_completion = 1 |
|
|
|
let g:ycm_autoclose_preview_window_after_insertion = 1 |
|
|
|
let g:ycm_semantic_triggers = { |
|
|
|
\ 'tex' : ['{'] |
|
|
|
\} |
|
|
|
if !exists('g:ycm_semantic_triggers') |
|
|
|
let g:ycm_semantic_triggers = {} |
|
|
|
endif |
|
|
|
let g:ycm_semantic_triggers.tex = g:vimtex#re#youcompleteme |
|
|
|
let g:ycm_filepath_blacklist = {'*': 1} |
|
|
|
" donRaphaco/neotex |
|
|
|
let g:neotex_enabled = 2 |
|
|
|
|
|
|
|
" Tagbar |
|
|
|
" frazrepo/vim-rainbow |
|
|
|
au FileType,BufNewFile,BufRead java,c,cpp,py,h call rainbow#load() |
|
|
|
|
|
|
|
" junegunn/fzf.vim |
|
|
|
let $FZF_DEFAULT_COMMAND = 'find . ~ -type f' |
|
|
|
nmap <F4> :FZF<CR> |
|
|
|
|
|
|
|
" majutsushi/tagbar |
|
|
|
map <F3> :TagbarToggle<CR> |
|
|
|
|
|
|
|
" Nerdtree |
|
|
|
map <F2> :NERDTreeToggle<CR> |
|
|
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif |
|
|
|
let g:NERDTreeWinPos = "left" |
|
|
|
" neoclide/coc.nvim |
|
|
|
inoremap <silent><expr> <TAB> |
|
|
|
\ pumvisible() ? "\<C-n>" : |
|
|
|
\ <SID>check_back_space() ? "\<TAB>" : |
|
|
|
\ coc#refresh() |
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" |
|
|
|
|
|
|
|
" Neotex |
|
|
|
let g:neotex_enabled = 2 |
|
|
|
function! s:check_back_space() abort |
|
|
|
let col = col('.') - 1 |
|
|
|
return !col || getline('.')[col - 1] =~# '\s' |
|
|
|
endfunction |
|
|
|
|
|
|
|
let g:coc_global_extensions = [ |
|
|
|
\ 'coc-java', |
|
|
|
\ 'coc-markdownlint', |
|
|
|
\ 'coc-python', |
|
|
|
\ 'coc-sh', |
|
|
|
\ 'coc-vimtex', |
|
|
|
\ ] |
|
|
|
|
|
|
|
if has('nvim') |
|
|
|
inoremap <silent><expr> <c-space> coc#refresh() |
|
|
|
else |
|
|
|
inoremap <silent><expr> <c-@> coc#refresh() |
|
|
|
endif |
|
|
|
|
|
|
|
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() |
|
|
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" |
|
|
|
|
|
|
|
nmap <silent> gd <Plug>(coc-definition) |
|
|
|
nmap <silent> gy <Plug>(coc-type-definition) |
|
|
|
nmap <silent> gi <Plug>(coc-implementation) |
|
|
|
nmap <silent> gr <Plug>(coc-references) |
|
|
|
nnoremap <silent> K :call <SID>show_documentation()<CR> |
|
|
|
|
|
|
|
function! s:show_documentation() |
|
|
|
if (index(['vim','help'], &filetype) >= 0) |
|
|
|
execute 'h '.expand('<cword>') |
|
|
|
elseif (coc#rpc#ready()) |
|
|
|
call CocActionAsync('doHover') |
|
|
|
else |
|
|
|
execute '!' . &keywordprg . " " . expand('<cword>') |
|
|
|
endif |
|
|
|
endfunction |
|
|
|
|
|
|
|
autocmd CursorHold * silent call CocActionAsync('highlight') |
|
|
|
|
|
|
|
nmap <F5> <Plug>(coc-rename) |
|
|
|
|
|
|
|
xmap <leader>f <Plug>(coc-format-selected) |
|
|
|
nmap <leader>f <Plug>(coc-format-selected) |
|
|
|
|
|
|
|
" CoVim |
|
|
|
let CoVim_default_name = "TiynGER" |
|
|
|
let CoVim_default_port = "7000" |
|
|
|
augroup mygroup |
|
|
|
autocmd! |
|
|
|
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') |
|
|
|
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') |
|
|
|
augroup end |
|
|
|
|
|
|
|
" Hexokinase |
|
|
|
" rrethy/vim-hexokinase |
|
|
|
let g:Hexokinase_refreshEvents = ['InsertLeave'] |
|
|
|
let g:Hexokinase_optInPatterns = [ |
|
|
|
\ 'full_hex', |
|
|
|
@ -76,110 +130,179 @@ let g:Hexokinase_optInPatterns = [ |
|
|
|
let g:Hexokinase_highlighters = ['backgroundfull'] |
|
|
|
autocmd VimEnter * HexokinaseTurnOn |
|
|
|
|
|
|
|
" Vim-Mardown |
|
|
|
let g:vim_markdown_folding_disabled=1 |
|
|
|
let g:vim_markdown_no_default_key_mappings=1 |
|
|
|
" scrooloose/nerdtree |
|
|
|
map <F2> :NERDTreeToggle<CR> |
|
|
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif |
|
|
|
let g:NERDTreeWinPos = "left" |
|
|
|
|
|
|
|
" Vim-Closetag |
|
|
|
let g:closetag_filenames = '*.html,*.xhtml,*.phtml' |
|
|
|
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx' |
|
|
|
let g:closetag_filetypes = 'html,xhtml,phtml' |
|
|
|
let g:closetag_xhtml_filetypes = 'xhtml,jsx' |
|
|
|
let g:closetag_emptyTags_caseSensitive = 1 |
|
|
|
let g:closetag_regions = { |
|
|
|
\ 'typescript.tsx': 'jsxRegion,tsxRegion', |
|
|
|
\ 'javascript.jsx': 'jsxRegion', |
|
|
|
\ } |
|
|
|
let g:closetag_shortcut = '>' |
|
|
|
let g:closetag_close_shortcut = '<leader>>' |
|
|
|
" sirver/ultisnips |
|
|
|
let g:UltiSnipsExpandTrigger="<alt-j>" |
|
|
|
|
|
|
|
" End Plugin section |
|
|
|
" tpope/vim-fugitive |
|
|
|
nnoremap <leader>ga :Git add %:p<CR><CR> |
|
|
|
nnoremap <leader>gd :Git diff<CR> |
|
|
|
nnoremap <leader>gc :Gcommit<CR> |
|
|
|
nnoremap <leader>go :Git checkout<Space> |
|
|
|
nnoremap <leader>gh :diffget //3<CR> |
|
|
|
nnoremap <leader>gr :Gread<CR> |
|
|
|
nnoremap <leader>gu :diffget //2<CR> |
|
|
|
nnoremap <leader>gs :G<CR> |
|
|
|
|
|
|
|
let mapleader ="," |
|
|
|
" whonore/coqtail |
|
|
|
function g:CoqtailHighlight() |
|
|
|
hi def CoqtailChecked guifg=#44FF44 |
|
|
|
hi def CoqtailSent guifg=#777777 |
|
|
|
endfunction |
|
|
|
|
|
|
|
""" end plugin section |
|
|
|
|
|
|
|
set go=a |
|
|
|
" Enable mouse for all modes |
|
|
|
|
|
|
|
" enable mouse for all modes |
|
|
|
set mouse=a |
|
|
|
set clipboard+=unnamedplus |
|
|
|
" Enable command completion |
|
|
|
|
|
|
|
" enable command completion |
|
|
|
set wildmode=longest,list,full |
|
|
|
" Setting Tab-length |
|
|
|
|
|
|
|
" setting Tab-length |
|
|
|
set expandtab |
|
|
|
set softtabstop=4 |
|
|
|
set shiftwidth=4 |
|
|
|
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults. |
|
|
|
|
|
|
|
" splits open at the bottom and right, which is non-retarded, unlike vim defaults. |
|
|
|
set splitbelow splitright |
|
|
|
" Disable case sensitive matching |
|
|
|
|
|
|
|
" disable case sensitive matching |
|
|
|
set ignorecase |
|
|
|
" Enable nocompatible mode |
|
|
|
|
|
|
|
" enable nocompatible mode |
|
|
|
set nocompatible |
|
|
|
" Enable Plugins |
|
|
|
|
|
|
|
" enable Plugins |
|
|
|
filetype plugin on |
|
|
|
" Enable syntax highlighting |
|
|
|
|
|
|
|
" enable syntax highlighting |
|
|
|
syntax on |
|
|
|
" Enable true colors |
|
|
|
|
|
|
|
" enable true colors |
|
|
|
set termguicolors |
|
|
|
" Set utf-8 encoding |
|
|
|
|
|
|
|
" set utf-8 encoding |
|
|
|
set encoding=utf-8 |
|
|
|
" Show relative numbers on left side |
|
|
|
|
|
|
|
" show relative numbers on left side |
|
|
|
set number relativenumber |
|
|
|
" Speedup vim with long lines |
|
|
|
|
|
|
|
" speedup vim with long lines |
|
|
|
set ttyfast |
|
|
|
set lazyredraw |
|
|
|
|
|
|
|
" textEdit might fail without hidden |
|
|
|
set hidden |
|
|
|
|
|
|
|
" disable Backupfiles for Lsp |
|
|
|
set nobackup |
|
|
|
set nowritebackup |
|
|
|
|
|
|
|
" dont pass messages to ins-completion-menu |
|
|
|
set shortmess+=c |
|
|
|
|
|
|
|
" always show the signcolumn, otherwise it would shift the text each time |
|
|
|
" diagnostics appear/become resolved. |
|
|
|
if has("patch-8.1.1564") |
|
|
|
" Recently vim can merge signcolumn and number column into one |
|
|
|
set signcolumn=number |
|
|
|
else |
|
|
|
set signcolumn=yes |
|
|
|
endif |
|
|
|
|
|
|
|
" enable persistent undo |
|
|
|
if has('persistent_undo') |
|
|
|
set undofile |
|
|
|
set undodir=$XDG_CACHE_HOME/vim/undo |
|
|
|
endif |
|
|
|
|
|
|
|
" Delete trailing whitespaces on save |
|
|
|
" unmap unwanted commands |
|
|
|
nnoremap <F1> <NOP> |
|
|
|
nnoremap <F9> <NOP> |
|
|
|
nnoremap <F10> <NOP> |
|
|
|
nnoremap <F11> <NOP> |
|
|
|
nnoremap <F12> <NOP> |
|
|
|
|
|
|
|
inoremap <F2> <NOP> |
|
|
|
inoremap <F3> <NOP> |
|
|
|
inoremap <F4> <NOP> |
|
|
|
inoremap <F5> <NOP> |
|
|
|
inoremap <F6> <NOP> |
|
|
|
inoremap <F7> <NOP> |
|
|
|
inoremap <F8> <NOP> |
|
|
|
inoremap <F9> <NOP> |
|
|
|
inoremap <F10> <NOP> |
|
|
|
inoremap <F11> <NOP> |
|
|
|
inoremap <F12> <NOP> |
|
|
|
|
|
|
|
" mapping Dictionaries |
|
|
|
nnoremap <F6> :setlocal spell! spelllang=de_de<CR> |
|
|
|
nnoremap <F7> :setlocal spell! spelllang=en_us<CR> |
|
|
|
|
|
|
|
" compiler for languages |
|
|
|
nnoremap <leader>c :w! \| !compiler <c-r>%<CR> |
|
|
|
|
|
|
|
" open corresponding file (pdf/html/...) |
|
|
|
nnoremap <leader>p :!opout <c-r>%<CR><CR> |
|
|
|
|
|
|
|
" shortcut for split navigation |
|
|
|
nnoremap <C-h> <C-w>h |
|
|
|
nnoremap <C-j> <C-w>j |
|
|
|
nnoremap <C-k> <C-w>k |
|
|
|
nnoremap <C-l> <C-w>l |
|
|
|
|
|
|
|
" save file as sudo on files that require root permission |
|
|
|
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit! |
|
|
|
|
|
|
|
" alias for replacing |
|
|
|
nnoremap <leader>ss :%s//gI<Left><Left><Left> |
|
|
|
|
|
|
|
" delete trailing whitespaces on save |
|
|
|
fun! TrimWhitespace() |
|
|
|
let l:save = winsaveview() |
|
|
|
keeppatterns %s/\s\+$//e |
|
|
|
call winrestview(l:save) |
|
|
|
endfun |
|
|
|
autocmd BufWritePre * :call TrimWhitespace() |
|
|
|
" Disables automatic commenting on newline: |
|
|
|
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o |
|
|
|
" Clean LaTex build files |
|
|
|
autocmd VimLeave *.tex !texclear % |
|
|
|
" Read files correctly |
|
|
|
|
|
|
|
" read files correctly |
|
|
|
autocmd BufRead,BufNewFile *.tex set filetype=tex |
|
|
|
autocmd BufRead,BufNewFile *.html set filetype=html |
|
|
|
autocmd BufRead,BufNewFile *.h set filetype=c |
|
|
|
|
|
|
|
" Mapping Dictionaries |
|
|
|
map <F5> :setlocal spell! spelllang=de_de<CR> |
|
|
|
map <F6> :set spelllang=en_us<CR> |
|
|
|
" Compiler for languages |
|
|
|
map <leader>c :w! \| !compiler <c-r>%<CR> |
|
|
|
" Open corresponding file (pdf/html/...) |
|
|
|
map <leader>p :!opout <c-r>%<CR><CR> |
|
|
|
" Shortcut for split navigation |
|
|
|
map <C-h> <C-w>h |
|
|
|
map <C-j> <C-w>j |
|
|
|
map <C-k> <C-w>k |
|
|
|
map <C-l> <C-w>l |
|
|
|
" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed): |
|
|
|
map <C-p> "+P |
|
|
|
vnoremap <C-c> "+y |
|
|
|
" Save file as sudo on files that require root permission |
|
|
|
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit! |
|
|
|
" Alias for replacing |
|
|
|
nnoremap S :%s//gI<Left><Left><Left> |
|
|
|
|
|
|
|
" Start Formatting section |
|
|
|
|
|
|
|
autocmd FileType java,python,c,tex,latex noremap <F8> gggqG |
|
|
|
|
|
|
|
au FileType python setlocal formatprg=autopep8\ - |
|
|
|
|
|
|
|
au FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google |
|
|
|
" formatting options |
|
|
|
autocmd FileType java setlocal shiftwidth=2 softtabstop=2 |
|
|
|
|
|
|
|
au FileType c setlocal formatprg=astyle\ --mode=c |
|
|
|
" formatting programs |
|
|
|
autocmd FileType c setlocal formatprg=astyle\ --mode=c\ --style=ansi |
|
|
|
autocmd FileType c noremap <F8> gggqG |
|
|
|
autocmd FileType html noremap <F8> :silent %!tidy -q -i --show-errors 0 <CR> |
|
|
|
autocmd FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google |
|
|
|
autocmd FileType java noremap <F8> gggqG |
|
|
|
autocmd FileType markdown noremap <F8> :silent %!prettier --stdin-filepath % <CR> |
|
|
|
autocmd FileType python setlocal formatprg=autopep8\ - |
|
|
|
autocmd FileType python noremap <F8> gggqG |
|
|
|
autocmd FileType tex,latex setlocal formatprg=latexindent\ - |
|
|
|
autocmd FileType tex,latex noremap <F8> gggqG |
|
|
|
|
|
|
|
au FileType tex,latex setlocal formatprg=latexindent\ - |
|
|
|
" cleanup certain files after leaving the editor |
|
|
|
autocmd VimLeave *.tex !texclear % |
|
|
|
autocmd VimLeave *.c !cclear |
|
|
|
|
|
|
|
" End Formatting section |
|
|
|
" highlighting break line |
|
|
|
autocmd BufEnter,FileType c set colorcolumn=80 |
|
|
|
autocmd BufEnter,FileType java set colorcolumn=100 |
|
|
|
autocmd BufEnter,FileType markdown set colorcolumn=80 |
|
|
|
autocmd BufEnter,FileType python set colorcolumn=80 |
|
|
|
|
|
|
|
" colorscheme |
|
|
|
set background=dark |
|
|
|
colorscheme codedark |
|
|
|
highlight colorcolumn guibg=#772222 |