" " noah's ~/.config/vim/vimrc " " basic setup set nocompatible " set vim paths set undodir="~/.config/vim/undo" set viminfo="~/.config/vim/viminfo" set runtimepath+="~/.config/vim" " make :find recursive set path+=** " display all files for tab completion set wildmenu " making me comfortable set nu set tabstop=4 softtabstop=4 set shiftwidth=4 set expandtab set smartindent set smartcase set noswapfile set nobackup set incsearch set spelllang=de_ch,en " getting plugins call plug#begin('~/.cache/vim/plugged') " colorshemes Plug 'morhetz/gruvbox' "Plug 'itchyny/landscape.vim' " nice statusline for vim Plug 'vim-airline/vim-airline' " some git integration Plug 'tpope/vim-fugitive' " preview colours Plug 'ap/vim-css-color' " autocompletion plugins Plug 'neoclide/coc.nvim', {'branch': 'release'} "Plug 'lervag/vimtex' call plug#end() colorscheme gruvbox set background=dark let loaded_matchparen = 1 let mapleader = " " let g:netrw_browse_split = 2 let g:vrfr_rg = 'true' let g:netrw_banner = 0 let g:netrw_winsize = 25 vnoremap J :m '>+1gv=gv vnoremap K :m '<-2gv=gv nnoremap h :wincmd h nnoremap j wincmd j nnoremap k wincmd k nnoremap l wincmd l nnoremap u :UndotreeShow nnoremap pv :wincmd v :Ex :vertical resize 30 nnoremap ps :Rg nnoremap + :vertical resize +5 nnoremap - :vertical resize -5 " general custom commands command D filetype detect """ active to autocompile docs on saving "autocmd BufWritePost *.ms !compile % | fold -w200 "autocmd BufWritePost *.tex !compile % | fold -w200 "" commands for opening and compiling various document types command S silent !vshow '%:p' command C !compile "%" " general compile button map :w:!compile "%"; pkill -HUP mupdf " bibtex extra compiler map :w:!latexmk -pdf "%"; pkill -HUP mupdf map :noh map :set spell! map :w:!glosscompile "%"; pkill -HUP mupdf " set encoding set encoding=utf-8 " automatic python syntax highlighting for .tibasic files autocmd BufNewFile,BufRead *.tibasic set filetype=python autocmd BufNewFile,BufRead *.tib set filetype=python " jumper vnoremap /<++>"_c4l map /<++>"_c4l """ START latex macros " standard macros autocmd FileType tex inoremap ;beg yypkI\begin{A}o0ijI\end{A}0i0i<++>3ki autocmd FileType tex inoremap ;ig \includegraphics[]{<++>}6hi autocmd FileType tex inoremap ;tw width=\textwidth9hi autocmd FileType tex inoremap ;th height=\textheight10hi autocmd FileType tex inoremap ;ni \setlength{\parindent}{0em} " packages autocmd FileType tex inoremap ;ger \usepackage[ngerman]{babel} " text formatting macros autocmd FileType tex inoremap ;bf \textbf{}<++>T{i autocmd FileType tex inoremap ;it \textit{}<++>T{i " beamer macros autocmd FileType tex inoremap ;fr \begin{frame}\frametitle{}<++>\end{frame}kklli " book macros autocmd FileType tex inoremap ;sw \switchcolumn[]<++>4hi " preambule macros autocmd FileType tex inoremap ;up \usepackage{}i autocmd FileType tex inoremap ;hy \hyphenation{}i " apacite style autocmd FileType tex inoremap ;ap \bibliographystyle{apacite}\bibliography{}i """ END latex macros " make background transparent "hi Normal ctermbg=none "hi NonText ctermbg=none " disalbe automatic identation filetype indent off " disable automatic comment autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o " clear a TeX build after exiting vim autocmd VimLeavePre *.tex !texclear "%" autocmd VimLeavePre *.md !texclear "%" autocmd VimLeavePre *.c !rm -rf .ccls-cache autocmd VimLeavePre *.cc !rm -rf .ccls-cache autocmd VimLeavePre *.cpp !rm -rf .ccls-cache autocmd VimLeavePre *.h !rm -rf .ccls-cache autocmd VimLeavePre *.hh !rm -rf .ccls-cache Plug 'kien/rainbow_parentheses.vim' Plug 'vim-python/python-syntax' let g:python_highlight_all = 1 " copy from / to clipboard vnoremap "+y map "+P " use TAB to autocomplete w/ coc inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use `:Format` to format current buffer command! -nargs=0 Format :call CocAction('format') " Add status line support, for integration with other plugin, checkout `:h coc-status` set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " if hidden is not set, TextEdit might fail. set hidden " Better display for messages set cmdheight=2 " You will have bad experience for diagnostic messages when it's default 4000. set updatetime=300 " always show signcolumns set signcolumn=yes " Use to trigger completion. inoremap coc#refresh() " Use `[g` and `]g` to navigate diagnostics nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) " Remap keys for gotos nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) set colorcolumn=80 autocmd FileType plaintex,tex,latex syntax spell toplevel " Automatically wrap at 80 characters for Markdown " autocmd BufRead,BufNewFile *.md setlocal textwidth=80 nmap rn (coc-rename) vmap f (coc-format-selected) nmap f (coc-format-selected) function! MathAndLiquid() "" Define certain regions " Block math. Look for "$$[anything]$$" syn region math start=/\$\$/ end=/\$\$/ " inline math. Look for "$[not $][anything]$" syn match math_block '\$[^$].\{-}\$' " Liquid single line. Look for "{%[anything]%}" syn match liquid '{%.*%}' " Liquid multiline. Look for "{%[anything]%}[anything]{%[anything]%}" syn region highlight_block start='{% highlight .*%}' end='{%.*%}' " Fenced code blocks, used in GitHub Flavored Markdown (GFM) syn region highlight_block start='```' end='```' "" Actually highlight those regions. hi link math Statement hi link liquid Statement hi link highlight_block Function hi link math_block Function endfunction " Call everytime we open a Markdown file autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathAndLiquid() Plug 'vim-pandoc/vim-pandoc-syntax' let g:vim_markdown_math = 1 " Go to tab by number noremap 1 1gt noremap 2 2gt noremap 3 3gt noremap 4 4gt noremap 5 5gt noremap 6 6gt noremap 7 7gt noremap 8 8gt noremap 9 9gt noremap 0 :tablast set noshowmode