diff --git a/.vimrc b/.vimrc index b90f45f..07b2dd6 100644 --- a/.vimrc +++ b/.vimrc @@ -1,10 +1,12 @@ -"" General +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" General +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set termguicolors set nocompatible filetype off -"" Allow to switch buffer without saving -set hidden "" Mapping leader to space let mapleader = ' ' @@ -13,14 +15,22 @@ let mapleader = ' ' " set clipboard=unamedplus + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Plugins +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + "" Vim-Plug Configuration call plug#begin('~/.vim/plugged') "" Utilities " NerdTree -Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } -map :NERDTreeToggle +" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } +" map :NERDTreeToggle " Auto Pair " Plug 'jiangmiao/auto-pairs' @@ -28,13 +38,7 @@ map :NERDTreeToggle " Vim Surround Plug 'tpope/vim-surround' -" CtrlP -" Plug 'ctrlpvim/ctrlp.vim' -" let g:ctrlp_map = '' -" let g:ctrlp_cmd = 'CtrlP' -" let g:ctrlp_custom_ignore = 'node_modules\|git' - -" RipGrep Support +" RipGrep Plug 'jremmen/vim-ripgrep' " FZF Vim Support @@ -65,11 +69,7 @@ set noshowmode " \ } -" Plug 'Valloric/YouCompleteMe' -" let g:ycm_autoclose_preview_window_after_completion = 1 -" let g:ycm_autoclose_preview_window_after_insertion = 1 " Plug 'neoclide/coc.nvim', { 'do': { -> coc#util#install() } } - Plug 'neoclide/coc.nvim', { 'branch': 'release' } let g:coc_global_extensions = [ \ 'coc-snippets', @@ -101,27 +101,46 @@ let g:coc_snippet_prev = '' " Use for both expand and jump (make expand higher priority.) imap (coc-snippets-expand-jump) +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + " Mapping {j,k} for error jumping nmap j (coc-diagnostic-next-error) nmap k (coc-diagnostic-prev-error) +" nmap gd :call CocActionAsync('jumpDefinition', 'tab drop') +nmap gd (coc-definition) +nmap gr (coc-references) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) + +" Use K to show documentation in preview window. +" nmap K :call CocActionAsync('doHover') +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('') + endif +endfunction + +nmap rn (coc-rename) +" Applying codeAction to the selected region. +" Example: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) " inoremap " \ pumvisible() ? "\" : " \ check_back_space() ? "\" : " \ coc#refresh() - -"" Deoplete -" if has('nvim') -" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -" else -" Plug 'Shougo/deoplete.nvim' -" Plug 'roxma/nvim-yarp' -" Plug 'roxma/vim-hug-neovim-rpc' -" endif -" let g:deoplete#enable_at_startup = 1 - inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" @@ -192,21 +211,55 @@ Plug 'morhetz/gruvbox' call plug#end() + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Syntax Highlighting, Numbers, Linebreaks +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + " Syntax Highlighting syntax enable - " Enable filetype plugins filetype plugin indent on -"" Color Scheme +set number relativenumber +set linebreak +set showmatch +set nowrap + + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Color Scheme +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + " colorscheme codedark colorscheme dracula -" colorscheme OceanicNextDark " colorscheme gruvbox +" colorscheme OceanicNextDark set guicursor= + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Buffer, Args +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +"" Allow to switch buffer without saving +set hidden + set wildignorecase set wildmenu + " ignore these directories from find set wildignore+=**/node_modules/**,**/dist/**,**/tmp/**,**/target/** @@ -214,22 +267,45 @@ set wildignore+=**/node_modules/**,**/dist/**,**/tmp/**,**/target/** set path=.,** -"" netrw settings + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Netrw Configuration +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + let g:netrw_banner=0 " Disable netrw banner let g:netrw_liststyle=3 " Tree style -" set number -" set number -set number relativenumber -set linebreak -set showmatch -set nowrap + + + + + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Search Configuration +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set smartcase set ignorecase set hlsearch set incsearch + + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Indentation Configuration +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set autoindent set smartindent set cinoptions=l1 @@ -241,10 +317,22 @@ set tabstop=2 set noexpandtab -"" Advanced + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Additional Configuration +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + " set splitbelow set ruler + set lazyredraw +set updatetime=300 + +" Enable mouse support +set mouse=a " Use undofile set undofile @@ -263,28 +351,47 @@ set cursorline " enable all Python syntax highlighting features let python_highlight_all=1 -"" Key Mapping -"" Coc.nvim Configuration -nmap gd (coc-definition) -"nmap gd :call CocActionAsync('jumpDefinition', 'tab drop') -nmap gr (coc-references) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap K :call CocActionAsync('doHover') -nmap rn (coc-rename) -" coc-prettier settings to add :Prettier + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Key Mapping +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Command Mapping +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" Add `:Prettier` command to run prettier on current file +" Note: Requires `coc-prettier` command! -nargs=0 Prettier :CocCommand prettier.formatFile -" coc-eslint +" Add `:Eslint` command to execute eslint autofix on current file +" Note: Requires `coc-eslint` command! -nargs=0 Eslint :CocCommand eslint.executeAutofix -set updatetime=300 +" Add `:Format` command to format current buffer. +command! -nargs=0 Format :call CocAction('format') -set mouse=a +" Add `:Fold` command to fold current buffer. +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:Ogranize` command for organize imports of the current buffer. +command! -nargs=0 Organize :call CocAction('runCommand', 'editor.action.organizeImport') -"" Custom variables +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" Custom Variables +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let $MYVIMRC = '~/.vimrc'