dots/.vimrc

299 lines
6.4 KiB
VimL
Raw Normal View History

2020-12-10 15:03:05 +01:00
" General config ______________________
"
2020-02-17 17:05:51 +01:00
2020-03-19 14:28:07 +01:00
set nocompatible
2020-05-07 02:11:41 +02:00
2020-03-19 14:28:07 +01:00
filetype plugin indent on
2020-02-16 12:41:12 +01:00
set encoding=utf-8
2020-02-17 17:05:51 +01:00
set hidden
2020-02-16 12:41:12 +01:00
set ttyfast
2020-02-17 17:05:51 +01:00
set updatetime=300
2020-12-10 14:59:15 +01:00
set timeout timeoutlen=200 ttimeoutlen=5
2020-02-17 17:05:51 +01:00
set undolevels=500
set history=500
2020-09-05 15:08:34 +02:00
set nu rnu
2020-05-07 02:11:41 +02:00
set signcolumn=number " make sign replace number
2020-02-17 17:05:51 +01:00
set nowrap
2020-08-06 16:36:57 +02:00
set backspace=indent,eol,start " indentation
2020-12-10 15:03:05 +01:00
set incsearch ignorecase smartcase hlsearch" search
2020-05-07 02:11:41 +02:00
set autoindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab " indenting
set lazyredraw " only essential redraws
2020-08-06 16:36:57 +02:00
set synmaxcol=181
set nobackup nowb noswapfile " no backups
set viminfo='20,\"101 "max 100 lines in registers
2020-05-07 02:11:41 +02:00
set novisualbell
set conceallevel=1
set clipboard=unnamedplus
2020-12-10 15:04:57 +01:00
set list
set listchars=tab:>-,trail:-,extends:>,precedes:<
2020-02-17 17:05:51 +01:00
2020-09-19 22:07:29 +02:00
" Functions ____________________________
" Function: Toggle line numbers
2020-04-15 15:10:46 +02:00
2020-05-07 02:11:41 +02:00
func! ToggleRnu() " toggle: no numbers - relative nummbers
if(&nu) | set nonu nornu | else | set nu rnu | endif
endfunc
2020-02-17 17:05:51 +01:00
2020-09-19 22:07:29 +02:00
" Keybindings __________________________
" Keybindings: leader keys
2020-02-16 12:41:12 +01:00
2020-05-07 02:11:41 +02:00
nnoremap <space> <nop>
let mapleader = " "
2020-05-08 16:11:55 +02:00
let maplocalleader = ";"
2020-02-17 17:05:51 +01:00
2020-09-19 22:07:29 +02:00
" Keybindings: splits
" Split horizontal & vertical
2020-05-07 02:11:41 +02:00
nmap ss :sp<Return><c-w>w
nmap sv :vs<Return><c-w>w
2020-02-17 17:05:51 +01:00
2020-12-10 15:01:49 +01:00
" Navigate splits
2020-05-07 14:18:36 +02:00
nnoremap sw <c-w>w
nnoremap sh <c-w>h
2020-05-07 02:11:41 +02:00
nnoremap sj <c-w>j
nnoremap sk <c-w>k
nnoremap sl <c-w>l
2020-02-17 17:05:51 +01:00
2020-12-10 15:01:49 +01:00
" 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>=
2020-02-17 17:05:51 +01:00
2020-09-19 22:07:29 +02:00
" Keybindings: file tree
2020-05-20 21:14:07 +02:00
nnoremap sb :Lex<cr>
2020-09-19 22:07:29 +02:00
" Keybindings: terminal
2020-05-20 21:14:07 +02:00
nnoremap <leader>t :term<cr>
2020-05-07 14:18:36 +02:00
2020-09-19 22:07:29 +02:00
" Keybindings: hard mode
2020-05-07 14:18:36 +02:00
nnoremap <left> <nop>
2020-05-07 16:11:54 +02:00
nnoremap <down> <nop>
nnoremap <up> <nop>
2020-05-07 14:18:36 +02:00
nnoremap <right> <nop>
inoremap <left> <nop>
2020-05-07 16:11:54 +02:00
inoremap <down> <nop>
inoremap <up> <nop>
2020-05-07 14:18:36 +02:00
inoremap <right> <nop>
2020-05-07 02:11:41 +02:00
2020-09-19 22:07:29 +02:00
" Keybindings: quick quit
2020-05-07 02:11:41 +02:00
nnoremap <leader>w :w<cr>
2020-05-08 17:16:18 +02:00
nnoremap <leader>W :wq<cr>
2020-05-07 02:11:41 +02:00
nnoremap <leader>q :q<cr>
2020-05-08 17:16:18 +02:00
nnoremap <leader>Q :q!<cr>
2020-02-16 09:45:55 +01:00
2020-09-19 22:07:29 +02:00
" Keybindings: exit insert mode
2020-12-10 15:03:54 +01:00
inoremap <nowait> jj <esc>
2020-02-16 13:15:17 +01:00
2020-12-10 15:03:05 +01:00
" Keybindings: search
2020-09-19 22:07:29 +02:00
2020-05-07 02:11:41 +02:00
nnoremap <leader><space> :noh<cr>
2020-09-19 22:07:29 +02:00
" Silver search
2020-12-10 15:03:05 +01:00
nnoremap <leader>A :Ag <cr>
2020-05-07 02:11:41 +02:00
2020-09-19 22:07:29 +02:00
" Keybindings: line numbers
2020-05-07 02:11:41 +02:00
nnoremap <leader>n :call ToggleRnu()<cr>
2020-02-16 12:41:12 +01:00
2020-09-19 22:07:29 +02:00
" Keybindings: config
2020-05-08 16:11:55 +02:00
2020-09-19 22:07:29 +02:00
nnoremap <leader>ec :split $MYVIMRC<cr>
2020-05-08 16:11:55 +02:00
nnoremap <leader>so :so %<cr>
" Plugins ______________________________
2020-02-17 17:05:51 +01:00
2020-05-07 02:11:41 +02:00
call plug#begin()
2020-02-17 17:05:51 +01:00
2020-09-19 22:07:29 +02:00
" Plugins: General
Plug 'tpope/vim-commentary'
2020-09-19 22:07:29 +02:00
Plug 'takac/vim-hardtime'
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'
2020-09-06 00:10:10 +02:00
Plug 'axvr/zepl.vim'
2020-09-19 22:07:29 +02:00
" Plugins: Languages
2020-02-17 17:05:51 +01:00
2020-11-02 11:50:14 +01:00
" JS & 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'}
2020-11-02 11:50:14 +01:00
" Coc w/ extensions
2020-05-07 02:11:41 +02:00
Plug 'neoclide/coc.nvim', {'branch': 'release'}
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
\]
2020-11-02 11:54:10 +01:00
" Plugin: LaTeX
Plug 'lervag/vimtex'
" Plugin: TidalCycles
2020-03-19 14:28:07 +01:00
Plug 'supercollider/scvim'
Plug 'tidalcycles/vim-tidal'
2020-05-07 02:11:41 +02:00
2020-11-02 11:53:18 +01:00
" Plugin: Scheme
"
Plug 'jpalardy/vim-slime'
2020-02-16 09:45:55 +01:00
call plug#end()
2020-12-10 15:03:05 +01:00
" Plugin config ________________________
2020-09-19 22:07:29 +02:00
" Plugin: NERDCommenter
2020-02-16 09:45:55 +01:00
2020-03-19 14:28:07 +01:00
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
let NERDAltDelims_haskell = 1
let g:NERDCustomDelimiters = { 'tidal': { 'left': '{-','right': '-}' } }
let g:NERDCustomDelimiters = { 'tidal': { 'left': '--','right': '' } }
let g:NERDCommentEmptyLines = 1
2020-09-19 22:07:29 +02:00
" Plugin: fzf
" Popup
2020-05-07 02:11:41 +02:00
let g:fzf_layout = {'window': { 'width': 0.62, 'height': 0.62}}
2020-09-19 22:07:29 +02:00
" Use silversearcher-ag to respect .gitignore
2020-05-07 16:11:54 +02:00
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
2020-03-19 14:28:07 +01:00
let g:ag_working_path_mode="r"
2020-05-07 02:11:41 +02:00
set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip " fzf ignore
2020-02-16 13:37:24 +01:00
2020-09-19 22:07:29 +02:00
" Plugin: VimWiki
2020-08-06 16:36:57 +02:00
let g:vimwiki_list = [{'path': '~/.vimwiki/',
\ 'template_path': '~/.vimwiki/templates/',
\ 'template_default': 'default',
\ 'syntax': 'markdown', 'ext': '.md',
\ 'path_html': '~/.vimwiki/site_html/', 'custom_wiki2html': 'vimwiki_markdown',
\ 'html_filename_parameterization': 1,
\ 'template_ext': '.tpl'}]
2020-11-02 11:50:14 +01:00
" Plugin: JS & TypeScript
2020-09-19 22:07:29 +02:00
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-03-19 14:28:07 +01:00
2020-09-19 22:07:29 +02:00
" Plugin: Svelte
2020-05-13 19:08:38 +02:00
let g:svelte_indent_script = 0
let g:svelte_indent_style = 0
2020-09-19 22:07:29 +02:00
" Plugin: TidalCycles
2020-03-19 14:28:07 +01:00
" SuperCollider
2020-09-19 22:07:29 +02:00
2020-03-19 14:28:07 +01:00
au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd set filetype=supercollider
au Filetype supercollider packadd scvim
2020-09-19 22:07:29 +02:00
" TidalVim
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
2020-09-19 22:07:29 +02:00
" Plugin: Hardtime
2020-08-06 16:36:57 +02:00
let g:hardtime_default_on = 1
let g:hardtime_maxcount = 4
2020-11-02 11:53:18 +01:00
" Plugin: vim-slime
2020-11-02 18:06:59 +01:00
let g:slime_default_config={"socket_name": get(split($TMUX, ","), 0), "target_pane": '{last}'}
let g:slime_dont_ask_default = 1
2020-11-02 11:53:18 +01:00
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
2020-12-10 15:03:05 +01:00
" Plugin keybindings ___________________
2020-09-19 22:07:29 +02:00
" Plugin: fzf
nnoremap <c-p> :FZF<cr>
nnoremap <leader>p :FZF<cr>
nnoremap <leader>b :Buffers<cr>
nnoremap <leader>h :History<cr>
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\}
" Plugin: coc
" Autocompletion
2020-03-19 14:28:07 +01:00
2020-12-10 15:03:05 +01:00
inoremap <silent><expr><c-j> pumvisible() ? "\<c-n>" :
2020-08-06 16:36:57 +02:00
\ coc#refresh()
2020-12-10 15:03:05 +01:00
inoremap <expr><c-k> pumvisible() ? "\<C-p>" : "k"
inoremap <expr><cr> complete_info()["selected"] != "-1" ? "\<c-y>" : "\<c-g>u\<CR>"
2020-05-13 19:08:38 +02:00
2020-09-19 22:07:29 +02:00
" Code action on cursor position
2020-05-13 19:08:38 +02:00
nmap <leader>do <Plug>(coc-codeaction)
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" :Prettier command to prettify file
2020-09-19 22:07:29 +02:00
command! -nargs=0 Prettier :CocCommand prettier.formatFile
2020-02-16 12:41:12 +01:00
2020-11-02 11:54:10 +01:00
" Plugin: vimtex
let g:vimtex_view_method='zathura'
let g:tex_flavor = 'latex'
let g:tex_conceal='abdmg'
2020-12-10 15:03:05 +01:00
" Theme ________________________________
2020-02-16 12:41:12 +01:00
2020-08-06 16:36:57 +02:00
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