aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/nohai.vim
diff options
context:
space:
mode:
authorTeddy Wing2019-12-14 17:20:53 +0100
committerTeddy Wing2019-12-14 17:25:45 +0100
commit7c9b04778a88926e2349770a5e8e3e8c09221bc7 (patch)
tree9918348b8638c4acace895389b62d06da6f2266e /plugin/nohai.vim
parentabbb118307779a07067427ccd611f71719da143b (diff)
downloadvim-nohai-7c9b04778a88926e2349770a5e8e3e8c09221bc7.tar.bz2
Add descriptions to script functions
Diffstat (limited to 'plugin/nohai.vim')
-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()