" set the runtime path to include Vundle and initialize call plug#begin('~/.config/nvim/plugged') Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'majutsushi/tagbar' Plug 'ludovicchabant/vim-gutentags' Plug 'scrooloose/nerdtree' Plug 'Xuyuanp/nerdtree-git-plugin' Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' Plug 'whiteinge/diffconflicts' Plug 'mhinz/vim-startify' Plug 'altercation/vim-colors-solarized' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'suan/vim-instant-markdown' Plug 'tpope/vim-markdown' Plug 'nvie/vim-flake8' Plug 'SirVer/ultisnips' Plug 'octol/vim-cpp-enhanced-highlight' Plug 'junegunn/goyo.vim' Plug 'junegunn/limelight.vim' Plug 'lervag/vimtex' Plug 'ap/vim-css-color' Plug 'mattn/emmet-vim' Plug 'tpope/vim-commentary' Plug 'pangloss/vim-javascript', { 'for': 'javacript' } Plug 'tpope/vim-unimpaired' Plug 'tpope/vim-surround' Plug 'christoomey/vim-tmux-navigator' Plug 'roxma/vim-tmux-clipboard' Plug 'Chiel92/vim-autoformat' Plug 'keith/swift.vim' Plug 'snakemake/snakemake', {'rtp': 'misc/vim/'} Plug 'junegunn/vim-easy-align' Plug 'glench/vim-jinja2-syntax' Plug 'fatih/vim-go' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' " All of your Plugins must be added before the following line call plug#end() " required " " U S E R S E T U P " " Recursive file search set path+=** " Ignore some stuff esp. for ctrlP set wildignore+=*/node_modules/*,*/build*/*,*/InstallArea/* " Make watchdogs possible set backupcopy=yes " jump between split lines map j gj map k gk nnoremap :TmuxNavigateLeft "map mapleader / to (german layout) let mapleader = "," " execute current file nnoremap e :!'%:p' " Run `make` in current directory nnoremap m :!make " open build/*.pdf nnoremap o :!open build/*.pdf " open Nerdtree with CTRL+n map :NERDTreeToggle " open Tagbar with CTRL+m map :TagbarToggle " toggle background with ,i nnoremap i :let &background = (&background == "dark" ? "light" : "dark") " Open fzf file list nnoremap (expand('%') =~ 'NERD_tree' ? "\\" : '').":Files\" nnoremap b :Buffers nnoremap t :Tags " :w for :W command W w command Wq wq command Q q command Qa qa command WQ wq " color scheme colo solarized set ai " Set auto inline on set number " Show line numbers syntax on " Set syntax highlighting on set tabstop=4 " width of tab " should be redundant after tabstop and expandtab, " but vim-snipmate is messing up (?) set softtabstop=4 set shiftwidth=4 set expandtab " use 'tabstop' spaces instead of tab set colorcolumn=80 " Bar hinting for 80 chars set breakindent "baby, yeah! set mouse=a " activate mouse support set relativenumber " aka :set rnu " searching set ignorecase " ignore case while searching nnoremap :set hlsearch! " autoformatting let g:formatter_python = ['yapf'] let g:formatter_yapf_style = 'pep8' " handling backupfiles set backupdir=~/.config/nvim/backup// set directory=~/.config/nvim/swap// set undodir=~/.config/nvim/undo// " NERDTree Configuration " hide some fileextenxions let NERDTreeIgnore = ['\.pyc$'] " vim-fugitive " gdiff vertical instead of horizontal set diffopt+=vertical " Airline stuff let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#buffer_nr_show = 1 " multiple-cursors mapping let g:multi_cursor_use_default_mapping=0 let g:multi_cursor_next_key='' let g:multi_cursor_quit_key='' " configure UltiSnips let g:UltiSnipsExpandTrigger='' let g:UltiSnipsJumpForwardTrigger='' let g:UltiSnipsJumpBackwardTrigger='' " vCoolor config let g:vcoolor_map = '' let g:vcool_ins_rgb_map = '' " Insert rgb color. let g:vcool_ins_hsl_map = '' " Insert hsl color. let g:vcool_ins_rgba_map = '' " Insert rgba color. " vim-javascript config let g:javascript_enable_domhtmlcss = 1 " limelight+goyo settings, automatically fire up limelight with goyo let g:limelight_conceal_ctermfg = 'gray' autocmd! User GoyoEnter Limelight autocmd! User GoyoLeave Limelight! " map `,g` to start goyo nnoremap g :Goyo " Enable emmet-vim just for html/css let g:user_emmet_isntall_global = 0 autocmd FileType html,css,md EmmetInstall " configure flake8 " bind `,f` to Flake8 nnoremap f :call Flake8() let g:flake8_show_quickfix=1 let g:flake8_show_in_gutter=1 " instant markdown let g:instant_markdown_autostart = 0 " activate mouse support set mouse=a set scrolloff=5 " add some cpp-keywords syn keyword cppExceptions noexcept using " allow mouse clicks to change cursor position set noequalalways " list whitespaces and some other characters set listchars=tab:>-,trail:~ set list " use latex flavour for plaintex files let g:tex_flavor = "latex" " set some default options for my personal latexmk let g:vimtex_compiler_progname="nvr" let g:vimtex_view_method = 'skim' " let g:vimtex_view_general_viewer = 'open' " let g:vimtex_view_general_options = '-a Skim' let g:vimtex_compiler_latexmk={ \ 'options' : [ \ '-lualatex', \ '-silent', \ '-synctex=1', \ '-interaction=nonstopmode', \ '-shell-escape', \ ], \ 'build_dir' : 'livepreview', \} let g:vimtex_quickfix_ignore_filters = [ \ 'Marginpar on page', \] let g:vimtex_quickfix_autoclose_after_keystrokes = 5 " " coc.nvim " " TextEdit might fail if hidden is not set. set hidden " Some servers have issues with backup files, see #649. " use them anyway " set nobackup " set nowritebackup " Give more space for displaying messages. " set cmdheight=2 " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable " delays and poor user experience. set updatetime=300 " Don't 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 " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by " other plugin before putting this into your config. 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 to trigger completion. if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif " Use to confirm completion, `u` means break undo chain at current " position. Coc only does snippet and additional edit on confirm. " could be remapped by other vim plugin, try `:verbose imap `. if exists('*complete_info') inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" else inoremap pumvisible() ? "\" : "\u\" endif " Use `[g` and `]g` to navigate diagnostics " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) " GoTo code navigation. nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Use K to show documentation in preview window. nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction " Highlight the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') " Symbol renaming. nmap rn (coc-rename) " Formatting selected code. xmap f (coc-format-selected) nmap f (coc-format-selected) augroup mygroup autocmd! " Setup formatexpr specified filetype(s). autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') " Update signature help on jump placeholder. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end " Applying codeAction to the selected region. " Example: `aap` for current paragraph xmap a (coc-codeaction-selected) nmap a (coc-codeaction-selected) " Remap keys for applying codeAction to the current buffer. nmap ac (coc-codeaction) " Apply AutoFix to problem on the current line. nmap qf (coc-fix-current) " Map function and class text objects " NOTE: Requires 'textDocument.documentSymbol' support from the language server. xmap if (coc-funcobj-i) omap if (coc-funcobj-i) xmap af (coc-funcobj-a) omap af (coc-funcobj-a) xmap ic (coc-classobj-i) omap ic (coc-classobj-i) xmap ac (coc-classobj-a) omap ac (coc-classobj-a) " Use CTRL-S for selections ranges. " Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver nmap (coc-range-select) xmap (coc-range-select) " Add `:Format` command to format current buffer. command! -nargs=0 Format :call CocAction('format') " Add `:Fold` command to fold current buffer. command! -nargs=? Fold :call CocAction('fold', ) " Add `:OR` command for organize imports of the current buffer. command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') " Add (Neo)Vim's native statusline support. " NOTE: Please see `:h coc-status` for integrations with external plugins that " provide custom statusline: lightline.vim, vim-airline. set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " Mappings for CoCList " Show all diagnostics. nnoremap a :CocList diagnostics " Manage extensions. nnoremap e :CocList extensions " Show commands. nnoremap c :CocList commands " Find symbol of current document. nnoremap o :CocList outline " Search workspace symbols. nnoremap s :CocList -I symbols " Do default action for next item. nnoremap j :CocNext " Do default action for previous item. nnoremap k :CocPrev " Resume latest coc list. nnoremap p :CocListResume " " End COC " " vimtex settings let g:vimtex_matchparen_enabled=0 " turn off folding to speed up things " Snakemake syntax au BufNewFile,BufRead Snakefile set syntax=snakemake au BufNewFile,BufRead *.rules set syntax=snakemake au BufNewFile,BufRead *.snakefile set syntax=snakemake au BufNewFile,BufRead *.snake set syntax=snakemake " golang let g:go_fmt_command = "goimports" " only for the e5 interactive machines let g:go_version_warning = 0 " easy align vmap (EasyAlign) source $HOME/.config/nvim/local.vimrc