dots/.vimrc

208 lines
5.5 KiB
VimL
Raw Normal View History

2020-12-10 15:03:05 +01:00
" General config ______________________
2021-03-10 17:48:56 +01:00
"
2021-03-10 18:06:07 +01:00
" Most acronyms are unreadable, but they keep the overview
" I have to do a quick :h lookup for most of these anyway.
2020-02-17 17:05:51 +01:00
2021-03-10 18:06:07 +01:00
se nocp " Disable vi incompatibility
filet plugin indent on " Filetype recognition
2021-03-10 17:48:56 +01:00
se enc=utf8 "
2021-03-10 18:06:07 +01:00
se hid " Allow hiding unsaved buffers
se tf " Fast tty
2021-03-10 17:48:56 +01:00
se ut=300 " 300ms for update time
2021-03-10 18:06:07 +01:00
se to tm=200 ttm=5 " Timeouts
2021-03-10 17:48:56 +01:00
se shm+=c " ...
2021-03-10 18:06:07 +01:00
se ul=500 hi=500 " History and undo
se nu rnu scl=number " Line numbers & signs
2021-03-10 17:48:56 +01:00
se nowrap
2021-03-10 18:06:07 +01:00
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)
set lcs=tab:→\ ,trail" Whitespace rendering
2020-02-17 17:05:51 +01:00
2020-09-19 22:07:29 +02:00
" Functions ____________________________
2021-03-10 17:48:56 +01:00
" Toggle line numbers
fu! ToggleRnu() " toggle: no numbers - relative nummbers
if(&nu) | se nonu nornu | else | se nu rnu | endif
endfu
2020-04-15 15:10:46 +02:00
2021-03-10 17:48:56 +01:00
" Keybindings
"""""""""""""
2020-02-17 17:05:51 +01:00
2021-03-10 17:48:56 +01:00
" Leader keys
nn <space> <nop>
2020-05-07 02:11:41 +02:00
let mapleader = " "
2020-05-08 16:11:55 +02:00
let maplocalleader = ";"
2021-03-10 17:48:56 +01:00
" Splits & navigation
2021-03-28 10:37:23 +02:00
nm ss :sp<CR><c-w>w| " Split horizontal
nm sv :vs<CR><c-w>w| " Split vertical
nn sw <c-w>w| " Navigate splits
nn sh <c-w>h| " "
nn sj <c-w>j| " "
nn sk <c-w>k| " "
nn sl <c-w>l| " "
nn sH <c-w>8<| " Resize splits
nn sJ <c-w>8-| " "
nn sK <c-w>8+| " "
nn sL <c-w>8>| " "
nn s= <c-w>=| " Equalize splits
2021-03-10 17:48:56 +01:00
" Open
2021-03-28 10:37:23 +02:00
nn sb :Lex<cr>| " File tree
nn <leader>t :term<cr>| " Open terminal
2021-03-10 17:48:56 +01:00
" Remaps
2021-03-28 10:37:23 +02:00
ino <nowait> jj <esc>| " Normal now
nn <left> <nop>| " Hard mode
nn <down> <nop>| " "
nn <up> <nop>| " "
nn <right> <nop>| " "
ino <left> <nop>| " "
ino <down> <nop>| " "
ino <up> <nop>| " "
ino <right> <nop>| " "
2021-03-10 17:48:56 +01:00
" Search
nn <leader>/ :noh<cr>
nn <leader>f :Ag <cr>
" Line numbers
nn <leader>n :call ToggleRnu()<cr>
" Vim configuration
nn <leader>ec :split $MYVIMRC<cr>
nn <leader>so :so %<cr>
" Plugins
"""""""""
2020-02-17 17:05:51 +01:00
2020-05-07 02:11:41 +02:00
call plug#begin()
2021-03-10 17:48:56 +01:00
" Coc
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" General
Plug 'tpope/vim-commentary'
2020-09-19 22:07:29 +02:00
Plug 'machakann/vim-sandwich'
2020-05-07 02:11:41 +02:00
Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
2020-11-02 11:50:14 +01:00
Plug 'vimwiki/vimwiki'
2021-03-10 17:48:56 +01:00
" JS and TypeScript
2020-05-07 02:11:41 +02:00
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'}
2021-03-10 17:48:56 +01:00
" LaTeX
Plug 'lervag/vimtex'
" TidalCycles
Plug 'supercollider/scvim'
Plug 'tidalcycles/vim-tidal'
" Lisp & Scheme
Plug 'kovisoft/slimv', { 'for': ['clojure', 'scheme', 'racket'] }
call plug#end()
2020-11-02 11:50:14 +01:00
2021-03-10 17:48:56 +01:00
" Plugin config
"""""""""""""""
2020-11-02 11:50:14 +01:00
2021-03-10 17:48:56 +01:00
" Coc
2020-02-17 17:05:51 +01:00
let g:coc_global_extensions = [
\'coc-eslint',
\'coc-prettier',
2020-02-19 10:26:20 +01:00
\'coc-tsserver',
2020-05-07 02:11:41 +02:00
\'coc-python',
\'coc-html',
\'coc-emmet',
\'coc-css',
\'coc-svg',
\'coc-svelte',
\'coc-json',
\'coc-markdownlint',
\'coc-yaml',
2020-09-05 23:19:23 +02:00
\'coc-snippets'
2020-02-17 17:05:51 +01:00
\]
2021-03-10 17:48:56 +01:00
" Autocomplete
ino <silent><expr><c-j> pumvisible() ? "\<c-n>" :
\ coc#refresh()
ino <expr><c-k> pumvisible() ? "\<C-p>" : "k"
ino <expr><cr> complete_info()["selected"] != "-1" ? "\<c-y>" : "\<c-g>u\<CR>"
" Code action on cursor position
nm <leader>do <Plug>(coc-codeaction)
" Coc statusline
se statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Prettier command
com! -nargs=0 Prettier :CocCommand prettier.formatFile
2020-02-17 17:05:51 +01:00
2021-03-10 17:48:56 +01:00
" LaTex
let g:vimtex_view_method='zathura'
let g:tex_flavor = 'latex'
let g:tex_conceal='abdmg'
let g:vimtex_quickfix_mode=0
2020-09-19 22:07:29 +02:00
2021-03-10 17:48:56 +01:00
" Comments
xm <leader>c <Plug>Commentary
nm <leader>c <Plug>Commentary
nm <leader>cc <Plug>CommentaryLine
2020-09-19 22:07:29 +02:00
2021-03-10 17:48:56 +01:00
" FZF
2020-05-07 02:11:41 +02:00
let g:fzf_layout = {'window': { 'width': 0.62, 'height': 0.62}}
2020-03-19 14:28:07 +01:00
let g:ag_working_path_mode="r"
2021-03-10 17:48:56 +01:00
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' " respect gitignore
se wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip " " ignore these
2020-09-19 22:07:29 +02:00
2021-03-10 17:48:56 +01:00
" Wiki
let g:vimwiki_auto_chdir = 1
2021-03-10 18:06:32 +01:00
let g:vimwiki_list = [{'path': '~/.vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
2020-08-06 16:36:57 +02:00
2021-03-10 17:48:56 +01:00
" JS and TypeScript
2020-05-07 02:11:41 +02:00
let g:javascript_plugin_jsdoc = 1 " jsdoc syntax highlighting
let g:javascript_plugin_flow = 1 " flow syntax highlighting
let g:javascript_conceal_function = "ƒ"
2020-08-06 16:36:57 +02:00
let g:javascript_conceal_return = "⇖"
2020-05-13 19:08:38 +02:00
let g:svelte_indent_script = 0
let g:svelte_indent_style = 0
2020-03-19 14:28:07 +01:00
" SuperCollider
2021-03-10 17:48:56 +01:00
au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd se filetype=supercollider
2020-03-19 14:28:07 +01:00
au Filetype supercollider packadd scvim
2021-03-10 17:48:56 +01:00
" Tidalcycles (sclang and vim-tidal)
2020-05-08 16:11:55 +02:00
let g:tidal_default_config = {"socket_name": "default", "target_pane": "tidal:1.1"}
2020-05-07 02:11:41 +02:00
2021-03-10 17:48:56 +01:00
" Slimv
let g:slimv_swank_cmd = '! tmux new-window -d -n REPL-SBCL "sbcl --load ~/.vim/bundle/slimv/slime/start-swank.lisp"'
2020-11-02 11:53:18 +01:00
2021-03-10 17:48:56 +01:00
" Plugin keybindings
""""""""""""""""""""
2020-09-19 22:07:29 +02:00
2021-03-10 17:48:56 +01:00
" FZF
nn <c-p> :FZF<cr>
nn <leader>p :FZF<cr>
nn <leader>b :Buffers<cr>
nn <leader>h :History<cr>
2020-09-19 22:07:29 +02:00
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\}
2021-03-10 17:48:56 +01:00
" Color theme & statusline
""""""""""""""""""""""""""
2020-05-13 19:08:38 +02:00
2021-03-10 17:48:56 +01:00
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%*
2020-11-02 11:54:10 +01:00
2021-03-10 17:48:56 +01:00
colo simple-dark
2020-02-16 12:41:12 +01:00
2021-03-10 17:48:56 +01:00
" Other
"""""""""""""""""""""""
2020-08-06 16:36:57 +02:00
2021-03-10 17:48:56 +01:00
" VIM config hot reload
autocmd! bufwritepost .vimrc source %