Add incsearch so all matches highlight together, configure plugin to

default search keys, and remap clear search to // (search key twice)
This commit is contained in:
Kevin MacMartin 2014-10-19 13:12:27 -04:00
parent 6106feb745
commit 70003e79d4
6 changed files with 23 additions and 3 deletions

3
.gitmodules vendored
View file

@ -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

View file

@ -0,0 +1 @@
../bundle/incsearch.vim

@ -0,0 +1 @@
Subproject commit a4b7c9151ffef45c496632abbcbcb1e2cb2cb2cf

View file

@ -217,7 +217,7 @@
" <Ctrl-Right> | (V) -> select one word right
" <Ctrl-Left> | (V) -> select one word left
"
" <Leader>/ | (N) -> remove search highlighting
" // | (N) -> remove search highlighting
"
" (remap dangerous functions that skip undo)
" <Ctrl-u> | (I) -> undo-able equivalent
@ -646,7 +646,7 @@
xnoremap <S-Left> ^
"clear search results
nnoremap <silent><expr> <Leader>/ ':noh<CR>:echo "Search results have been cleared"<CR>'
nnoremap <silent><expr> // '<Esc>:noh<CR>'
"}
"}}}

View file

@ -72,6 +72,16 @@
autocmd FileType gundo setlocal nocursorcolumn
"}}}
"INCSEARCH: {{{
"use incsearch in place of the default search
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(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

View file

@ -70,12 +70,17 @@ vnoremap <C-c> y
nnoremap T vg_y
vnoremap T g_y
" Search
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
nnoremap <silent><expr> // '<Esc>:noh<CR>'
" Selection
nnoremap <C-a> gg0vG$
xnoremap <C-a> <Esc>gg0vG$
nnoremap <Leader>a gg0vG$
xnoremap <Leader>a <Esc>gg0vG$
nnoremap <silent><expr> <Leader>/ ':noh<CR>'
" Toggles
nnoremap <silent><expr> <F1> ':set wrap!<CR>:echo "line wrapping toggled"<CR>'