diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-25 22:00:50 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-25 22:00:50 +1200 |
commit | 4e5727fae46e154bf4161b6b481071ed02564069 (patch) | |
tree | 62955fe54fd66ad49d4a691da3d1b1e2cf928ede /autoload/redact_pass.vim | |
parent | Merge branch 'release/v1.3.0' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-redact-pass-7ccdf84ca47fef72be044fe242a0ac6dc4c90502.tar.gz (sig) vim-redact-pass-7ccdf84ca47fef72be044fe242a0ac6dc4c90502.zip |
Merge branch 'release/v2.0.0'v2.0.0
* release/v2.0.0:
Split an awkward conditional
Move load guard tests inline
Move code into autoloaded function
Drop Vim 6.x support
Diffstat (limited to 'autoload/redact_pass.vim')
-rw-r--r-- | autoload/redact_pass.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/autoload/redact_pass.vim b/autoload/redact_pass.vim new file mode 100644 index 0000000..8703213 --- /dev/null +++ b/autoload/redact_pass.vim @@ -0,0 +1,24 @@ +" Check whether we should set redacting options or not +function! redact_pass#CheckArgsRedact() abort + + " Ensure there's one argument and it's the matched file + if argc() != 1 + \ || fnamemodify(argv(0), ':p') !=# expand('<afile>:p') + return + endif + + " Disable all the leaky options globally + set nobackup + set nowritebackup + set noswapfile + set viminfo= + if has('persistent_undo') + set noundofile + endif + + " Tell the user what we're doing so they know this worked, via a message and + " a global variable they can check + echomsg 'Editing password file--disabled leaky options!' + let g:redact_pass_redacted = 1 + +endfunction |