diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-25 21:55:51 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-25 21:56:24 +1200 |
commit | 66fa75c8ca81e012079a69e9e4f0bd2ca69f0a09 (patch) | |
tree | d585bf163aa834526d2eeecf36e4dd6cc1ba0123 /autoload | |
parent | Drop Vim 6.x support (diff) | |
download | vim-redact-pass-66fa75c8ca81e012079a69e9e4f0bd2ca69f0a09.tar.gz vim-redact-pass-66fa75c8ca81e012079a69e9e4f0bd2ca69f0a09.zip |
Move code into autoloaded function
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/redact_pass.vim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/autoload/redact_pass.vim b/autoload/redact_pass.vim new file mode 100644 index 0000000..da1c101 --- /dev/null +++ b/autoload/redact_pass.vim @@ -0,0 +1,23 @@ +" 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 |