From 924906a13fe1e7078fd59f3036c581f6a3137ac4 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Thu, 7 May 2020 00:11:41 +0000 Subject: [PATCH] Update vim config --- .vimrc | 252 ++++++++++++++++++++++++--------------------------------- 1 file changed, 106 insertions(+), 146 deletions(-) diff --git a/.vimrc b/.vimrc index ab7163d..385caf0 100644 --- a/.vimrc +++ b/.vimrc @@ -1,188 +1,142 @@ -" -" General config -" ______________________________ +" general config _______________________ set nocompatible + filetype plugin indent on set encoding=utf-8 set hidden set ttyfast set updatetime=300 -set timeout timeoutlen=1000 ttimeoutlen=50 +set timeout timeoutlen=1000 ttimeoutlen=5 set undolevels=500 set history=500 set shortmess+=c -" set signcolumn=yes +set signcolumn=number " make sign replace number set nowrap -set nu rnu " hybrid line numbers -set clipboard=unnamedplus "use p to paste clipboard - -" indentation -set backspace=indent,eol,start - -set incsearch ignorecase smartcase hlsearch -set autoindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab -set emoji - -" no backups -set nocursorcolumn -set nocursorline -set scrolljump=5 -set lazyredraw +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 -set nowritebackup -set noswapfile +set nobackup nowb noswapfile " turn off backups set viminfo='20,\"100 "max 100 lines in registers - -set cmdheight=2 set novisualbell +set conceallevel=1 +set clipboard=unnamedplus -" -" Keybindings -" ______________________________ +" functions ____________________________ -" split navigation -nnoremap -nnoremap -nnoremap -nnoremap +func! ToggleRnu() " toggle: no numbers - relative nummbers + if(&nu) | set nonu nornu | else | set nu rnu | endif +endfunc -" leader key +" keybindings __________________________ + +nnoremap let mapleader = " " +" splits +nmap ss :spw +nmap sv :vsw + +" split navigation +nnoremap sj j +nnoremap sk k +nnoremap sl l +nnoremap sh h + +" split resizing +nnoremap srh < +nnoremap srl > +nnoremap srk + +nnoremap srj - + " hard mode -map -map -map -map +map +map +map +map -" quick-quit -:ca Q q -:ca Q! q! +" quick quit +nnoremap w :w +nnoremap q :q -" quick help -:ca htab :tab h +" quick exit insert +inoremap +inoremap jj + +" clear search highlight +nnoremap :noh + +" silver search +nnoremap A :Ag + +" toggle numbers +nnoremap n :call ToggleRnu() " coc inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() - inoremap pumvisible() ? "\" : "\" + +noremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction -" use @ instead of space +" triggers completion inoremap coc#refresh() -if has('patch8.1.1068') - inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" -else - imap pumvisible() ? "\" : "\u\" -endif +" code action on cursor position +nmap do (coc-codeaction) -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -autocmd CursorHold * silent call CocActionAsync('highlight') - -"nmap rn (coc-rename) - -"xmap f (coc-format-selected) -"nmap f (coc-format-selected) - -augroup mygroup - autocmd! - autocmd FileType typescript, json setl formatexpr=CocAction('formatSelected') - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -"xmap a (coc-codeaction-selected) -"nmap a (coc-codeaction-selected) - -"nmap ac (coc-codeaction) -"nmap qf (coc-fix-current) - -"xmap if (coc-funcobj-i) -"xmap af (coc-funcobj-a) -"omap if (coc-funcobj-i) -"omap af (coc-funcobj-a) - -"nmap (coc-range-select) -"xmap (coc-range-select) - -command! -nargs=0 Format :call CocAction('format') -command! -nargs=? Fold :call CocAction('fold', ) -command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') +" apply code action to selected region +" xmap a (coc-codeaction-selected) +" nmap a (coc-codeaction-selected) set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} -"nnoremap a :CocList diagnostics -"nnoremap e :CocList extensions -"nnoremap c :CocList commands -"nnoremap o :CocList outline -"nnoremap s :CocList -I symbols -"nnoremap j :CocNext -"nnoremap k :CocPrev -"nnoremap p :CocListResume - -let g:coc_global_extensions = [ - \'coc-css', - \'coc-eslint', - \'coc-html', - \'coc-json', - \'coc-prettier', - \'coc-svelte', - \'coc-tsserver', - \'coc-emmet' - \] - +" :Prettier command to prettify file command! -nargs=0 Prettier :CocCommand prettier.formatFile -" -" Plugins -" ______________________________ +" plugins ______________________________ call plug#begin() -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'scrooloose/nerdtree' -Plug 'yuezk/vim-js' -Plug 'maxmellon/vim-jsx-pretty' -Plug 'ryanoasis/vim-devicons' + +Plug 'preservim/nerdcommenter' Plug 'junegunn/fzf', { 'do': './install --bin' } Plug 'junegunn/fzf.vim' -Plug 'leafgarland/typescript-vim' -Plug 'peitalin/vim-jsx-typescript' + +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 'neoclide/coc.nvim', {'branch': 'release'} +let g:coc_global_extensions = [ + \'coc-eslint', + \'coc-prettier', + \'coc-tsserver', + \'coc-python', + \'coc-html', + \'coc-emmet', + \'coc-css', + \'coc-svg', + \'coc-svelte', + \'coc-json', + \'coc-markdownlint', + \'coc-yaml', + \] + Plug 'supercollider/scvim' Plug 'tidalcycles/vim-tidal' -Plug 'preservim/nerdcommenter' + call plug#end() -" NERDTree -let g:NERDTreeShowHidden = 1 -let g:NERDTreeMinimalUI = 1 -let g:NERDTreeIgnore = [] -let g:NERDTreeStatusline = '' +" plugin config ________________________ " NERDCommenter let g:NERDSpaceDelims = 1 @@ -192,33 +146,39 @@ let g:NERDCustomDelimiters = { 'tidal': { 'left': '{-','right': '-}' } } let g:NERDCustomDelimiters = { 'tidal': { 'left': '--','right': '' } } let g:NERDCommentEmptyLines = 1 -" FZF - use silversearcher-ag to respect .gitignore +" fzf popup +let g:fzf_layout = {'window': { 'width': 0.62, 'height': 0.62}} + +" fzf - use silversearcher-ag to respect .gitignore let $FZF_DEFAULT_COMMAND = 'ag -g ""' let g:ag_working_path_mode="r" -let g:vim_jsx_pretty_colorful_config = 1 +set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip " fzf ignore -" FZF ignore -set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip +" 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 = "⇚"" " SuperCollider au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd set filetype=supercollider au Filetype supercollider packadd scvim " tidalvim -let g:tidal_flash_duration = 50 +let g:tidal_flash_duration = 50 -" plugin keybindings -nnoremap :NERDTreeToggle -nnoremap :FZF +" plugin keybindings ___________________ + +nnoremap :Lex +nnoremap :FZF +nnoremap b :Buffers +nnoremap h :History let g:fzf_action = { \ 'ctrl-t': 'tab split', \ 'ctrl-s': 'split', \ 'ctrl-v': 'vsplit' \} -" -" Theme -" ______________________________ +" theme ________________________________ colorscheme darkness -