mirror of
https://github.com/ernstwi/vim-secret.git
synced 2025-12-27 01:35:01 +08:00
Add mapping <Plug>SecretToggle
This commit is contained in:
parent
33ef0ba3b6
commit
a911e7e891
5 changed files with 29 additions and 2 deletions
|
|
@ -17,6 +17,10 @@
|
|||
<td><code>:Secret!</code></td>
|
||||
<td>Disable secret view.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code><Plug>SecretToggle</code></td>
|
||||
<td>Toggle secret view.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
An area around the cursor is unhidden to enable you to see what you are typing. This can be the entire line, the current word, the current character, or it can be disabled completely.
|
||||
|
|
|
|||
|
|
@ -164,3 +164,11 @@ function! secret#secret(enable, ...)
|
|||
call s:disable()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! secret#toggle()
|
||||
if !exists('w:secret_state') || !has_key(w:secret_state, bufnr())
|
||||
call secret#secret(1)
|
||||
else
|
||||
call secret#secret(0)
|
||||
endif
|
||||
endfunction
|
||||
|
|
|
|||
|
|
@ -64,12 +64,20 @@ g:secret_timeout_insert Hide entire buffer after 'updatetime' milliseconds
|
|||
==============================================================================
|
||||
MAPPINGS *secret-mappings*
|
||||
|
||||
Secret view mappings~
|
||||
*g:secret_quickhide*
|
||||
g:secret_quickhide Hide entire buffer until the cursor is moved. Set this
|
||||
to a key sequence string: >
|
||||
g:secret_quickhide Hide entire buffer until the cursor is moved.
|
||||
Set this to a key sequence string: >
|
||||
|
||||
let g:secret_quickhide = '<Leader>q'
|
||||
|
||||
Global mappings~
|
||||
*<Plug>SecretToggle*
|
||||
<Plug>SecretToggle Toggle secret view.
|
||||
<Plug> mappings are used like this: >
|
||||
|
||||
nmap <Leader>s <Plug>SecretToggle
|
||||
|
||||
==============================================================================
|
||||
HIGHLIGHTING *secret-highlight* *SecretVisible*
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
command! -bang -nargs=* Secret call secret#secret(<bang>1, <f-args>)
|
||||
nmap <silent> <Plug>SecretToggle :call secret#toggle()<CR>
|
||||
|
||||
if !exists('g:secret_cchar')
|
||||
let g:secret_cchar = '•'
|
||||
|
|
|
|||
|
|
@ -249,3 +249,9 @@ Execute (quickhide mapping, moving around):
|
|||
AssertSyntax '••••• •••••', '••••• ••• ••••'
|
||||
Secret!
|
||||
AssertEqual maparg('q'), ''
|
||||
|
||||
Execute (toggle mapping):
|
||||
nmap s <Plug>SecretToggle
|
||||
AssertSyntax ' ', ' '
|
||||
normal s
|
||||
AssertSyntax '----- •••••', '••••• ••• ••••'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue