diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index b4d40e4..82b9b73 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,148 +1,5 @@ let mapleader ="," -" unmap unwanted commands -nnoremap -nnoremap -nnoremap -nnoremap -nnoremap - -inoremap -inoremap -inoremap -inoremap -inoremap -inoremap -inoremap -inoremap -inoremap -inoremap -inoremap - -set go=a - -" enable mouse for all modes -set mouse=a -set clipboard+=unnamedplus - -" enable command completion -set wildmode=longest,list,full - -" 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. -set splitbelow splitright - -" disable case sensitive matching -set ignorecase - -" enable nocompatible mode -set nocompatible - -" enable Plugins -filetype plugin on - -" enable syntax highlighting -syntax on - -" enable true colors -set termguicolors - -" set utf-8 encoding -set encoding=utf-8 - -" show relative numbers on left side -set number relativenumber - -" 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 -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 - -" mapping Dictionaries -nmap :setlocal spell! spelllang=de_de -nmap :set spelllang=en_us - -" compiler for languages -map c :w! \| !compiler % - -" open corresponding file (pdf/html/...) -map p :!opout % - -" shortcut for split navigation -map h -map j -map k -map l - -" copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed): -map "+P -vnoremap "+y - -" save file as sudo on files that require root permission -cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! - -" alias for replacing -nnoremap ss :%s//gI - -" read files correctly -autocmd BufRead,BufNewFile *.tex set filetype=tex -autocmd BufRead,BufNewFile *.h set filetype=c - -" formatting -au FileType c setlocal formatprg=astyle\ --mode=c -au FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google -au FileType java setlocal shiftwidth=2 softtabstop=2 -au FileType markdown noremap :silent %!prettier --stdin-filepath % -au FileType python setlocal formatprg=autopep8\ - -au FileType tex,latex setlocal formatprg=latexindent\ - -au FileType c,java,python,tex,latex noremap gggqG - - -" cleanup certain files after leaving the editor -autocmd VimLeave *.tex !texclear % -autocmd VimLeave *.c !cclear - - """ Begin Plugin section if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) echo "Downloading junegunn/vim-plug to manage plugins..." @@ -290,13 +147,151 @@ nnoremap gr :Gread nnoremap gu :diffget //2 nnoremap gs :G -" tomasiser/vim-code-dark -colorscheme codedark - " whonore/coqtail function g:CoqtailHighlight() - hi def CoqtailChecked ctermfg=2 - hi def CoqtailSent ctermfg=2 + hi def CoqtailChecked guifg=#44FF44 + hi def CoqtailSent guifg=#777777 endfunction """ end plugin section + +" colorscheme +colorscheme codedark +highlight colorcolumn guibg=#FF4444 + +set go=a + +" enable mouse for all modes +set mouse=a +set clipboard+=unnamedplus + +" enable command completion +set wildmode=longest,list,full + +" 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. +set splitbelow splitright + +" disable case sensitive matching +set ignorecase + +" enable nocompatible mode +set nocompatible + +" enable Plugins +filetype plugin on + +" enable syntax highlighting +syntax on + +" enable true colors +set termguicolors + +" set utf-8 encoding +set encoding=utf-8 + +" show relative numbers on left side +set number relativenumber + +" 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 + +" unmap unwanted commands +nnoremap +nnoremap +nnoremap +nnoremap +nnoremap + +inoremap +inoremap +inoremap +inoremap +inoremap +inoremap +inoremap +inoremap +inoremap +inoremap +inoremap + +" mapping Dictionaries +nnoremap :setlocal spell! spelllang=de_de +nnoremap :setlocal spell! spelllang=en_us + +" compiler for languages +nnoremap c :w! \| !compiler % + +" open corresponding file (pdf/html/...) +nnoremap p :!opout % + +" shortcut for split navigation +nnoremap h +nnoremap j +nnoremap k +nnoremap l + +" save file as sudo on files that require root permission +cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! + +" alias for replacing +nnoremap ss :%s//gI + +" delete trailing whitespaces on save +fun! TrimWhitespace() + let l:save = winsaveview() + keeppatterns %s/\s\+$//e + call winrestview(l:save) +endfun +autocmd BufWritePre * :call TrimWhitespace() + +" read files correctly +autocmd BufRead,BufNewFile *.tex set filetype=tex +autocmd BufRead,BufNewFile *.h set filetype=c + +" formatting +autocmd FileType c setlocal formatprg=astyle\ --mode=c +autocmd FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google +autocmd FileType java setlocal shiftwidth=2 softtabstop=2 +autocmd FileType markdown noremap :silent %!prettier --stdin-filepath % +autocmd FileType python setlocal formatprg=autopep8\ - +autocmd FileType tex,latex setlocal formatprg=latexindent\ - +autocmd FileType c,java,python,tex,latex noremap gggqG + + +" cleanup certain files after leaving the editor +autocmd VimLeave *.tex !texclear % +autocmd VimLeave *.c !cclear + +" highlighting break line +autocmd BufEnter,FileType markdown set colorcolumn=80