aboutsummaryrefslogtreecommitdiff
path: root/autoload/redact_pass.vim
blob: afcf6e471f47c5beeab1e01b05d2dccdadbbde52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
" Check whether we should set redacting options or not
function! redact_pass#() 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