From 70003e79d466d4fbf862b8afeb857b363857b1e1 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Sun, 19 Oct 2014 13:12:27 -0400 Subject: [PATCH] Add incsearch so all matches highlight together, configure plugin to default search keys, and remap clear search to // (search key twice) --- .gitmodules | 3 +++ vim/bundle.pager/incsearch.vim | 1 + vim/bundle/incsearch.vim | 1 + vim/config/keyboard.vim | 4 ++-- vim/config/plugins.vim | 10 ++++++++++ vim/config/vimpager.vim | 7 ++++++- 6 files changed, 23 insertions(+), 3 deletions(-) create mode 120000 vim/bundle.pager/incsearch.vim create mode 160000 vim/bundle/incsearch.vim diff --git a/.gitmodules b/.gitmodules index 7fc8846..dc0118d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -100,3 +100,6 @@ [submodule "vim/bundle/ttagecho_vim"] path = vim/bundle/ttagecho_vim url = https://github.com/tomtom/ttagecho_vim.git +[submodule "vim/bundle/incsearch.vim"] + path = vim/bundle/incsearch.vim + url = https://github.com/vim-scripts/incsearch.vim.git diff --git a/vim/bundle.pager/incsearch.vim b/vim/bundle.pager/incsearch.vim new file mode 120000 index 0000000..1c043bb --- /dev/null +++ b/vim/bundle.pager/incsearch.vim @@ -0,0 +1 @@ +../bundle/incsearch.vim \ No newline at end of file diff --git a/vim/bundle/incsearch.vim b/vim/bundle/incsearch.vim new file mode 160000 index 0000000..a4b7c91 --- /dev/null +++ b/vim/bundle/incsearch.vim @@ -0,0 +1 @@ +Subproject commit a4b7c9151ffef45c496632abbcbcb1e2cb2cb2cf diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index f8b1987..3cb585e 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -217,7 +217,7 @@ " | (V) -> select one word right " | (V) -> select one word left " -" / | (N) -> remove search highlighting +" // | (N) -> remove search highlighting " " (remap dangerous functions that skip undo) " | (I) -> undo-able equivalent @@ -646,7 +646,7 @@ xnoremap ^ "clear search results - nnoremap / ':noh:echo "Search results have been cleared"' + nnoremap // ':noh' "} "}}} diff --git a/vim/config/plugins.vim b/vim/config/plugins.vim index 01b3e8b..bf10d16 100644 --- a/vim/config/plugins.vim +++ b/vim/config/plugins.vim @@ -72,6 +72,16 @@ autocmd FileType gundo setlocal nocursorcolumn "}}} +"INCSEARCH: {{{ + "use incsearch in place of the default search + map / (incsearch-forward) + map ? (incsearch-backward) + map g/ (incsearch-stay) + + "n and N behavioru is consistant + let g:incsearch#consistent_n_direction = 1 +"}}} + "JSON: {{{ let g:vim_json_warnings=0 let g:vim_json_syntax_conceal=0 diff --git a/vim/config/vimpager.vim b/vim/config/vimpager.vim index 7b97c62..21c903f 100644 --- a/vim/config/vimpager.vim +++ b/vim/config/vimpager.vim @@ -70,12 +70,17 @@ vnoremap y nnoremap T vg_y vnoremap T g_y +" Search +map / (incsearch-forward) +map ? (incsearch-backward) +map g/ (incsearch-stay) +nnoremap // ':noh' + " Selection nnoremap gg0vG$ xnoremap gg0vG$ nnoremap a gg0vG$ xnoremap a gg0vG$ -nnoremap / ':noh' " Toggles nnoremap ':set wrap!:echo "line wrapping toggled"'