call plug#begin('~/.local/share/nvim/site/plugged') " airline Plug 'https://github.com/bling/vim-airline.git' Plug 'vim-airline/vim-airline-themes' " git Plug 'https://github.com/tpope/vim-fugitive.git' " Shougos UI-Plugin Plug 'Shougo/denite.nvim' " Plug 'roxma/nvim-completion-manager' " showing function-signatures/doc on completion Plug 'Shougo/echodoc.vim' " Tab-Completion " Plug 'ervandew/supertab' " vim-sourround Plug 'https://github.com/tpope/vim-surround.git' " theme Plug 'https://github.com/morhetz/gruvbox.git' Plug 'frankier/neovim-colors-solarized-truecolor-only' " rainbow-parentethies Plug 'luochen1990/rainbow' " fuzzy finder Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' " git-gutter (little + - and ~ left) Plug 'https://github.com/airblade/vim-gitgutter.git' " Tabular Plug 'https://github.com/godlygeek/tabular.git' " Multiline-Comments Plug 'tomtom/tcomment_vim' " Auto-Formatting Plug 'Chiel92/vim-autoformat' " show colors (#abc) with that background-color Plug 'ap/vim-css-color' " multiline-stuff Plug 'terryma/vim-multiple-cursors' " Icons Plug 'ryanoasis/vim-devicons' " Markdown-Support Plug 'plasticboy/vim-markdown' Plug 'dhruvasagar/vim-table-mode' Plug 'suan/vim-instant-markdown' " Code-Folds Plug 'tmhedberg/SimpylFold' " better closing Plug 'mhinz/vim-sayonara' " Session-Management Plug 'xolox/vim-session' | Plug 'xolox/vim-misc' " CoC Plug 'neoclide/coc.nvim', {'branch': 'release'} " Clojure Plug 'guns/vim-sexp', {'for': 'clojure'} Plug 'liquidz/vim-iced', {'for': 'clojure'} Plug 'liquidz/vim-iced-coc-source', {'for': 'clojure'} " todo.txt Plug 'freitass/todo.txt-vim' " LSP Plug 'williamboman/mason.nvim' Plug 'williamboman/mason-lspconfig.nvim' Plug 'neovim/nvim-lspconfig', {'branch': 'v0.1.6'} " Go Plug 'fatih/vim-go', {'do':':GoUpdateBinaries'} call plug#end() " SETTINGS " set leader to space let mapleader= "\" let maplocalleader= ";" " autocmd InsertEnter * :set number " autocmd InsertEnter * :set norelativenumber " autocmd InsertLeave * :set relativenumber " autocmd InsertLeave * :set nonumber set relativenumber set number set shiftwidth=2 set tabstop=2 " show cmd - especially leader set showcmd " expand tabs with spaces set expandtab " Tell Vim which characters to show for expanded TABs, " trailing whitespace, and end-of-lines. VERY useful! if &listchars ==# 'eol:$' set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ endif set list " Show problematic characters. " Also highlight all tabs and trailing whitespace characters. highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen match ExtraWhitespace /\s\+$\|\t/ set hlsearch " Highlight search results. set ignorecase " Make searching case insensitive set smartcase " ... unless the query has capital letters. set incsearch " Incremental search. set gdefault " Use 'g' flag by default with :s/foo/bar/. set magic " Use 'magic' patterns (extended regular expressions). "set inccommand=nosplit " Use live-preview of search/replace etc. set conceallevel=2 " Allow things to be visually opressed (i.e. *foo* be italic) set mouse=a " enable mouse set foldenable " enable folding set undofile " enable undo over sessions set undodir="$HOME/.VIM_UNDO_FILES" " save in this path set laststatus=3 " only 1 statusline, not 1 per window highlight WinSeperator guibg=None set hidden let g:loaded_perl_provider = 0 " LSP Config lua << EOF require("mason").setup() require("mason-lspconfig").setup() EOF " Use to clear the highlighting of :set hlsearch. if maparg('', 'n') ==# '' nnoremap :nohlsearch endif " Remember cursor position between vim sessions autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal! g'\"" | \ endif " center buffer around cursor when opening files autocmd BufRead * normal zz "" KEY-BINDINGS " use to fold/unfold nnoremap za " : completion function! CheckBackSpace() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~ '\s' endfunction inoremap \ pumvisible() ? "\" : \ CheckBackSpace() ? "\" : \ coc#refresh() " : completion back inoremap pumvisible() ? "\" : "\" " : confirm completion, or insert inoremap pumvisible() ? "\" : "\" " use to Jump to definition instead of (default) nmap " c-d to delete line in insert-mode inoremap ddi " exit terminal-mode tnoremap """"""""""""""""""""""""""""""""""""""""""""" Coc Keys " 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 ShowDocumentation() function! ShowDocumentation() if CocAction('hasProvider', 'hover') call CocActionAsync('doHover') else call feedkeys('K', 'in') 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 code actions to the selected code block " Example: `aap` for current paragraph xmap a (coc-codeaction-selected) nmap a (coc-codeaction-selected) " Remap keys for applying code actions at the cursor position nmap ac (coc-codeaction-cursor) " Remap keys for apply code actions affect whole buffer nmap as (coc-codeaction-source) " Apply the most preferred quickfix action to fix diagnostic on the current line nmap qf (coc-fix-current) " Remap keys for applying refactor code actions nmap re (coc-codeaction-refactor) xmap r (coc-codeaction-refactor-selected) nmap r (coc-codeaction-refactor-selected) " Run the Code Lens action on the current line nmap cl (coc-codelens-action) " 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) " Remap and to scroll float windows/popups if has('nvim-0.4.0') || has('patch-8.2.0750') nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" endif " Use CTRL-S for selections ranges " Requires 'textDocument/selectionRange' support of language server nmap (coc-range-select) xmap (coc-range-select) " Add `:Format` command to format current buffer command! -nargs=0 Format :call CocActionAsync('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 CocActionAsync('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 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " autoformat code if possible (read docs on vim-autoformat!) "noremap f :Autoformat noremap TM :TableModeToggle " multi-cursor let g:multi_cursor_next_key='' let g:multi_cursor_prev_key='' let g:multi_cursor_skip_key='' let g:multi_cursor_quit_key='' " Align blocks of text and keep them selected vmap < >gv nnoremap d "_d vnoremap d "_d " toggle comments vnoremap / :TComment " Open file menu nnoremap o :Files " Open buffer menu nnoremap b :Buffers " Open most recently used files nnoremap f :GFiles " Open Tag-Search nnoremap t :Tags " Expand patterns in Haskell "nnoremap hc :GhcModSplitFunCase " Expand function signatures in Haskell "nnoremap hs :GhcModSigCodegen " Get Type-Info under Cursor "nnoremap ht :GhcModType " " Copy to clipboard vnoremap y "+y nnoremap Y "+yg_ nnoremap y "+y nnoremap yy "+yy " " Paste from clipboard nnoremap p "+p nnoremap P "+P vnoremap p "+p vnoremap P "+P " Clear stuff nnoremap :nohlsearch:cclose " Clojure-Bindings " Enable vim-iced's default key mapping " This is recommended for newbies let g:iced_enable_default_key_mappings = v:true let g:sexp_enable_insert_mode_mappings = 0 " stop inserting brackets let g:iced_enable_clj_kondo_analysis = v:true " kondo analysis let g:iced_enable_clj_kondo_local_analysis = v:true " also analyse local. let g:iced_enable_auto_document = 'any' " automatically open documentation " THEME-RELATED STUFF syntax enable filetype plugin on " enable true color set termguicolors " enable italics, load colorscheme let g:gruvbox_italic=1 set background=dark colorscheme gruvbox let g:rainbow_active = 1 let &colorcolumn="80,".join(range(120,200),",") " spell checking for markdown autocmd BufRead,BufNewFile *.md setlocal spell complete+=kspell textwidth=80 autocmd BufRead,BufNewFile *.markdown setlocal spell complete+=kspell textwidth=80 autocmd BufRead,BufNewFile *.md hi SpellBad guibg=#582828 gui=none autocmd BufRead,BufNewFile *.markdown hi SpellBad guibg=#582828 gui=none " autocmd FileType markdown nnoremap t :Toc " set languages to english and german set spelllang=de_de,en_us let g:vim_markdown_toc_autofit = 0 let g:vim_markdown_emphasis_multiline = 1 let g:vim_markdown_math = 1 let g:vim_markdown_new_list_item_indent = 2 let g:vim_markdown_folding_level = 0 " disable instant-markdown-preview let g:instant_markdown_autostart = 0 au FileType markdown setl shell=bash let g:haskell_enable_quantification = 1 " enable highlighting of forall let g:haskell_enable_recursivedo = 1 " enable highlighting of mdo and rec let g:haskell_enable_arrowsyntax = 1 " enable highlighting of proc let g:haskell_enable_pattern_synonyms = 1 " enable highlighting of pattern let g:haskell_enable_typeroles = 1 " enable highlighting of type roles let g:haskell_enable_static_pointers = 1 " enable highlighting of static let g:haskell_indent_if = 3 let g:haskell_indent_case = 2 let g:haskell_indent_let = 4 let g:haskell_indent_where = 6 let g:haskell_indent_do = 3 let g:haskell_indent_in = 1 let g:haskell_indent_guard = 2 " SNIPPETS " " Emmet customization " " Enable Emmet in all modes " " Remapping , just doesn't cut it. " function! s:expand_html_tab() " " try to determine if we're within quotes or tags. " " if so, assume we're in an emmet fill area. " let line = getline('.') " if col('.') < len(line) " let line = matchstr(line, '[">][^<"]*\%'.col('.').'c[^>"]*[<"]') " if len(line) >= 2 " return "\" " endif " endif " " expand anything emmet thinks is expandable. " if emmet#isExpandable() " return "\," " endif " " return a regular tab character " return "\" " endfunction " autocmd FileType html,markdown imap expand_html_tab() " let g:user_emmet_mode='a' " let g:user_emmet_complete_tag = 1 " let g:user_emmet_install_global = 0 " autocmd FileType html,css EmmetInstall " AIRLINE let g:airline#extensions#tabline#ignore_bufadd_pat = 'gundo|undotree|vimfiler|tagbar|netrw|startify|!' let g:airline#extensions#tabline#enabled = 1 set hidden let g:airline#extensions#tabline#fnamemod = ':t' let g:airline#extensions#tabline#show_tab_nr = 1 let g:airline_powerline_fonts = 1 let g:airline_theme='understated' " let g:airline_theme='base16_solarized' cnoreabbrev x getcmdtype() == ":" && getcmdline() == 'x' ? 'Sayonara' : 'x' nmap tt :term nmap , :bnext nmap . :bprevious let g:airline#extensions#tabline#buffer_idx_mode = 1 nmap 1 AirlineSelectTab1 nmap 2 AirlineSelectTab2 nmap 3 AirlineSelectTab3 nmap 4 AirlineSelectTab4 nmap 5 AirlineSelectTab5 nmap 6 AirlineSelectTab6 nmap 7 AirlineSelectTab7 nmap 8 AirlineSelectTab8 nmap 9 AirlineSelectTab9 set guifont=Sauce\ Code\ Pro\ Nerd\ Font\ Complete:h13 " TABULARIZE nmap t: :Tabularize /:: /l1c0l0 nmap t= :Tabularize /= /l1c0l0 nmap tp :Tabularize /\| /l1c0l0 nmap t, :Tabularize /, /l1c0l0 " Table mode let g:table_mode_corner_corner="+" let g:table_mode_header_fillchar="=" " Move between windows nnoremap nnoremap nnoremap nnoremap " Move between tabs nnoremap :bNext nnoremap :bnext " Session-Options let g:session_autoload='yes' let g:session_autosave='yes' " Change background quickly nmap :let &background = ( &background == "dark" ? "light" : "dark" ) " BUGFIX UNTIL #6997 gets meged. set guicursor=