" General config {{{ " " Most acronyms are unreadable, but they keep the overview " I have to do a quick :h lookup for most of these anyway. se nocp " Disable vi incompatibility filet plugin indent on " Filetype recognition se enc=utf8 " se hid " Allow hiding unsaved buffers se tf " Fast tty se ut=300 " 300ms for update time se to tm=200 ttm=5 " Timeouts se shm+=c " ... se ul=500 hi=500 " History and undo se nu rnu scl=number " Line numbers & signs se nowrap se bs=indent,eol,start " Indentation se ai ts=2 sts=2 sw=2 et " Indentation se is ic scs hls " Search se lz " Only essential redraws se nobk nowb noswf " No backups se vi='20,\"101 " Max 100 lines in registers se novb " Bell se cole=0 cocu="" " Conceal se cb=unnamedplus " Clipboard se fcs+=vert:│ " Cleaner split separator (tmux style) set list set lcs=trail:·,tab:→\ ,nbsp:␣ " Whitespace rendering set ar " Autoread " Functions ____________________________ " Toggle line numbers fu! ToggleLineNumbers() set nu! rnu! " toggle: no numbers - relative nummbers endfu " https://alok.github.io/2018/04/26/using-vim-s-conceal-to-make-languages-more-tolerable/ fu! ToggleConceal() if (&cole == 0) | se cole =2 | else | set cole =0 | endif endfu " Insert date fu! Today() :put =strftime('%d %b %Y') endfu " Add command line functions names com! -nargs=0 Today :call Today() com! -nargs=0 ToggleLineNumbers :call ToggleLineNumbers() com! -nargs=0 ToggleConceal :call ToggleConceal() " Setup Man command for reading man pages if exists(":Man") != 2 source $VIMRUNTIME/ftplugin/man.vim endif " Keybindings """"""""""""" " Leader keys nn let mapleader = " " let maplocalleader = ";" " Splits & navigation nm ss :spw| " Split horizontal nm sv :vsw| " Split vertical nn sw w| " Navigate splits nn sh h| " " nn sj j| " " nn sk k| " " nn sl l| " " nn sH 8<| " Resize splits nn sJ 8-| " " nn sK 8+| " " nn sL 8>| " " nn s= =| " Equalize splits " Open nn sb :Lex| " File tree nn t :term| " Open terminal nn o :!xdg-open http://localhost:8080/%:r.html & " Remaps ino jj | " Normal now nn | " Hard mode nn | " " nn | " " nn | " " ino | " " ino | " " ino | " " ino | " " " Search nn / :noh nn f :Ag " Line numbers nn n :call ToggleRnu() " Vim configuration nn ec :split $MYVIMRC nn so :so % " Plugins """"""""" call plug#begin() " Coc Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'github/copilot.vim' " General Plug 'unblevable/quick-scope' Plug 'tpope/vim-commentary' Plug 'machakann/vim-sandwich' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' " JS and TypeScript Plug 'pangloss/vim-javascript', { 'for': ['javascript', 'javascript.jsx'] } Plug 'leafgarland/typescript-vim', { 'for': ['typescript', 'typescript.tsx'] } Plug 'peitalin/vim-jsx-typescript', { 'for': ['typescript.tsx'] } Plug 'evanleck/vim-svelte', {'branch': 'main'} " JSON with comments Plug 'neoclide/jsonc.vim' " LaTeX & markdown Plug 'lervag/vimtex' " Wiki Plug 'lervag/wiki.vim' Plug 'hektor/taskwiki' " Markdown Plug 'vim-pandoc/vim-pandoc' Plug 'vim-pandoc/vim-pandoc-syntax' " TidalCycles Plug 'supercollider/scvim' Plug 'tidalcycles/vim-tidal' call plug#end() " Plugin config """"""""""""""" " Coc let g:coc_global_extensions = [ \'coc-eslint', \'coc-prettier', \'coc-tsserver', \'coc-python', \'coc-html', \'coc-emmet', \'coc-css', \'coc-svg', \'coc-svelte', \'coc-json', \'coc-markdownlint', \'coc-yaml', \'coc-snippets', \'coc-clangd' \] " Autocomplete imap (coc-snippets-expand) nn es :CocCommand snippets.editSnippets ino pumvisible() ? "\" : \ coc#refresh() ino pumvisible() ? "\" : "k" ino complete_info()["selected"] != "-1" ? "\" : "\u\" " Show doccumentation fu! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction nnoremap K :call show_documentation() " Code action on cursor position nm do (coc-codeaction) " Coc statusline se statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " Prettier command com! -nargs=0 Prettier :CocCommand prettier.formatFile " `.../copilot` {{{ let g:copilot_node_command = "/home/h/.config/nvm/versions/node/v16.18.0/bin/node" let g:copilot_no_tab_map = v:true imap (copilot-next) imap (copilot-prev) imap