aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugin/nohai.vim8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugin/nohai.vim b/plugin/nohai.vim
index a0dbbb2..3129ad0 100644
--- a/plugin/nohai.vim
+++ b/plugin/nohai.vim
@@ -1,20 +1,25 @@
+" Remaps <CR> in command mode to run `nohlsearch` after accepting the command.
function! s:AddMapping()
silent! cnoremap <expr> <CR> <SID>CRAndNohlsearch()
endfunction
+" Removes the Nohai <CR> cmap.
function! s:RemoveMapping()
silent! cunmap <CR>
endfunction
+" Deactivates the Nohai <CR> cmap and turns off the augroup.
function! s:Deactivate()
call s:RemoveMapping()
call s:AutocmdOff()
endfunction
+" Expr mapping function that runs the `nohlsearch` command after pressing <CR>.
function! s:CRAndNohlsearch()
return "\<CR>:nohlsearch\<CR>"
endfunction
+" Turn on Nohai autocmds.
function! s:AutocmdOn()
augroup nohai
autocmd!
@@ -24,10 +29,13 @@ function! s:AutocmdOn()
augroup END
endfunction
+" Removes the Nohai augroup.
function! s:AutocmdOff()
autocmd! nohai
endfunction
+" Expr mapping function that turns on Nohai and starts the search command
+" specified by `command`, either '/' or '?'.
function! s:Search(command)
call s:AutocmdOn()