dots/.vimrc

228 lines
5.4 KiB
VimL
Raw Normal View History

2020-05-07 02:11:41 +02: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-05-07 02:11:41 +02:00
set timeout timeoutlen=1000 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-05-07 02:11:41 +02:00
set incsearch ignorecase smartcase hlsearch" search
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-02-17 17:05:51 +01:00
2020-05-07 02:11:41 +02:00
" functions ____________________________
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-05-07 02:11:41 +02:00
" keybindings __________________________
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-05-07 14:18:36 +02:00
" split
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-05-07 14:18:36 +02:00
" split navigate
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-05-07 14:18:36 +02:00
" split resize
2020-05-13 19:08:38 +02:00
nnoremap sH <C-w>8<
nnoremap sJ <C-w>8-
nnoremap sK <C-w>8+
nnoremap sL <C-w>8>
2020-02-17 17:05:51 +01:00
2020-05-07 14:18:36 +02:00
" file tree
2020-05-20 21:14:07 +02:00
nnoremap sb :Lex<cr>
" terminal
nnoremap <leader>t :term<cr>
2020-05-07 14:18:36 +02:00
2020-03-19 14:28:07 +01:00
" 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
" quick quit
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-05-07 02:11:41 +02:00
" quick exit insert
inoremap jj <esc>
2020-02-16 13:15:17 +01:00
2020-05-07 02:11:41 +02:00
" clear search highlight
nnoremap <leader><space> :noh<cr>
" silver search
nnoremap <leader>A :Ag <cr>
" toggle numbers
nnoremap <leader>n :call ToggleRnu()<cr>
2020-02-16 12:41:12 +01:00
2020-05-08 16:11:55 +02:00
" edit vim config
2020-08-06 16:36:57 +02:00
nnoremap <leader>ec :split $MYVIMRC<cr>
2020-05-08 16:11:55 +02:00
" source current file
nnoremap <leader>so :so %<cr>
2020-05-07 02:11:41 +02:00
" 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-05-07 02:11:41 +02:00
Plug 'preservim/nerdcommenter'
Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
2020-08-06 16:36:57 +02:00
Plug 'vimwiki/vimwiki', {'branch': 'dev'}
2020-02-17 17:05:51 +01:00
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'] }
2020-05-13 19:08:38 +02:00
Plug 'evanleck/vim-svelte'
2020-08-06 16:36:57 +02:00
Plug 'axvr/zepl.vim'
Plug 'takac/vim-hardtime'
2020-02-17 17:05:51 +01:00
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-03-19 14:28:07 +01:00
Plug 'supercollider/scvim'
Plug 'tidalcycles/vim-tidal'
2020-05-07 02:11:41 +02:00
2020-02-16 09:45:55 +01:00
call plug#end()
2020-05-07 02:11:41 +02:00
" plugin config ________________________
2020-02-16 09:45:55 +01:00
2020-08-06 16:36:57 +02:00
2020-03-19 14:28:07 +01:00
" NERDCommenter
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-05-07 02:11:41 +02:00
" fzf popup
let g:fzf_layout = {'window': { 'width': 0.62, 'height': 0.62}}
" fzf - 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-08-06 16:36:57 +02:00
" vimwiki
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-05-07 02:11:41 +02:00
" js & ts
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-05-13 19:08:38 +02:00
" svelte
let g:svelte_indent_script = 0
let g:svelte_indent_style = 0
2020-03-19 14:28:07 +01:00
" SuperCollider
au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd set filetype=supercollider
au Filetype supercollider packadd scvim
" 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-08-06 16:36:57 +02:00
" hard time
let g:hardtime_default_on = 1
let g:hardtime_maxcount = 4
2020-05-07 02:11:41 +02:00
" plugin keybindings ___________________
2020-03-19 14:28:07 +01:00
2020-05-13 19:08:38 +02:00
" coc autocompletion
2020-08-06 16:36:57 +02:00
inoremap <silent><expr><C-j> pumvisible() ? "\<C-n>" :
\ coc#refresh()
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
" code action on cursor position
nmap <leader>do <Plug>(coc-codeaction)
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" :Prettier command to prettify file
command! -nargs=0 Prettier :CocCommand prettier.formatFile
2020-05-07 02:11:41 +02:00
nnoremap <c-p> :FZF<cr>
2020-05-13 19:08:38 +02:00
nnoremap <leader>p :FZF<cr>
2020-05-07 02:11:41 +02:00
nnoremap <leader>b :Buffers<cr>
nnoremap <leader>h :History<cr>
2020-02-16 09:45:55 +01:00
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\}
2020-02-16 12:41:12 +01:00
2020-05-07 02:11:41 +02: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