diff --git a/.vimrc b/.vimrc index 9ea7d93..51bddaa 100644 --- a/.vimrc +++ b/.vimrc @@ -1,143 +1,109 @@ " General config ______________________ +" +" Most acronyms are unreadable, but they keep the overview +" I have to do a quick :h lookup for most of these anyway -set nocompatible - +se nocp filetype plugin indent on - -set encoding=utf-8 -set hidden -set ttyfast -set updatetime=300 -set timeout timeoutlen=200 ttimeoutlen=5 -set undolevels=500 -set history=500 -set nu rnu -set signcolumn=number " make sign replace number -set nowrap -set backspace=indent,eol,start " indentation -set incsearch ignorecase smartcase hlsearch" search -set autoindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab " indenting -set lazyredraw " only essential redraws -set synmaxcol=181 -set nobackup nowb noswapfile " no backups -set viminfo='20,\"101 "max 100 lines in registers -set novisualbell -set conceallevel=1 -set clipboard=unnamedplus -set list -set listchars=tab:>-,trail:-,extends:>,precedes:< -set fillchars+=vert:│ "cleaner split separator (tmux style) +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=1 " conceal +se cb=unnamedplus " clipboard +se fcs+=vert:│ " cleaner split separator (tmux style) " Functions ____________________________ -" Function: Toggle line numbers +" Toggle line numbers +fu! ToggleRnu() " toggle: no numbers - relative nummbers + if(&nu) | se nonu nornu | else | se nu rnu | endif +endfu -func! ToggleRnu() " toggle: no numbers - relative nummbers - if(&nu) | set nonu nornu | else | set nu rnu | endif -endfunc +" Keybindings +""""""""""""" -" Keybindings __________________________ - -" Keybindings: leader keys - -nnoremap +" 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 +" 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 % -" Keybindings: splits - -" Split horizontal & vertical -nmap ss :spw -nmap sv :vsw - -" Navigate splits -nnoremap sw w -nnoremap sh h -nnoremap sj j -nnoremap sk k -nnoremap sl l - -" Resize splits -nnoremap sH 8< -nnoremap sJ 8- -nnoremap sK 8+ -nnoremap sL 8> - -" Resize to equal splits -nnoremap s= = - -" Keybindings: file tree - -nnoremap sb :Lex - - -" Keybindings: terminal - -nnoremap t :term - -" Keybindings: hard mode - -nnoremap -nnoremap -nnoremap -nnoremap -inoremap -inoremap -inoremap -inoremap - -" Keybindings: quick quit - -nnoremap w :w -nnoremap W :wq -nnoremap q :q -nnoremap Q :q! - -" Keybindings: exit insert mode - -inoremap jj - -" Keybindings: search - -nnoremap :noh - -" Silver search -nnoremap A :Ag - -" Keybindings: line numbers - -nnoremap n :call ToggleRnu() - -" Keybindings: config - -nnoremap ec :split $MYVIMRC -nnoremap so :so % - -" Plugins ______________________________ +" Plugins +""""""""" call plug#begin() - -" Plugins: General - +" Coc +Plug 'neoclide/coc.nvim', {'branch': 'release'} +" General Plug 'tpope/vim-commentary' Plug 'machakann/vim-sandwich' Plug 'junegunn/fzf', { 'do': './install --bin' } Plug 'junegunn/fzf.vim' Plug 'vimwiki/vimwiki' -Plug 'axvr/zepl.vim' - -" Plugins: Languages - -" JS & TypeScript - +" 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'} +" LaTeX +Plug 'lervag/vimtex' +" TidalCycles +Plug 'supercollider/scvim' +Plug 'tidalcycles/vim-tidal' +" Lisp & Scheme +Plug 'kovisoft/slimv', { 'for': ['clojure', 'scheme', 'racket'] } +call plug#end() -" Coc w/ extensions +" Plugin config +""""""""""""""" -Plug 'neoclide/coc.nvim', {'branch': 'release'} +" Coc let g:coc_global_extensions = [ \'coc-eslint', \'coc-prettier', @@ -153,44 +119,37 @@ let g:coc_global_extensions = [ \'coc-yaml', \'coc-snippets' \] +" Autocomplete +ino pumvisible() ? "\" : + \ coc#refresh() +ino pumvisible() ? "\" : "k" +ino complete_info()["selected"] != "-1" ? "\" : "\u\" +" 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 -" Plugin: LaTeX +" LaTex +let g:vimtex_view_method='zathura' +let g:tex_flavor = 'latex' +let g:tex_conceal='abdmg' +let g:vimtex_quickfix_mode=0 -Plug 'lervag/vimtex' - -" Plugin: TidalCycles - -Plug 'supercollider/scvim' -Plug 'tidalcycles/vim-tidal' - -" Plugin: Scheme -" -Plug 'jpalardy/vim-slime' - -call plug#end() - -" Plugin config ________________________ - -" Plugin: vim-commentary - -xmap c Commentary -nmap c Commentary -nmap cc CommentaryLine - -" Plugin: fzf - -" Popup +" Comments +xm c Commentary +nm c Commentary +nm cc CommentaryLine +" FZF let g:fzf_layout = {'window': { 'width': 0.62, 'height': 0.62}} - -" Use silversearcher-ag to respect .gitignore - -let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' let g:ag_working_path_mode="r" -set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip " fzf ignore - -" Plugin: VimWiki +let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' " respect gitignore +se wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip " " ignore these +" Wiki +let g:vimwiki_auto_chdir = 1 let g:vimwiki_list = [{'path': '~/.vimwiki/', \ 'template_path': '~/.vimwiki/templates/', \ 'template_default': 'default', @@ -199,90 +158,55 @@ let g:vimwiki_list = [{'path': '~/.vimwiki/', \ 'html_filename_parameterization': 1, \ 'template_ext': '.tpl'}] -" Plugin: JS & TypeScript - +" JS and TypeScript let g:javascript_plugin_jsdoc = 1 " jsdoc syntax highlighting let g:javascript_plugin_flow = 1 " flow syntax highlighting let g:javascript_conceal_function = "ƒ" let g:javascript_conceal_return = "⇖" - -" Plugin: Svelte - let g:svelte_indent_script = 0 let g:svelte_indent_style = 0 -" Plugin: TidalCycles - " SuperCollider - -au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd set filetype=supercollider +au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd se filetype=supercollider au Filetype supercollider packadd scvim -" TidalVim - +" Tidalcycles (sclang and vim-tidal) let g:tidal_default_config = {"socket_name": "default", "target_pane": "tidal:1.1"} -" Plugin: vim-slime +" Slimv +let g:slimv_swank_cmd = '! tmux new-window -d -n REPL-SBCL "sbcl --load ~/.vim/bundle/slimv/slime/start-swank.lisp"' -let g:slime_default_config={"socket_name": get(split($TMUX, ","), 0), "target_pane": '{last}'} -let g:slime_dont_ask_default = 1 -let g:slime_paste_file=tempname() -let g:slime_target='tmux' -let g:slime_no_mappings = 1 -xmap el SlimeRegionSend -nmap ep SlimeParagraphSend +" Plugin keybindings +"""""""""""""""""""" -" Plugin keybindings ___________________ - -" Plugin: fzf -nnoremap :FZF -nnoremap p :FZF -nnoremap b :Buffers -nnoremap h :History +" FZF +nn :FZF +nn p :FZF +nn b :Buffers +nn h :History let g:fzf_action = { \ 'ctrl-t': 'tab split', \ 'ctrl-s': 'split', \ 'ctrl-v': 'vsplit' \} -" Plugin: coc +" Color theme & statusline +"""""""""""""""""""""""""" -" Autocompletion +se nosc +se nosmd +se ls=2 +se stl=\ %0*%n +se stl+=\ %m +se stl+=\ %y%1* +se stl+=\ %<%F +se stl+=\ %1*%=%5l%* +se stl+=%2*/%L%* -inoremap pumvisible() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "k" -inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" +colo simple-dark -" Code action on cursor position +" Other +""""""""""""""""""""""" -nmap do (coc-codeaction) - -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} - -" :Prettier command to prettify file - -command! -nargs=0 Prettier :CocCommand prettier.formatFile - -" Plugin: vimtex - -let g:vimtex_view_method='zathura' -let g:tex_flavor = 'latex' -let g:tex_conceal='abdmg' - -" Theme ________________________________ - -colorscheme simple-dark - -set laststatus=2 -set noshowcmd -set noshowmode -set statusline= -set statusline+=%3* -set statusline+=%= -set statusline+=%1*\ %02l/%L\ -set statusline+=%2*\%02v -set statusline+=%1*\ -set statusline+=%0*\ %n\ -set shm+=a -set shm+=W +" VIM config hot reload +autocmd! bufwritepost .vimrc source %