dots/.vimrc

200 lines
4.7 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
set shortmess+=c
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-05-07 02:11:41 +02:00
set backspace=indent,eol,start " indentat
set incsearch ignorecase smartcase hlsearch" search
set autoindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab " indenting
set lazyredraw " only essential redraws
set synmaxcol=180
set nobackup nowb noswapfile " turn off backups
set viminfo='20,\"100 "max 100 lines in registers
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-07 16:11:54 +02:00
nnoremap sH <C-w><
nnoremap sJ <C-w>-
nnoremap sK <C-w>+
nnoremap sL <C-w>>
2020-02-17 17:05:51 +01:00
2020-05-07 14:18:36 +02:00
" file tree
nnoremap sb :Lex<CR>
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
nnoremap <leader>ec :vsplit $MYVIMRC<cr>
" source current file
nnoremap <leader>so :so %<cr>
2020-02-17 17:05:51 +01:00
" coc
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
2020-05-07 02:11:41 +02:00
noremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
2020-02-17 17:05:51 +01:00
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
2020-05-07 02:11:41 +02:00
" <c-space> triggers completion
2020-02-17 17:51:37 +01:00
inoremap <silent><expr> <c-@> coc#refresh()
2020-02-17 17:05:51 +01:00
2020-05-07 02:11:41 +02:00
" code action on cursor position
nmap <leader>do <Plug>(coc-codeaction)
2020-02-16 12:41:12 +01:00
2020-05-07 02:11:41 +02:00
" apply code action to selected region
" xmap <leader>a <Plug>(coc-codeaction-selected)
" nmap <leader>a <Plug>(coc-codeaction-selected)
2020-02-17 17:05:51 +01:00
2020-05-07 02:11:41 +02:00
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
2020-02-17 17:05:51 +01:00
2020-05-07 02:11:41 +02:00
" :Prettier command to prettify file
command! -nargs=0 Prettier :CocCommand prettier.formatFile
2020-02-17 17:05:51 +01:00
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-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-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-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-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-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 = "ƒ"
let g:javascript_conceal_return = "⇚""
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
" plugin keybindings ___________________
2020-03-19 14:28:07 +01:00
2020-05-07 02:11:41 +02:00
nnoremap <c-p> :FZF<cr>
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-04-15 15:10:46 +02:00
colorscheme darkness