Muck out my vim config
parent
78f42d5c70
commit
491f87e78c
346
.vimrc
346
.vimrc
|
@ -1,143 +1,109 @@
|
||||||
" General config ______________________
|
" 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
|
filetype plugin indent on
|
||||||
|
se enc=utf8 "
|
||||||
set encoding=utf-8
|
se hid " allow hiding unsaved buffers
|
||||||
set hidden
|
se tf " fast tty
|
||||||
set ttyfast
|
se ut=300 " 300ms for update time
|
||||||
set updatetime=300
|
se to tm=200 ttm=5 " timeouts
|
||||||
set timeout timeoutlen=200 ttimeoutlen=5
|
se shm+=c " ...
|
||||||
set undolevels=500
|
se ul=500 hi=500 " history and undo
|
||||||
set history=500
|
se nu rnu scl=number " line numbers & signs
|
||||||
set nu rnu
|
se nowrap
|
||||||
set signcolumn=number " make sign replace number
|
se bs=indent,eol,start " indentation
|
||||||
set nowrap
|
se ai ts=2 sts=2 sw=2 et " indentation
|
||||||
set backspace=indent,eol,start " indentation
|
se is ic scs hls " search
|
||||||
set incsearch ignorecase smartcase hlsearch" search
|
se lz " only essential redraws
|
||||||
set autoindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab " indenting
|
se nobk nowb noswf " no backups
|
||||||
set lazyredraw " only essential redraws
|
se vi='20,\"101 " max 100 lines in registers
|
||||||
set synmaxcol=181
|
se novb " bell
|
||||||
set nobackup nowb noswapfile " no backups
|
se cole=1 " conceal
|
||||||
set viminfo='20,\"101 "max 100 lines in registers
|
se cb=unnamedplus " clipboard
|
||||||
set novisualbell
|
se fcs+=vert:│ " cleaner split separator (tmux style)
|
||||||
set conceallevel=1
|
|
||||||
set clipboard=unnamedplus
|
|
||||||
set list
|
|
||||||
set listchars=tab:>-,trail:-,extends:>,precedes:<
|
|
||||||
set fillchars+=vert:│ "cleaner split separator (tmux style)
|
|
||||||
|
|
||||||
" Functions ____________________________
|
" 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
|
" Keybindings
|
||||||
if(&nu) | set nonu nornu | else | set nu rnu | endif
|
"""""""""""""
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Keybindings __________________________
|
" Leader keys
|
||||||
|
nn <space> <nop>
|
||||||
" Keybindings: leader keys
|
|
||||||
|
|
||||||
nnoremap <space> <nop>
|
|
||||||
let mapleader = " "
|
let mapleader = " "
|
||||||
let maplocalleader = ";"
|
let maplocalleader = ";"
|
||||||
|
" Splits & navigation
|
||||||
|
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
|
||||||
|
" Open
|
||||||
|
nn sb :Lex<cr> " File tree
|
||||||
|
nn <leader>t :term<cr> " Open terminal
|
||||||
|
" Remaps
|
||||||
|
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> " "
|
||||||
|
" 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>
|
||||||
|
|
||||||
" Keybindings: splits
|
" Plugins
|
||||||
|
"""""""""
|
||||||
" Split horizontal & vertical
|
|
||||||
nmap ss :sp<Return><c-w>w
|
|
||||||
nmap sv :vs<Return><c-w>w
|
|
||||||
|
|
||||||
" Navigate splits
|
|
||||||
nnoremap sw <c-w>w
|
|
||||||
nnoremap sh <c-w>h
|
|
||||||
nnoremap sj <c-w>j
|
|
||||||
nnoremap sk <c-w>k
|
|
||||||
nnoremap sl <c-w>l
|
|
||||||
|
|
||||||
" Resize splits
|
|
||||||
nnoremap sH <c-w>8<
|
|
||||||
nnoremap sJ <c-w>8-
|
|
||||||
nnoremap sK <c-w>8+
|
|
||||||
nnoremap sL <c-w>8>
|
|
||||||
|
|
||||||
" Resize to equal splits
|
|
||||||
nnoremap s= <c-w>=
|
|
||||||
|
|
||||||
" Keybindings: file tree
|
|
||||||
|
|
||||||
nnoremap sb :Lex<cr>
|
|
||||||
|
|
||||||
|
|
||||||
" Keybindings: terminal
|
|
||||||
|
|
||||||
nnoremap <leader>t :term<cr>
|
|
||||||
|
|
||||||
" Keybindings: hard mode
|
|
||||||
|
|
||||||
nnoremap <left> <nop>
|
|
||||||
nnoremap <down> <nop>
|
|
||||||
nnoremap <up> <nop>
|
|
||||||
nnoremap <right> <nop>
|
|
||||||
inoremap <left> <nop>
|
|
||||||
inoremap <down> <nop>
|
|
||||||
inoremap <up> <nop>
|
|
||||||
inoremap <right> <nop>
|
|
||||||
|
|
||||||
" Keybindings: quick quit
|
|
||||||
|
|
||||||
nnoremap <leader>w :w<cr>
|
|
||||||
nnoremap <leader>W :wq<cr>
|
|
||||||
nnoremap <leader>q :q<cr>
|
|
||||||
nnoremap <leader>Q :q!<cr>
|
|
||||||
|
|
||||||
" Keybindings: exit insert mode
|
|
||||||
|
|
||||||
inoremap <nowait> jj <esc>
|
|
||||||
|
|
||||||
" Keybindings: search
|
|
||||||
|
|
||||||
nnoremap <leader><space> :noh<cr>
|
|
||||||
|
|
||||||
" Silver search
|
|
||||||
nnoremap <leader>A :Ag <cr>
|
|
||||||
|
|
||||||
" Keybindings: line numbers
|
|
||||||
|
|
||||||
nnoremap <leader>n :call ToggleRnu()<cr>
|
|
||||||
|
|
||||||
" Keybindings: config
|
|
||||||
|
|
||||||
nnoremap <leader>ec :split $MYVIMRC<cr>
|
|
||||||
nnoremap <leader>so :so %<cr>
|
|
||||||
|
|
||||||
" Plugins ______________________________
|
|
||||||
|
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
|
" Coc
|
||||||
" Plugins: General
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
|
" General
|
||||||
Plug 'tpope/vim-commentary'
|
Plug 'tpope/vim-commentary'
|
||||||
Plug 'machakann/vim-sandwich'
|
Plug 'machakann/vim-sandwich'
|
||||||
Plug 'junegunn/fzf', { 'do': './install --bin' }
|
Plug 'junegunn/fzf', { 'do': './install --bin' }
|
||||||
Plug 'junegunn/fzf.vim'
|
Plug 'junegunn/fzf.vim'
|
||||||
Plug 'vimwiki/vimwiki'
|
Plug 'vimwiki/vimwiki'
|
||||||
Plug 'axvr/zepl.vim'
|
" JS and TypeScript
|
||||||
|
|
||||||
" Plugins: Languages
|
|
||||||
|
|
||||||
" JS & TypeScript
|
|
||||||
|
|
||||||
Plug 'pangloss/vim-javascript', { 'for': ['javascript', 'javascript.jsx'] }
|
Plug 'pangloss/vim-javascript', { 'for': ['javascript', 'javascript.jsx'] }
|
||||||
Plug 'leafgarland/typescript-vim', { 'for': ['typescript', 'typescript.tsx'] }
|
Plug 'leafgarland/typescript-vim', { 'for': ['typescript', 'typescript.tsx'] }
|
||||||
Plug 'peitalin/vim-jsx-typescript', { 'for': ['typescript.tsx'] }
|
Plug 'peitalin/vim-jsx-typescript', { 'for': ['typescript.tsx'] }
|
||||||
Plug 'evanleck/vim-svelte', {'branch': 'main'}
|
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 = [
|
let g:coc_global_extensions = [
|
||||||
\'coc-eslint',
|
\'coc-eslint',
|
||||||
\'coc-prettier',
|
\'coc-prettier',
|
||||||
|
@ -153,44 +119,37 @@ let g:coc_global_extensions = [
|
||||||
\'coc-yaml',
|
\'coc-yaml',
|
||||||
\'coc-snippets'
|
\'coc-snippets'
|
||||||
\]
|
\]
|
||||||
|
" 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
|
||||||
|
|
||||||
" 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'
|
" Comments
|
||||||
|
xm <leader>c <Plug>Commentary
|
||||||
" Plugin: TidalCycles
|
nm <leader>c <Plug>Commentary
|
||||||
|
nm <leader>cc <Plug>CommentaryLine
|
||||||
Plug 'supercollider/scvim'
|
|
||||||
Plug 'tidalcycles/vim-tidal'
|
|
||||||
|
|
||||||
" Plugin: Scheme
|
|
||||||
"
|
|
||||||
Plug 'jpalardy/vim-slime'
|
|
||||||
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
" Plugin config ________________________
|
|
||||||
|
|
||||||
" Plugin: vim-commentary
|
|
||||||
|
|
||||||
xmap <leader>c <Plug>Commentary
|
|
||||||
nmap <leader>c <Plug>Commentary
|
|
||||||
nmap <leader>cc <Plug>CommentaryLine
|
|
||||||
|
|
||||||
" Plugin: fzf
|
|
||||||
|
|
||||||
" Popup
|
|
||||||
|
|
||||||
|
" FZF
|
||||||
let g:fzf_layout = {'window': { 'width': 0.62, 'height': 0.62}}
|
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"
|
let g:ag_working_path_mode="r"
|
||||||
set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip " fzf ignore
|
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' " respect gitignore
|
||||||
|
se wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip " " ignore these
|
||||||
" Plugin: VimWiki
|
|
||||||
|
|
||||||
|
" Wiki
|
||||||
|
let g:vimwiki_auto_chdir = 1
|
||||||
let g:vimwiki_list = [{'path': '~/.vimwiki/',
|
let g:vimwiki_list = [{'path': '~/.vimwiki/',
|
||||||
\ 'template_path': '~/.vimwiki/templates/',
|
\ 'template_path': '~/.vimwiki/templates/',
|
||||||
\ 'template_default': 'default',
|
\ 'template_default': 'default',
|
||||||
|
@ -199,90 +158,55 @@ let g:vimwiki_list = [{'path': '~/.vimwiki/',
|
||||||
\ 'html_filename_parameterization': 1,
|
\ 'html_filename_parameterization': 1,
|
||||||
\ 'template_ext': '.tpl'}]
|
\ 'template_ext': '.tpl'}]
|
||||||
|
|
||||||
" Plugin: JS & TypeScript
|
" JS and TypeScript
|
||||||
|
|
||||||
let g:javascript_plugin_jsdoc = 1 " jsdoc syntax highlighting
|
let g:javascript_plugin_jsdoc = 1 " jsdoc syntax highlighting
|
||||||
let g:javascript_plugin_flow = 1 " flow syntax highlighting
|
let g:javascript_plugin_flow = 1 " flow syntax highlighting
|
||||||
let g:javascript_conceal_function = "ƒ"
|
let g:javascript_conceal_function = "ƒ"
|
||||||
let g:javascript_conceal_return = "⇖"
|
let g:javascript_conceal_return = "⇖"
|
||||||
|
|
||||||
" Plugin: Svelte
|
|
||||||
|
|
||||||
let g:svelte_indent_script = 0
|
let g:svelte_indent_script = 0
|
||||||
let g:svelte_indent_style = 0
|
let g:svelte_indent_style = 0
|
||||||
|
|
||||||
" Plugin: TidalCycles
|
|
||||||
|
|
||||||
" SuperCollider
|
" SuperCollider
|
||||||
|
au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd se filetype=supercollider
|
||||||
au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd set filetype=supercollider
|
|
||||||
au Filetype supercollider packadd scvim
|
au Filetype supercollider packadd scvim
|
||||||
|
|
||||||
" TidalVim
|
" Tidalcycles (sclang and vim-tidal)
|
||||||
|
|
||||||
let g:tidal_default_config = {"socket_name": "default", "target_pane": "tidal:1.1"}
|
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}'}
|
" Plugin keybindings
|
||||||
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 <leader>el <Plug>SlimeRegionSend
|
|
||||||
nmap <leader>ep <Plug>SlimeParagraphSend
|
|
||||||
|
|
||||||
" Plugin keybindings ___________________
|
" FZF
|
||||||
|
nn <c-p> :FZF<cr>
|
||||||
" Plugin: fzf
|
nn <leader>p :FZF<cr>
|
||||||
nnoremap <c-p> :FZF<cr>
|
nn <leader>b :Buffers<cr>
|
||||||
nnoremap <leader>p :FZF<cr>
|
nn <leader>h :History<cr>
|
||||||
nnoremap <leader>b :Buffers<cr>
|
|
||||||
nnoremap <leader>h :History<cr>
|
|
||||||
let g:fzf_action = {
|
let g:fzf_action = {
|
||||||
\ 'ctrl-t': 'tab split',
|
\ 'ctrl-t': 'tab split',
|
||||||
\ 'ctrl-s': 'split',
|
\ 'ctrl-s': 'split',
|
||||||
\ 'ctrl-v': 'vsplit'
|
\ '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 <silent><expr><c-j> pumvisible() ? "\<c-n>" :
|
colo simple-dark
|
||||||
\ coc#refresh()
|
|
||||||
inoremap <expr><c-k> pumvisible() ? "\<C-p>" : "k"
|
|
||||||
inoremap <expr><cr> complete_info()["selected"] != "-1" ? "\<c-y>" : "\<c-g>u\<CR>"
|
|
||||||
|
|
||||||
" Code action on cursor position
|
" Other
|
||||||
|
"""""""""""""""""""""""
|
||||||
|
|
||||||
nmap <leader>do <Plug>(coc-codeaction)
|
" VIM config hot reload
|
||||||
|
autocmd! bufwritepost .vimrc source %
|
||||||
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
|
|
||||||
|
|
Loading…
Reference in New Issue