aboutsummaryrefslogtreecommitdiff
path: root/autoload/redact_pass.vim
blob: 8703213d4e7cffbea34d2c18de425a66144e1ce1 (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#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