From 3b42799780ef362e7cceed601cf53c6b182bbc4a Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Sat, 31 Jul 2021 22:34:11 +0530 Subject: [PATCH 01/14] [COC|Git Fugitive] improve overall setup + seperate file for coc plugin + add git-fugitive plugin + improve yanking experience + python snippet for docstring --- nvim/coc-settings.json | 11 ++ nvim/general/general.vim | 35 ++++- nvim/general/keybindings.vim | 21 +++ nvim/general/leader.vim | 3 + nvim/init.vim | 7 +- nvim/plugs/coc.vim | 244 +++++++++++++++++++++++++++++++++ nvim/plugs/plugins.vim | 165 +++++++--------------- nvim/ultisnips/python.snippets | 11 ++ 8 files changed, 377 insertions(+), 120 deletions(-) create mode 100644 nvim/coc-settings.json create mode 100644 nvim/plugs/coc.vim create mode 100644 nvim/ultisnips/python.snippets diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json new file mode 100644 index 0000000..c7625dc --- /dev/null +++ b/nvim/coc-settings.json @@ -0,0 +1,11 @@ +{ + "coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "javascript", "graphql", "html", "yaml", "json", "python"], + + // python config + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + + "diagnostic.checkCurrentLine": true, + "jedi.hover.enable": true, +"hover.target": "float" +} diff --git a/nvim/general/general.vim b/nvim/general/general.vim index a9ca9c5..74a5eba 100644 --- a/nvim/general/general.vim +++ b/nvim/general/general.vim @@ -1,18 +1,22 @@ "General Settings +set mouse=a " CLIPBOARD ----- {{{ "vim clipboard and system clipboard same now set clipboard^=unnamed " }}} -" MODES ----- {{{ -"use jk in insert mode to switch to normal mode -imap jk -" }}} " EDITOR ----- {{{ syntax on +set ignorecase +set smartcase +" use 4 spaces for tabs +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 set number relativenumber " }}} +" " SEARCHING ----- {{{ set nohlsearch @@ -58,3 +62,26 @@ set wildignore+=**/android/* set wildignore+=**/ios/* set wildignore+=**/.git/* " }}} + +" coc needs it----- {{{ +" Set internal encoding of vim, not needed on neovim, since coc.nvim using some +" unicode characters in the file autoload/float.vim +set encoding=utf-8 + +" TextEdit might fail if hidden is not set. +set hidden + +" Some servers have issues with backup files, see #649. +set nobackup +set nowritebackup + +" Give more space for displaying messages. +set cmdheight=2 + +" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable +" delays and poor user experience. +set updatetime=300 + +" Don't pass messages to |ins-completion-menu|. +set shortmess+=c +" }}} diff --git a/nvim/general/keybindings.vim b/nvim/general/keybindings.vim index e69de29..bca8b3e 100644 --- a/nvim/general/keybindings.vim +++ b/nvim/general/keybindings.vim @@ -0,0 +1,21 @@ +" MODES ----- {{{ +"use jk in insert mode to switch to normal mode +inoremap jk +" }}} + +" yanking ----- {{{ +nnoremap Y y$ "to match the behaviour of 'C' and 'D' +"highlight the yanked area for an extened period +augroup highlight_yank + autocmd! + au TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=300} +augroup END +" }}} + +"https://vim.fandom.com/wiki/Moving_lines_up_or_down +nnoremap :m .+1== +nnoremap :m .-2== +inoremap :m .+1==gi +inoremap :m .-2==gi +vnoremap :m '>+1gv=gv +vnoremap :m '<-2gv=gv diff --git a/nvim/general/leader.vim b/nvim/general/leader.vim index 0ff1fe5..538c649 100644 --- a/nvim/general/leader.vim +++ b/nvim/general/leader.vim @@ -4,5 +4,8 @@ let mapleader = "\" " source vim file nmap sv :source $LOCALAPPDATA/nvim/init.vim nmap so :e $LOCALAPPDATA/nvim/init.vim +nnoremap n :bnext +nnoremap p :bprev +nnoremap b :buffers "nmap ws : diff --git a/nvim/init.vim b/nvim/init.vim index 05e2607..4ce4da4 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,5 +1,10 @@ +source $LOCALAPPDATA/nvim/plugs/plugins.vim +source $LOCALAPPDATA/nvim/plugs/coc.vim source $LOCALAPPDATA/nvim/general/general.vim source $LOCALAPPDATA/nvim/general/leader.vim source $LOCALAPPDATA/nvim/general/keybindings.vim -source $LOCALAPPDATA/nvim/plugs/plugins.vim source $LOCALAPPDATA/nvim/languages/languages.vim +set path+=* +hi Normal ctermbg=none guibg=none +"wrap backspace +set backspace=indent,eol,start diff --git a/nvim/plugs/coc.vim b/nvim/plugs/coc.vim new file mode 100644 index 0000000..1139755 --- /dev/null +++ b/nvim/plugs/coc.vim @@ -0,0 +1,244 @@ +" coc ----- {{{ +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved. +if has("nvim-0.5.0") || has("patch-8.1.1564") + " Recently vim can merge signcolumn and number column into one + set signcolumn=number +else + set signcolumn=yes +endif + +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" Make auto-select the first completion item and notify coc.nvim to +" format on enter, could be remapped by other vim plugin +inoremap pumvisible() ? coc#_select_confirm() + \: "\u\\=coc#on_enter()\" + +let g:coc_snippet_next = '' "tab to go to first suggestion + + +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window. +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 + +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming. +nmap rn (coc-rename) + +" Formatting selected code. +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder. + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Applying codeAction to the selected region. +" Example: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap keys for applying codeAction to the current buffer. +nmap ac (coc-codeaction) +" Apply AutoFix to problem on the current line. +nmap qf (coc-fix-current) + +" Remap and for scroll float windows/popups. +" if has('nvim-0.4.0') || has('patch-8.2.0750') + " nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + " nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + " inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + " inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + " vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + " vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" +" endif + +" Use CTRL-S for selections ranges. +" Requires 'textDocument/selectionRange' support of language server. +nmap (coc-range-select) +xmap (coc-range-select) + +" Add `:Format` command to format current buffer. +command! -nargs=0 Format :call CocAction('format') + +" Add `:Fold` command to fold current buffer. +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:OR` command for organize imports of the current buffer. +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') + +" Add (Neo)Vim's native statusline support. +" NOTE: Please see `:h coc-status` for integrations with external plugins that +" provide custom statusline: lightline.vim, vim-airline. +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + +" " Mappings for CoCList +" " Show all diagnostics. +" nnoremap a :CocList diagnostics +" " Manage extensions. +" nnoremap e :CocList extensions +" " Show commands. +" nnoremap c :CocList commands +" " Find symbol of current document. +" nnoremap o :CocList outline +" " Search workspace symbols. +" nnoremap s :CocList -I symbols +" " Do default action for next item. +" nnoremap j :CocNext +" " Do default action for previous item. +" nnoremap k :CocPrev +" " Resume latest coc list. +" nnoremap p :CocListResume +" + +" }}} + +" COC archieved----- {{{ +" COC extension +" let g:coc_user_config = {} +" let g:coc_global_extensions = [ + " \ 'coc-emmet', + " \ 'coc-css', + " \ 'coc-html', + " \ 'coc-json', + " \ 'coc-prettier', + " \ 'coc-tsserver', + " \ 'coc-snippets', + " \ 'coc-eslint'] +" " " To go back to previous state use Ctrl+O +" nmap gd (coc-definition) +" nmap gy (coc-type-definition) +" nmap gi (coc-implementation) +" nmap gr (coc-references) +" +" function! s:check_back_space() abort + " let col = col('.') - 1 + " return !col || getline('.')[col - 1] =~# '\s' +" endfunction +" +" inoremap + " \ pumvisible() ? "\" : + " \ check_back_space() ? "\" : + " \ coc#refresh() +" " https://stackoverflow.com/questions/63337283/how-to-select-first-item-in-popup-menu-and-close-menu-in-a-single-keybind-for-au +" " inoremap + " " \ pumvisible() ? coc#_select_confirm() : + " " \ coc#expandableOrJumpable() ? + " " \ "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : + " " \ check_back_space() ? "\" : + " " \ coc#refresh() +" +" let g:coc_snippet_next = '' +" inoremap pumvisible() ? "\" : "\" +" + " +" " " Always show the signcolumn, otherwise it would shift the text each time +" " " diagnostics appear/become resolved. +" if has("patch-8.1.1564") + " " " Recently vim can merge signcolumn and number column into one + " set signcolumn=number +" else + " set signcolumn=yes +" endif +" +" " " Use to trigger completion. +" inoremap coc#refresh() +" +" " " Use to confirm completion, `u` means break undo chain at current +" " " position. Coc only does snippet and additional edit on confirm. +" " " could be remapped by other vim plugin, try `:verbose imap `. +" if exists('*complete_info') + " inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" +" else + " inoremap pumvisible() ? "\" : "\u\" +" endif +" +" " " Highlight the symbol and its references when holding the cursor. +" autocmd CursorHold * silent call CocActionAsync('highlight') +" +" " " Symbol renaming. +" nmap rn (coc-rename) +" +" " " Formatting selected code. +" map f (coc-format-selected) +" nmap f (coc-format-selected +" +" augroup mygroup + " autocmd! + " " " Setup formatexpr specified filetype(s). + " autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " " " Update signature help on jump placeholder. + " autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +" augroup end +" +" " " Applying codeAction to the selected region. +" " " Example: `aap` for current paragraph +" xmap a (coc-codeaction-selected) +" nmap a (coc-codeaction-selected) +" +" " " Remap keys for applying codeAction to the current buffer. +" nmap ac (coc-codeaction) +" " " Apply AutoFix to problem on the current line. +" nmap qf (coc-fix-current) +" +" " " Add `:Format` command to format current buffer. +" command! -nargs=0 Format :call CocAction('format') +" +" " " Add `:Fold` command to fold current buffer. +" command! -nargs=? Fold :call CocAction('fold', ) +" +" " " Add `:OR` command for organize imports of the current buffer. +" command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') +" +" " " Add (Neo)Vim's native statusline support. +" " " NOTE: Please see `:h coc-status` for integrations with external plugins that +" " " provide custom statusline: lightline.vim, vim-airline. +" "set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} +" function! CocCurrentFunction() + " return get(b:, 'coc_current_function', '') +" endfunction +" + +" }}} + diff --git a/nvim/plugs/plugins.vim b/nvim/plugs/plugins.vim index 3a5001f..e5af083 100644 --- a/nvim/plugs/plugins.vim +++ b/nvim/plugs/plugins.vim @@ -4,7 +4,7 @@ Plug 'morhetz/gruvbox' Plug 'preservim/nerdtree' Plug 'tiagofumo/vim-nerdtree-syntax-highlight' -Plug 'Xuyuanp/nerdtree-git-plugin' +Plug 'tpope/vim-fugitive' Plug 'ryanoasis/vim-devicons' " Track the engine. @@ -12,8 +12,8 @@ Plug 'SirVer/ultisnips' " Snippets are separated from the engine. Add this if you want them: Plug 'honza/vim-snippets' -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } -Plug 'junegunn/fzf.vim' +"Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +"Plug 'junegunn/fzf.vim' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'w0rp/ale' @@ -33,8 +33,8 @@ call plug#end() " UltiSnips ----- {{{ " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. let g:UltiSnipsExpandTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsJumpBackwardTrigger="" +"let g:UltiSnipsJumpForwardTrigger="" +"let g:UltiSnipsJumpBackwardTrigger="" " }}} " gruvbox ----- {{{ @@ -100,7 +100,7 @@ let g:WebDevIconsDefaultFolderSymbolColor = s:beige let g:WebDevIconsDefaultFileSymbolColor = s:blue " NERDTree Git Plugin -let g:NERDTreeIndicatorMapCustom = { +let g:NERDTreeGitStatusIndicatorMapCustom = { \ "Modified" : "✹", \ "Staged" : "✚", \ "Untracked" : "✭", @@ -114,26 +114,20 @@ let g:NERDTreeIndicatorMapCustom = { \ } " }}} -" fzf ----- {{{ -" put search prompt at the top -let $FZF_DEFAULT_OPTS ='--reverse' -nnoremap :Files -let g:fzf_action = { - \ 'ctrl-t': 'tab split', - \ 'ctrl-s': 'split', - \ 'ctrl-v': 'vsplit' - \} +" SUPPRESS WARNINGS ----- {{{ +"autocmd VimEnter * unlet g:NERDTreeUpdateOnCursorHold +"autocmd VimEnter * unlet g:NERDTreeIndicatorMapCustom " }}} -" lightline ----- {{{ -" Lightline -let g:lightline = { - \ 'colorscheme': 'powerlineish', - \ 'active': { - \ 'left': [['mode', 'paste' ], ['readonly', 'filename', 'modified']], - \ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding']] - \ } - \ } +" fzf ----- {{{ +" put search prompt at the top +" let $FZF_DEFAULT_OPTS ='--reverse' +" nnoremap :Files +" let g:fzf_action = { + " \ 'ctrl-t': 'tab split', + " \ 'ctrl-s': 'split', + " \ 'ctrl-v': 'vsplit' + " \} " }}} " Nerd Commenter ----- {{{ @@ -164,96 +158,37 @@ let g:ale_fix_on_save = 1 " }}} -" COC ----- {{{ -" COC extension -let g:coc_user_config = {} -let g:coc_global_extensions = [ - \ 'coc-emmet', - \ 'coc-css', - \ 'coc-html', - \ 'coc-json', - \ 'coc-prettier', - \ 'coc-tsserver', - \ 'coc-snippets', - \ 'coc-eslint'] -" " To go back to previous state use Ctrl+O -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" " Always show the signcolumn, otherwise it would shift the text each time -" " diagnostics appear/become resolved. -if has("patch-8.1.1564") - " " Recently vim can merge signcolumn and number column into one - set signcolumn=number -else - set signcolumn=yes -endif - -" " Use to trigger completion. -inoremap coc#refresh() - -" " Use to confirm completion, `u` means break undo chain at current -" " position. Coc only does snippet and additional edit on confirm. -" " could be remapped by other vim plugin, try `:verbose imap `. -if exists('*complete_info') - inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" -else - inoremap pumvisible() ? "\" : "\u\" -endif - -" " Highlight the symbol and its references when holding the cursor. -autocmd CursorHold * silent call CocActionAsync('highlight') - -" " Symbol renaming. -nmap rn (coc-rename) - -" " Formatting selected code. -xmap f (coc-format-selected) -nmap f (coc-format-selected - -augroup mygroup - autocmd! - " " Setup formatexpr specified filetype(s). - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " " Update signature help on jump placeholder. - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" " Applying codeAction to the selected region. -" " Example: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" " Remap keys for applying codeAction to the current buffer. -nmap ac (coc-codeaction) -" " Apply AutoFix to problem on the current line. -nmap qf (coc-fix-current) - -" " Add `:Format` command to format current buffer. -command! -nargs=0 Format :call CocAction('format') - -" " Add `:Fold` command to fold current buffer. -command! -nargs=? Fold :call CocAction('fold', ) - -" " Add `:OR` command for organize imports of the current buffer. -command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') - -" " Add (Neo)Vim's native statusline support. -" " NOTE: Please see `:h coc-status` for integrations with external plugins that -" " provide custom statusline: lightline.vim, vim-airline. -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} +" lightline ----- {{{ +" Lightline +"let g:lightline = { + ""\ 'colorscheme': 'powerlineish', + ""\ 'active': { + ""\ 'left': [['mode', 'paste' ], ['readonly', 'filename', 'modified']], + ""\ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding']] + \ } + \ } +let g:lightline = { + \ 'colorscheme': 'powerlineish', + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ],['readonly', 'filename', 'modified']], + \ 'right' : [['cocstatus', 'currentfunction'],['lineinfo'], ['percent'], ['fileformat', 'fileencoding']] + \ }, + \ 'component_function': { + \ 'cocstatus': 'coc#status', + \ 'currentfunction': 'CocCurrentFunction' + \ } + \ } " }}} +" +" vim-startify ----- {{{ +"let g:startify_custom_header += [ + ""\'████████╗██████╗ ██████╗ ', + ""\'╚══██╔══╝██╔══██╗██╔══██╗', + ""\' ██║ ██████╔╝██████╔╝', + "" \' ██║ ██╔═══╝ ██╔═══╝ ', + """"\' ██║ ██║ ██║ ', + ""\' ╚═╝ ╚═╝ ╚═╝ ', + ""\] + ""\ startify#pad(split(system('figlet -w 100 TPP'), \n)) +" }}} diff --git a/nvim/ultisnips/python.snippets b/nvim/ultisnips/python.snippets new file mode 100644 index 0000000..a6f8219 --- /dev/null +++ b/nvim/ultisnips/python.snippets @@ -0,0 +1,11 @@ +snippet "fndoc" "Python Function Docstring" b +""" ${1:function description} + + Args: + ${2:param}: param description + + Returns: + ${3:return type} +""" + +endsnippet From 34f0ac2e3e8bfa01d5ee6ce726a63e88bcb1b61e Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Tue, 10 Aug 2021 20:21:56 +0530 Subject: [PATCH 02/14] [FEAT] add leader mappings,cpp related,statusline + Leader mappings : movements between windows + Language : cpp file run + lightline : show filetype + remove `set path+=*` --- nvim/coc-settings.json | 19 ++++- nvim/general/general.vim | 9 +++ nvim/general/keybindings.vim | 17 +++- nvim/general/leader.vim | 12 ++- nvim/init.vim | 5 +- nvim/languages/languages.vim | 8 ++ nvim/plugs/coc.vim | 153 ++--------------------------------- nvim/plugs/plugins.vim | 17 ++-- 8 files changed, 79 insertions(+), 161 deletions(-) diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json index c7625dc..a36455b 100644 --- a/nvim/coc-settings.json +++ b/nvim/coc-settings.json @@ -1,11 +1,22 @@ { - "coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "javascript", "graphql", "html", "yaml", "json", "python"], + "coc.preferences.formatOnSaveFiletypes": [ + "css", + "markdown", + "javascript", + "graphql", + "html", + "yaml", + "json", + "python" + ], // python config "python.linting.enabled": true, "python.linting.pylintEnabled": true, - "diagnostic.checkCurrentLine": true, - "jedi.hover.enable": true, -"hover.target": "float" + "diagnostic.checkCurrentLine": true, + //"diagnostic.enableMessage": "jump", + "jedi.hover.enable": true, + "hover.target": "float", + "clangd.path": "C:\\Users\\Prashanth T P\\AppData\\Local\\coc\\extensions\\coc-clangd-data\\install\\12.0.1\\clangd_12.0.1\\bin\\clangd.exe" } diff --git a/nvim/general/general.vim b/nvim/general/general.vim index 74a5eba..d7b88fb 100644 --- a/nvim/general/general.vim +++ b/nvim/general/general.vim @@ -3,6 +3,7 @@ set mouse=a " CLIPBOARD ----- {{{ "vim clipboard and system clipboard same now set clipboard^=unnamed +set autochdir " }}} @@ -15,6 +16,9 @@ set tabstop=4 set softtabstop=4 set shiftwidth=4 set number relativenumber +" Show white spaces https://gist.github.com/jdavid82/d40f40e6f124aad6223eba0ff0c7ad65#file-vimrc-L37-L39 +"set listchars=tab:>·,trail:~,extends:>,precedes:<,space:· +"set list " }}} " @@ -85,3 +89,8 @@ set updatetime=300 " Don't pass messages to |ins-completion-menu|. set shortmess+=c " }}} +" " show tabline +" set showtabline=2 +" if has('gui_running') + " set guioptions-=e +" endif diff --git a/nvim/general/keybindings.vim b/nvim/general/keybindings.vim index bca8b3e..9d82e32 100644 --- a/nvim/general/keybindings.vim +++ b/nvim/general/keybindings.vim @@ -4,7 +4,8 @@ inoremap jk " }}} " yanking ----- {{{ -nnoremap Y y$ "to match the behaviour of 'C' and 'D' +"to match the behaviour of 'C' and 'D' +nnoremap Y y$ "highlight the yanked area for an extened period augroup highlight_yank autocmd! @@ -12,6 +13,20 @@ augroup highlight_yank augroup END " }}} +" the primeagen : top 5 keybindings ----- {{{ +"put the cursor at screen center while going to next search result +nnoremap n nzz +nnoremap N Nzz +"puts the next line at the end of current line : mz = create a mark called z , do J, `z = goto mark z +nnoremap J mzJ`z +"undo breakpoints +inoremap . .u +inoremap , ,u +inoremap ! !u +inoremap ? ?u + +" }}} + "https://vim.fandom.com/wiki/Moving_lines_up_or_down nnoremap :m .+1== nnoremap :m .-2== diff --git a/nvim/general/leader.vim b/nvim/general/leader.vim index 538c649..5f8933a 100644 --- a/nvim/general/leader.vim +++ b/nvim/general/leader.vim @@ -1,11 +1,15 @@ - -let mapleader = "\" - +" Mappings with leader key " source vim file nmap sv :source $LOCALAPPDATA/nvim/init.vim -nmap so :e $LOCALAPPDATA/nvim/init.vim +nmap so :vsplit :e $LOCALAPPDATA/nvim/init.vim nnoremap n :bnext nnoremap p :bprev nnoremap b :buffers +nnoremap w w +nnoremap h h +nnoremap l l +nnoremap j j +nnoremap k k + "nmap ws : diff --git a/nvim/init.vim b/nvim/init.vim index 4ce4da4..e0fbd54 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,10 +1,13 @@ +let mapleader = "\" + source $LOCALAPPDATA/nvim/plugs/plugins.vim source $LOCALAPPDATA/nvim/plugs/coc.vim source $LOCALAPPDATA/nvim/general/general.vim source $LOCALAPPDATA/nvim/general/leader.vim source $LOCALAPPDATA/nvim/general/keybindings.vim source $LOCALAPPDATA/nvim/languages/languages.vim -set path+=* +"set path+=* hi Normal ctermbg=none guibg=none "wrap backspace set backspace=indent,eol,start + diff --git a/nvim/languages/languages.vim b/nvim/languages/languages.vim index f2885f9..791781f 100644 --- a/nvim/languages/languages.vim +++ b/nvim/languages/languages.vim @@ -1 +1,9 @@ +" python ----- {{{ let g:python3_host_prog = "$PYTHON_HOME/Python/python.exe" +" }}} +" cpp ----- {{{ +"autocmd vimEnter *.cpp map :w :!clear ; g++ --std=c++17 %; if [ -f a.out ]; then time ./a.out; rm a.out; fi +"map :!g++ % -o %:r && \./%:r +autocmd filetype cpp nnoremap :w !g++ -std=c++11 -O2 -Wall % -o %:r && %:r.exe +" }}} + diff --git a/nvim/plugs/coc.vim b/nvim/plugs/coc.vim index 1139755..c04ab60 100644 --- a/nvim/plugs/coc.vim +++ b/nvim/plugs/coc.vim @@ -3,18 +3,19 @@ " diagnostics appear/become resolved. if has("nvim-0.5.0") || has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one - set signcolumn=number + "set signcolumn=number + set signcolumn=yes else set signcolumn=yes endif - + " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by " other plugin before putting this into your config. inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort @@ -34,7 +35,7 @@ endif inoremap pumvisible() ? coc#_select_confirm() \: "\u\\=coc#on_enter()\" -let g:coc_snippet_next = '' "tab to go to first suggestion +"let g:coc_snippet_next = '' "tab to go to first suggestion " GoTo code navigation. @@ -84,16 +85,6 @@ nmap ac (coc-codeaction) " Apply AutoFix to problem on the current line. nmap qf (coc-fix-current) -" Remap and for scroll float windows/popups. -" if has('nvim-0.4.0') || has('patch-8.2.0750') - " nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - " nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - " inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - " inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - " vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - " vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" -" endif - " Use CTRL-S for selections ranges. " Requires 'textDocument/selectionRange' support of language server. nmap (coc-range-select) @@ -113,132 +104,4 @@ command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organize " provide custom statusline: lightline.vim, vim-airline. set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} -" " Mappings for CoCList -" " Show all diagnostics. -" nnoremap a :CocList diagnostics -" " Manage extensions. -" nnoremap e :CocList extensions -" " Show commands. -" nnoremap c :CocList commands -" " Find symbol of current document. -" nnoremap o :CocList outline -" " Search workspace symbols. -" nnoremap s :CocList -I symbols -" " Do default action for next item. -" nnoremap j :CocNext -" " Do default action for previous item. -" nnoremap k :CocPrev -" " Resume latest coc list. -" nnoremap p :CocListResume -" - -" }}} - -" COC archieved----- {{{ -" COC extension -" let g:coc_user_config = {} -" let g:coc_global_extensions = [ - " \ 'coc-emmet', - " \ 'coc-css', - " \ 'coc-html', - " \ 'coc-json', - " \ 'coc-prettier', - " \ 'coc-tsserver', - " \ 'coc-snippets', - " \ 'coc-eslint'] -" " " To go back to previous state use Ctrl+O -" nmap gd (coc-definition) -" nmap gy (coc-type-definition) -" nmap gi (coc-implementation) -" nmap gr (coc-references) -" -" function! s:check_back_space() abort - " let col = col('.') - 1 - " return !col || getline('.')[col - 1] =~# '\s' -" endfunction -" -" inoremap - " \ pumvisible() ? "\" : - " \ check_back_space() ? "\" : - " \ coc#refresh() -" " https://stackoverflow.com/questions/63337283/how-to-select-first-item-in-popup-menu-and-close-menu-in-a-single-keybind-for-au -" " inoremap - " " \ pumvisible() ? coc#_select_confirm() : - " " \ coc#expandableOrJumpable() ? - " " \ "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : - " " \ check_back_space() ? "\" : - " " \ coc#refresh() -" -" let g:coc_snippet_next = '' -" inoremap pumvisible() ? "\" : "\" -" - " -" " " Always show the signcolumn, otherwise it would shift the text each time -" " " diagnostics appear/become resolved. -" if has("patch-8.1.1564") - " " " Recently vim can merge signcolumn and number column into one - " set signcolumn=number -" else - " set signcolumn=yes -" endif -" -" " " Use to trigger completion. -" inoremap coc#refresh() -" -" " " Use to confirm completion, `u` means break undo chain at current -" " " position. Coc only does snippet and additional edit on confirm. -" " " could be remapped by other vim plugin, try `:verbose imap `. -" if exists('*complete_info') - " inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" -" else - " inoremap pumvisible() ? "\" : "\u\" -" endif -" -" " " Highlight the symbol and its references when holding the cursor. -" autocmd CursorHold * silent call CocActionAsync('highlight') -" -" " " Symbol renaming. -" nmap rn (coc-rename) -" -" " " Formatting selected code. -" map f (coc-format-selected) -" nmap f (coc-format-selected -" -" augroup mygroup - " autocmd! - " " " Setup formatexpr specified filetype(s). - " autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " " " Update signature help on jump placeholder. - " autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -" augroup end -" -" " " Applying codeAction to the selected region. -" " " Example: `aap` for current paragraph -" xmap a (coc-codeaction-selected) -" nmap a (coc-codeaction-selected) -" -" " " Remap keys for applying codeAction to the current buffer. -" nmap ac (coc-codeaction) -" " " Apply AutoFix to problem on the current line. -" nmap qf (coc-fix-current) -" -" " " Add `:Format` command to format current buffer. -" command! -nargs=0 Format :call CocAction('format') -" -" " " Add `:Fold` command to fold current buffer. -" command! -nargs=? Fold :call CocAction('fold', ) -" -" " " Add `:OR` command for organize imports of the current buffer. -" command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') -" -" " " Add (Neo)Vim's native statusline support. -" " " NOTE: Please see `:h coc-status` for integrations with external plugins that -" " " provide custom statusline: lightline.vim, vim-airline. -" "set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} -" function! CocCurrentFunction() - " return get(b:, 'coc_current_function', '') -" endfunction -" - -" }}} - +"nnoremap q :call CocAction('diagnosticInfo') diff --git a/nvim/plugs/plugins.vim b/nvim/plugs/plugins.vim index e5af083..febb348 100644 --- a/nvim/plugs/plugins.vim +++ b/nvim/plugs/plugins.vim @@ -26,13 +26,17 @@ Plug 'preservim/nerdcommenter' Plug 'tpope/vim-surround' Plug 'mhinz/vim-startify' + +"Plug 'jlanzarotta/bufexplorer' + call plug#end() " UltiSnips ----- {{{ " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. -let g:UltiSnipsExpandTrigger="" +"let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsExpandTrigger = '' "to aviod overlapping with coc mapping "let g:UltiSnipsJumpForwardTrigger="" "let g:UltiSnipsJumpBackwardTrigger="" " }}} @@ -52,11 +56,13 @@ let g:NERDTreeMinimalUI = 1 " hide helper let g:NERDTreeIgnore = ['^node_modules$'] " ignore node_modules to increase load speed let g:NERDTreeStatusline = '' " set to empty to use lightline " " Toggle -noremap :NERDTreeToggle +"noremap :NERDTreeToggle +nnoremap t :NERDTreeToggle +nnoremap y :NERDTreeFind :vertical resize 35 " " Close window if NERDTree is the last one autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " " Map to open current file in NERDTree and set size -nnoremap pv :NERDTreeFind :vertical resize 45 +"nnoremap pv :NERDTreeFind :vertical resize 45 " NERDTree Syntax Highlight " " Enables folder icon highlighting using exact match @@ -171,14 +177,13 @@ let g:lightline = { \ 'colorscheme': 'powerlineish', \ 'active': { \ 'left': [ [ 'mode', 'paste' ],['readonly', 'filename', 'modified']], - \ 'right' : [['cocstatus', 'currentfunction'],['lineinfo'], ['percent'], ['fileformat', 'fileencoding']] + \ 'right' : [['cocstatus', 'currentfunction'],['lineinfo'], ['percent'],['filetype','fileformat','fileencoding']] \ }, \ 'component_function': { \ 'cocstatus': 'coc#status', \ 'currentfunction': 'CocCurrentFunction' + \ }, \ } - \ } - " }}} " " vim-startify ----- {{{ From 2a690ef2e792fb9c45200fbec39b8721ee503841 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Tue, 10 Aug 2021 21:58:31 +0530 Subject: [PATCH 03/14] [FEAT] add markdow preview plugin --- nvim/init.vim | 1 + nvim/plugs/markdown.vim | 91 +++++++++++++++++++++++++++++++++++++++++ nvim/plugs/plugins.vim | 8 +++- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 nvim/plugs/markdown.vim diff --git a/nvim/init.vim b/nvim/init.vim index e0fbd54..381c26c 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -2,6 +2,7 @@ let mapleader = "\" source $LOCALAPPDATA/nvim/plugs/plugins.vim source $LOCALAPPDATA/nvim/plugs/coc.vim +source $LOCALAPPDATA/nvim/plugs/markdown.vim source $LOCALAPPDATA/nvim/general/general.vim source $LOCALAPPDATA/nvim/general/leader.vim source $LOCALAPPDATA/nvim/general/keybindings.vim diff --git a/nvim/plugs/markdown.vim b/nvim/plugs/markdown.vim new file mode 100644 index 0000000..e9610fa --- /dev/null +++ b/nvim/plugs/markdown.vim @@ -0,0 +1,91 @@ +" set to 1, nvim will open the preview window after entering the markdown buffer +" default: 0 +let g:mkdp_auto_start = 0 + +" set to 1, the nvim will auto close current preview window when change +" from markdown buffer to another buffer +" default: 1 +let g:mkdp_auto_close = 1 + +" set to 1, the vim will refresh markdown when save the buffer or +" leave from insert mode, default 0 is auto refresh markdown as you edit or +" move the cursor +" default: 0 +let g:mkdp_refresh_slow = 0 + +" set to 1, the MarkdownPreview command can be use for all files, +" by default it can be use in markdown file +" default: 0 +let g:mkdp_command_for_global = 0 + +" set to 1, preview server available to others in your network +" by default, the server listens on localhost (127.0.0.1) +" default: 0 +let g:mkdp_open_to_the_world = 0 + +" use custom IP to open preview page +" useful when you work in remote vim and preview on local browser +" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9 +" default empty +let g:mkdp_open_ip = '' + +" specify browser to open preview page +" default: '' +let g:mkdp_browser = '' + +" set to 1, echo preview page url in command line when open preview page +" default is 0 +let g:mkdp_echo_preview_url = 0 + +" a custom vim function name to open preview page +" this function will receive url as param +" default is empty +let g:mkdp_browserfunc = '' + +" options for markdown render +" mkit: markdown-it options for render +" katex: katex options for math +" uml: markdown-it-plantuml options +" maid: mermaid options +" disable_sync_scroll: if disable sync scroll, default 0 +" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle' +" middle: mean the cursor position alway show at the middle of the preview page +" top: mean the vim top viewport alway show at the top of the preview page +" relative: mean the cursor position alway show at the relative positon of the preview page +" hide_yaml_meta: if hide yaml metadata, default is 1 +" sequence_diagrams: js-sequence-diagrams options +" content_editable: if enable content editable for preview page, default: v:false +" disable_filename: if disable filename header for preview page, default: 0 +let g:mkdp_preview_options = { + \ 'mkit': {}, + \ 'katex': {}, + \ 'uml': {}, + \ 'maid': {}, + \ 'disable_sync_scroll': 0, + \ 'sync_scroll_type': 'middle', + \ 'hide_yaml_meta': 1, + \ 'sequence_diagrams': {}, + \ 'flowchart_diagrams': {}, + \ 'content_editable': v:false, + \ 'disable_filename': 0 + \ } + +" use a custom markdown style must be absolute path +" like '/Users/username/markdown.css' or expand('~/markdown.css') +let g:mkdp_markdown_css = '' + +" use a custom highlight style must absolute path +" like '/Users/username/highlight.css' or expand('~/highlight.css') +let g:mkdp_highlight_css = '' + +" use a custom port to start server or random for empty +let g:mkdp_port = '' + +" preview page title +" ${name} will be replace with the file name +let g:mkdp_page_title = '「${name}」' + +" recognized filetypes +" these filetypes will have MarkdownPreview... commands +let g:mkdp_filetypes = ['markdown'] + diff --git a/nvim/plugs/plugins.vim b/nvim/plugs/plugins.vim index febb348..1f31f73 100644 --- a/nvim/plugs/plugins.vim +++ b/nvim/plugs/plugins.vim @@ -28,7 +28,13 @@ Plug 'tpope/vim-surround' Plug 'mhinz/vim-startify' "Plug 'jlanzarotta/bufexplorer' - +" If you have nodejs and yarn +"Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' } +" +" If you don't have nodejs and yarn +" use pre build, add 'vim-plug' to the filetype list so vim-plug can update this plugin +" see: https://github.com/iamcco/markdown-preview.nvim/issues/50 +Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} call plug#end() From a3379d3bc011137cad30cf90823095965608d013 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Tue, 10 Aug 2021 21:59:04 +0530 Subject: [PATCH 04/14] [README] add readme --- nvim/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nvim/README.md diff --git a/nvim/README.md b/nvim/README.md new file mode 100644 index 0000000..3f171c1 --- /dev/null +++ b/nvim/README.md @@ -0,0 +1,9 @@ +# My Dotfiles ![](https://img.shields.io/badge/config%20for-nvim-blue?style=for-the-badge) + +--- + +My setup for various applications. + +## nvim 🚀 + +- with language support for cpp and python From 79885e8eb58789eef4b9d0cb419fc52114e64cbf Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Fri, 13 Aug 2021 00:34:05 +0530 Subject: [PATCH 05/14] (chore) --- nvim/plugs/plugins.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/plugs/plugins.vim b/nvim/plugs/plugins.vim index 1f31f73..2931d3c 100644 --- a/nvim/plugs/plugins.vim +++ b/nvim/plugs/plugins.vim @@ -53,7 +53,7 @@ if (has("termguicolors")) endif set background=dark colorscheme gruvbox - +au Colorscheme gruvbox :hi Keyword gui=italic cterm=italic " }}} " NERDTree ----- {{{ From 0b791672beb4b81485f70897e70ca25430365041 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Fri, 13 Aug 2021 17:35:51 +0530 Subject: [PATCH 06/14] [README] update coc related info --- nvim/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/README.md b/nvim/README.md index 3f171c1..fc4327b 100644 --- a/nvim/README.md +++ b/nvim/README.md @@ -7,3 +7,6 @@ My setup for various applications. ## nvim 🚀 - with language support for cpp and python +- for coc + - `:CocCommand clangd.install ` (make sure clangd path is added to `:CocConfig`) + - `:CocInstall coc-clangd coc-css coc-emmet coc-eslint coc-html coc-java coc-jedi coc-json coc-lua coc-pairs coc-prettier coc-pyright coc-snippets coc-tsserver coc-vimlsp ` From 6acaa6c45fe15e8e31a06749c9c6df9717c5c25b Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Sat, 14 Aug 2021 23:47:41 +0530 Subject: [PATCH 07/14] (feat) support html snippets inside js --- nvim/coc-settings.json | 14 +++++++++++++- nvim/languages/languages.vim | 11 ++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json index a36455b..9255d36 100644 --- a/nvim/coc-settings.json +++ b/nvim/coc-settings.json @@ -18,5 +18,17 @@ //"diagnostic.enableMessage": "jump", "jedi.hover.enable": true, "hover.target": "float", - "clangd.path": "C:\\Users\\Prashanth T P\\AppData\\Local\\coc\\extensions\\coc-clangd-data\\install\\12.0.1\\clangd_12.0.1\\bin\\clangd.exe" + "clangd.path": "C:\\Users\\Prashanth T P\\AppData\\Local\\coc\\extensions\\coc-clangd-data\\install\\12.0.1\\clangd_12.0.1\\bin\\clangd.exe", + //html + "html.autoClosingTags": true, + "html.filetypes": ["html", "javascript", "handlebars", "htmldjango", "blade"], + "html.enable": true, + "snippets.extends": { + + "cpp": ["c"], + "javascript":["html"], + "javascriptreact": ["javascript"], + "typescript": ["javascript"] + } + } diff --git a/nvim/languages/languages.vim b/nvim/languages/languages.vim index 791781f..ef08c77 100644 --- a/nvim/languages/languages.vim +++ b/nvim/languages/languages.vim @@ -4,6 +4,15 @@ let g:python3_host_prog = "$PYTHON_HOME/Python/python.exe" " cpp ----- {{{ "autocmd vimEnter *.cpp map :w :!clear ; g++ --std=c++17 %; if [ -f a.out ]; then time ./a.out; rm a.out; fi "map :!g++ % -o %:r && \./%:r -autocmd filetype cpp nnoremap :w !g++ -std=c++11 -O2 -Wall % -o %:r && %:r.exe +" +augroup languages + autocmd! + autocmd filetype cpp nnoremap :w !g++ -std=c++11 -O2 -Wall % -o %:r && %:r.exe + autocmd filetype javascript,javascript_react UltiSnipsAddFiletypes javascript.javascript_react.html +" autocmd FileType javascript_react UltiSnipsAddFiletypes html +" autocmd FileType javascript,javascriptreact,typescript,typescriptreact + " \ UltiSnipsAddFiletypes javascript.javascriptreact.typescript.typescriptreact +augroup END +" " }}} From 224a4447489c04e60a2bafa2b0b24aeb39cd5940 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Sun, 15 Aug 2021 10:52:13 +0530 Subject: [PATCH 08/14] (bugfix) fix #1, save buffer view only for files with name --- nvim/general/general.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nvim/general/general.vim b/nvim/general/general.vim index d7b88fb..d634802 100644 --- a/nvim/general/general.vim +++ b/nvim/general/general.vim @@ -9,6 +9,9 @@ set autochdir " EDITOR ----- {{{ syntax on +" filetype on +" filetype plugin on +" filetype indent on set ignorecase set smartcase " use 4 spaces for tabs @@ -38,8 +41,8 @@ set foldmethod=marker " remember foldings augroup remember_folds autocmd! - autocmd BufWinLeave * mkview - autocmd BufWinEnter * silent! loadview + autocmd BufWinLeave *.* mkview + autocmd BufWinEnter *.* silent! loadview augroup END " }}} @@ -85,7 +88,7 @@ set cmdheight=2 " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable " delays and poor user experience. set updatetime=300 - +set ttimeoutlen=0 " Don't pass messages to |ins-completion-menu|. set shortmess+=c " }}} From f3453abd793b8be48fad68d28cab30b29d6a3788 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Sun, 15 Aug 2021 21:01:33 +0530 Subject: [PATCH 09/14] (update)ignore some folders in nerdtree --- nvim/plugs/plugins.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nvim/plugs/plugins.vim b/nvim/plugs/plugins.vim index 2931d3c..574c43c 100644 --- a/nvim/plugs/plugins.vim +++ b/nvim/plugs/plugins.vim @@ -1,5 +1,5 @@ -call plug#begin("$VIM/nvim/plugged") - +" plugins ----- {{{ +call plug#begin("$VIM/nvim/plugged") Plug 'morhetz/gruvbox' Plug 'preservim/nerdtree' @@ -25,7 +25,7 @@ Plug 'preservim/nerdcommenter' Plug 'tpope/vim-surround' -Plug 'mhinz/vim-startify' +"Plug 'mhinz/vim-startify' "Plug 'jlanzarotta/bufexplorer' " If you have nodejs and yarn @@ -36,6 +36,7 @@ Plug 'mhinz/vim-startify' " see: https://github.com/iamcco/markdown-preview.nvim/issues/50 Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} call plug#end() +" }}} @@ -59,7 +60,7 @@ au Colorscheme gruvbox :hi Keyword gui=italic cterm=italic " NERDTree ----- {{{ let g:NERDTreeShowHidden = 1 let g:NERDTreeMinimalUI = 1 " hide helper -let g:NERDTreeIgnore = ['^node_modules$'] " ignore node_modules to increase load speed +let g:NERDTreeIgnore = ['^node_modules$','\.git$', '\.idea$', '\.vscode$', '\.history$'] " ignore node_modules to increase load speed let g:NERDTreeStatusline = '' " set to empty to use lightline " " Toggle "noremap :NERDTreeToggle From e30faec3534ce2c4c8355571aa18b2611604cd65 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Sun, 15 Aug 2021 21:12:52 +0530 Subject: [PATCH 10/14] (readme) add readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..015c7d3 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# My Dotfiles + +--- + +Configuration files for windows applications + +- Nvim From 903a9d2a37aa984745c8e424eb1ae4ba48e3b580 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Sun, 15 Aug 2021 21:35:21 +0530 Subject: [PATCH 11/14] (improve_speed) disabla ale plugin --- nvim/plugs/plugins.vim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nvim/plugs/plugins.vim b/nvim/plugs/plugins.vim index 574c43c..b2436c8 100644 --- a/nvim/plugs/plugins.vim +++ b/nvim/plugs/plugins.vim @@ -16,7 +16,7 @@ Plug 'honza/vim-snippets' "Plug 'junegunn/fzf.vim' Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'w0rp/ale' +"Plug 'w0rp/ale' Plug 'sheerun/vim-polyglot' Plug 'itchyny/lightline.vim' @@ -162,12 +162,12 @@ nmap NERDCommenterToggle " ALE ----- {{{ " ALE (Asynchronous Lint Engine) -let g:ale_fixers = { - \ 'javascript': ['eslint'] - \ } -let g:ale_sign_error = '❌' -let g:ale_sign_warning = '⚠️' -let g:ale_fix_on_save = 1 +" let g:ale_fixers = { + " \ 'javascript': ['eslint'] + " \ } +" let g:ale_sign_error = '❌' +" let g:ale_sign_warning = '⚠️' +" let g:ale_fix_on_save = 1 " }}} From 17b72ba5c57f9d86ecce50b0f2c05a0efb249bf3 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Mon, 16 Aug 2021 17:57:49 +0530 Subject: [PATCH 12/14] (feat) support italic comments --- nvim/init.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/init.vim b/nvim/init.vim index 381c26c..51b9beb 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -11,4 +11,6 @@ source $LOCALAPPDATA/nvim/languages/languages.vim hi Normal ctermbg=none guibg=none "wrap backspace set backspace=indent,eol,start +hi Comment gui=italic cterm=italic +hi htmlArg gui=italic cterm=italic From 3b556a8df306cea8d4485aaf46e7637f520b42c4 Mon Sep 17 00:00:00 2001 From: Prashantha T P Date: Mon, 16 Aug 2021 17:58:56 +0530 Subject: [PATCH 13/14] (feat) support better indentation --- nvim/general/keybindings.vim | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/nvim/general/keybindings.vim b/nvim/general/keybindings.vim index 9d82e32..b4d68f6 100644 --- a/nvim/general/keybindings.vim +++ b/nvim/general/keybindings.vim @@ -13,10 +13,14 @@ augroup highlight_yank augroup END " }}} -" the primeagen : top 5 keybindings ----- {{{ +" searching : the primeagen : top 5 keybindings ----- {{{ "put the cursor at screen center while going to next search result nnoremap n nzz nnoremap N Nzz + +" }}} +" +" breakpoints ----- {{{ "puts the next line at the end of current line : mz = create a mark called z , do J, `z = goto mark z nnoremap J mzJ`z "undo breakpoints @@ -24,9 +28,9 @@ inoremap . .u inoremap , ,u inoremap ! !u inoremap ? ?u - " }}} - +" +" moving lines with ALT key ----- {{{ "https://vim.fandom.com/wiki/Moving_lines_up_or_down nnoremap :m .+1== nnoremap :m .-2== @@ -34,3 +38,12 @@ inoremap :m .+1==gi inoremap :m .-2==gi vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv +" }}} + +"htmlhttps://stackoverflow.com/questions/130734/how-can-one-close-html-tags-in-vim-quickly +"inoremap > >Fo">O + +" better indentation ----- {{{ +vnoremap > >gv +vnoremap < Date: Mon, 16 Aug 2021 18:00:28 +0530 Subject: [PATCH 14/14] (chore) open vimrc in same window without splitting --- nvim/general/leader.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvim/general/leader.vim b/nvim/general/leader.vim index 5f8933a..e55ef7c 100644 --- a/nvim/general/leader.vim +++ b/nvim/general/leader.vim @@ -1,7 +1,8 @@ " Mappings with leader key " source vim file nmap sv :source $LOCALAPPDATA/nvim/init.vim -nmap so :vsplit :e $LOCALAPPDATA/nvim/init.vim +nmap so :e $LOCALAPPDATA/nvim/init.vim +" nmap so :vsplit :e $LOCALAPPDATA/nvim/init.vim nnoremap n :bnext nnoremap p :bprev nnoremap b :buffers