]> git.madduck.net Git - etc/vim.git/blob - ftplugin/pass.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Politiely only set filetype locally
[etc/vim.git] / ftplugin / pass.vim
1 if exists('did_pass_ftplugin') || &compatible  || version < 700
2     finish
3 endif
4 let g:did_pass = 'did_pass_ftplugin'
5 let s:save_cpo = &cpoptions
6 set compatible&vim
7
8
9 setlocal nospell
10
11
12 " Check whether we should set redacting options or not
13 function! s:CheckArgsRedact()
14
15   " Ensure there's one argument and it's the matched file
16   if argc() != 1 || fnamemodify(argv(0), ':p') !=# expand('<afile>:p')
17     return
18   endif
19
20   " Disable all the leaky options globally
21   set nobackup
22   set nowritebackup
23   set noswapfile
24   set viminfo=
25   if has('persistent_undo')
26     set noundofile
27   endif
28
29   " Tell the user what we're doing so they know this worked, via a message and
30   " a global variable they can check
31   echomsg 'Editing password file--disabled leaky options!'
32   let g:redact_pass_redacted = 1
33
34 endfunction
35
36 call s:CheckArgsRedact()
37
38 function! s:reveal_pass() abort
39     highlight! link password_store_password Comment
40 endfunction
41 command! Reveal call <SID>reveal_pass()
42
43 function! s:conceal_pass() abort
44     highlight! password_store_password guifg=DarkGray guibg=DarkGray ctermfg=8 ctermbg=8
45 endfunction
46 command! Conceal call <SID>conceal_pass()
47 normal GG
48
49 " Cleanup at end
50 let &cpoptions = s:save_cpo