From 89d02f8fc446660b5aa6db28dda50e7977b23d8f Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Sat, 19 Sep 2020 22:07:29 +0200 Subject: [PATCH] Organize vim config --- .vimrc | 129 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 46 deletions(-) diff --git a/.vimrc b/.vimrc index bbf4323..9547b2a 100644 --- a/.vimrc +++ b/.vimrc @@ -1,4 +1,4 @@ -" general config _______________________ +" General config _______________________ set nocompatible @@ -25,42 +25,52 @@ set novisualbell set conceallevel=1 set clipboard=unnamedplus -" functions ____________________________ +" Functions ____________________________ + +" Function: Toggle line numbers func! ToggleRnu() " toggle: no numbers - relative nummbers if(&nu) | set nonu nornu | else | set nu rnu | endif endfunc -" keybindings __________________________ +" Keybindings __________________________ + +" Keybindings: leader keys nnoremap let mapleader = " " let maplocalleader = ";" -" split +" Keybindings: splits + +" Split horizontal & vertical nmap ss :spw nmap sv :vsw -" split navigate +" Navigate splits nnoremap sw w nnoremap sh h nnoremap sj j nnoremap sk k nnoremap sl l -" split resize +" Resize splits nnoremap sH 8< nnoremap sJ 8- nnoremap sK 8+ nnoremap sL 8> -" file tree +" Keybindings: file tree + nnoremap sb :Lex -" terminal + +" Keybindings: terminal + nnoremap t :term -" hard mode +" Keybindings: hard mode + nnoremap nnoremap nnoremap @@ -70,47 +80,53 @@ inoremap inoremap inoremap -" quick quit +" Keybindings: quick quit + nnoremap w :w nnoremap W :wq nnoremap q :q nnoremap Q :q! -" quick exit insert +" Keybindings: exit insert mode + inoremap jj -" clear search highlight +" Keybindings: search + nnoremap :noh -" silver search +" Silver search nnoremap A :Ag -" toggle numbers +" Keybindings: line numbers + nnoremap n :call ToggleRnu() -" edit vim config -nnoremap ec :split $MYVIMRC +" Keybindings: config -" source current file +nnoremap ec :split $MYVIMRC nnoremap so :so % -" plugins ______________________________ +" Plugins ______________________________ call plug#begin() +" Plugins: General + Plug 'preservim/nerdcommenter' +Plug 'takac/vim-hardtime' +Plug 'machakann/vim-sandwich' Plug 'junegunn/fzf', { 'do': './install --bin' } Plug 'junegunn/fzf.vim' Plug 'vimwiki/vimwiki', {'branch': 'dev'} Plug 'axvr/zepl.vim' -Plug 'takac/vim-hardtime' -Plug 'machakann/vim-sandwich' + +" Plugins: Languages 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'} - Plug 'neoclide/coc.nvim', {'branch': 'release'} let g:coc_global_extensions = [ \'coc-eslint', @@ -128,14 +144,17 @@ let g:coc_global_extensions = [ \'coc-snippets' \] +" Plugin: TidalCycles + Plug 'supercollider/scvim' Plug 'tidalcycles/vim-tidal' call plug#end() -" plugin config ________________________ +" Plugin config ________________________ + +" Plugin: NERDCommenter -" NERDCommenter let g:NERDSpaceDelims = 1 let g:NERDCompactSexyComs = 1 let NERDAltDelims_haskell = 1 @@ -143,15 +162,20 @@ let g:NERDCustomDelimiters = { 'tidal': { 'left': '{-','right': '-}' } } let g:NERDCustomDelimiters = { 'tidal': { 'left': '--','right': '' } } let g:NERDCommentEmptyLines = 1 -" fzf popup +" Plugin: fzf + +" Popup + let g:fzf_layout = {'window': { 'width': 0.62, 'height': 0.62}} -" fzf - use silversearcher-ag to respect .gitignore +" Use silversearcher-ag to respect .gitignore + let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' let g:ag_working_path_mode="r" set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip " fzf ignore -" vimwiki +" Plugin: VimWiki + let g:vimwiki_list = [{'path': '~/.vimwiki/', \ 'template_path': '~/.vimwiki/templates/', \ 'template_default': 'default', @@ -160,43 +184,37 @@ let g:vimwiki_list = [{'path': '~/.vimwiki/', \ 'html_filename_parameterization': 1, \ 'template_ext': '.tpl'}] -" js & ts +" Pugin: JS & TypeScript + 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 = "⇖" -" svelte +" Plugin: Svelte + let g:svelte_indent_script = 0 let g:svelte_indent_style = 0 +" Plugin: TidalCycles + " SuperCollider + au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd set filetype=supercollider au Filetype supercollider packadd scvim -" tidalvim +" TidalVim + let g:tidal_default_config = {"socket_name": "default", "target_pane": "tidal:1.1"} -" hard time +" Plugin: Hardtime + let g:hardtime_default_on = 1 let g:hardtime_maxcount = 4 -" plugin keybindings ___________________ - -" coc autocompletion -inoremap pumvisible() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "k" -inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" - -" code action on cursor position -nmap do (coc-codeaction) - -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} - -" :Prettier command to prettify file -command! -nargs=0 Prettier :CocCommand prettier.formatFile +" Plugin keybindings ___________________ +" Plugin: fzf nnoremap :FZF nnoremap p :FZF nnoremap b :Buffers @@ -207,7 +225,26 @@ let g:fzf_action = { \ 'ctrl-v': 'vsplit' \} -" theme ________________________________ +" Plugin: coc + +" Autocompletion + +inoremap pumvisible() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "k" +inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" + +" Code action on cursor position + +nmap do (coc-codeaction) + +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + +" :Prettier command to prettify file + +command! -nargs=0 Prettier :CocCommand prettier.formatFile + +" Theme ________________________________ colorscheme simple-dark