From 70acf70f0bdfb0da95905ea974ab29f45c1eec97 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Apr 2021 20:48:46 +0300 Subject: [PATCH 1/3] [nvim] entirely get rid of the CtrlSF plugin --- nvim/dotfiles/plugins-list.vim | 3 --- nvim/plugin/files.vim | 29 +++++++++++++++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index c08d2bf..ff2ce70 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -43,9 +43,6 @@ Plug 'vim-airline/vim-airline' Plug 'tpope/vim-obsession' Plug 'romainl/vim-qf' - if g:vim_ide - Plug 'dyng/ctrlsf.vim' - endif " }}} " Git {{{ diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 14fa58f..da700db 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -20,6 +20,23 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" command! -bang -nargs=* Rg call fzf#vim#grep(s:rg_cmd . ' --column --line-number --no-heading --fixed-strings --smart-case --color always ' . shellescape(), 1, 0) command! -bang -nargs=* Find Rg endif + + nnoremap / :grep + + function! s:grep_mapping_star_normal() + let word = expand("") + if !empty(word) + call feedkeys(":\grep " . shellescape('\b' . word . '\b'), 'n') + endif + endfunction + function! s:grep_mapping_star_visual() + let tmp = @" + normal! y + call feedkeys(":\grep " . shellescape(@"), 'n') + let @" = tmp + endfunction + nnoremap * call grep_mapping_star_normal() + xnoremap * call grep_mapping_star_visual() " }}} @@ -29,7 +46,10 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" let g:loaded_netrwPlugin = 1 " re-add Netrw's gx mappings since we've disabled them nnoremap gx call netrw#BrowseX(expand(''),netrw#CheckIfRemote()) - xnoremap gx call netrw#BrowseXVis() + " This one can be rewritten in a way to not clobber the yank register... + " Most notably, the built-in mapping, which uses netrw#BrowseXVis(), doesn't + " work and breaks the editor, at least for me. + xnoremap gx y:call netrw#BrowseX(@",netrw#CheckIfRemote()) " }}} @@ -176,10 +196,3 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" augroup END " }}} - - -" CtrlSF {{{ - nmap / CtrlSFPrompt - nmap * CtrlSFCwordPath - xmap * CtrlSFVwordPath -" }}} From 8198c861f43c86701232c90dc11e93e5d7572f98 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Apr 2021 21:18:23 +0300 Subject: [PATCH 2/3] [nvim] disable automatic folds in the fugitive window because they break the UI --- nvim/after/ftplugin/fugitive.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 nvim/after/ftplugin/fugitive.vim diff --git a/nvim/after/ftplugin/fugitive.vim b/nvim/after/ftplugin/fugitive.vim new file mode 100644 index 0000000..ab49c88 --- /dev/null +++ b/nvim/after/ftplugin/fugitive.vim @@ -0,0 +1 @@ +setlocal nofoldenable foldmethod=manual From 2c6193a487576af25552a0574a2bb3cc74f16635 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Apr 2021 21:20:14 +0300 Subject: [PATCH 3/3] [nvim] collapse the set and setlocal commands because the Vimscript syntax allows it --- nvim/after/ftplugin/haskell.vim | 4 +--- nvim/after/syntax/cabal.vim | 3 +-- nvim/after/syntax/cabalconfig.vim | 3 +-- nvim/after/syntax/nginx.vim | 3 +-- nvim/plugin/editing.vim | 10 ++-------- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/nvim/after/ftplugin/haskell.vim b/nvim/after/ftplugin/haskell.vim index bdabaed..8d98c34 100644 --- a/nvim/after/ftplugin/haskell.vim +++ b/nvim/after/ftplugin/haskell.vim @@ -1,3 +1 @@ -let g:haskall_test = 1 -setlocal foldmethod< -setlocal foldtext< +setlocal foldmethod< foldtext< diff --git a/nvim/after/syntax/cabal.vim b/nvim/after/syntax/cabal.vim index 8ced55f..8d98c34 100644 --- a/nvim/after/syntax/cabal.vim +++ b/nvim/after/syntax/cabal.vim @@ -1,2 +1 @@ -setlocal foldmethod< -setlocal foldtext< +setlocal foldmethod< foldtext< diff --git a/nvim/after/syntax/cabalconfig.vim b/nvim/after/syntax/cabalconfig.vim index 8ced55f..8d98c34 100644 --- a/nvim/after/syntax/cabalconfig.vim +++ b/nvim/after/syntax/cabalconfig.vim @@ -1,2 +1 @@ -setlocal foldmethod< -setlocal foldtext< +setlocal foldmethod< foldtext< diff --git a/nvim/after/syntax/nginx.vim b/nvim/after/syntax/nginx.vim index 1e4e3af..bf72a83 100644 --- a/nvim/after/syntax/nginx.vim +++ b/nvim/after/syntax/nginx.vim @@ -4,5 +4,4 @@ " sourced in `syntax/nginx.vim` in vim-polyglot, which resets the `commentstring` " set in `ftplugin/nginx.vim` and sets `comments` to some garbage. This script " undoes that damage. -setlocal comments< -setlocal commentstring=#%s +setlocal comments< commentstring=#%s diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 59b18d3..46cbe9b 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -58,23 +58,17 @@ set commentstring=//%s " Cursor and Scrolling {{{ - - set number - set relativenumber - set cursorline - + set number relativenumber cursorline " remember cursor position augroup vimrc-editing-remember-cursor-position autocmd! autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exec "normal! g`\"" | endif augroup END - " }}} " Wrapping {{{ - set nowrap - set colorcolumn=81,101,121 + set nowrap colorcolumn=81,101,121 " }}}