" 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(':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