]> 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:

13737784b0fec8d96534759dc4c9377c75cb999e
[etc/vim.git] / ftplugin / pass.vim
1 if exists('did_pass_ftplugin') || &compatible  || v: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 if ! exists('g:password_store_pw_length')
10     let g:password_store_pw_length = 12
11 endif
12
13 nmap <buffer> <Plug>rotate_password :call password_store#replace()<Cr>
14 if ! hasmapto( '\<Plug>rotate_password', 'n')
15     nmap <C-X> <Plug>rotate_password
16 endif
17
18 setlocal nospell
19
20
21 " Check whether we should set redacting options or not
22 function! s:CheckArgsRedact()
23
24   " Ensure there's one argument and it's the matched file
25   if argc() != 1 || fnamemodify(argv(0), ':p') !=# expand('<afile>:p')
26     return
27   endif
28
29   " Disable all the leaky options globally
30   set nobackup
31   set nowritebackup
32   set noswapfile
33   set viminfo=
34   if has('persistent_undo')
35     set noundofile
36   endif
37
38   " Tell the user what we're doing so they know this worked, via a message and
39   " a global variable they can check
40   echomsg 'Editing password file--disabled leaky options!'
41   let g:redact_pass_redacted = 1
42
43 endfunction
44
45 call s:CheckArgsRedact()
46
47 function! s:reveal_pass() abort
48     highlight! link password_store_password Comment
49 endfunction
50 command! Reveal call <SID>reveal_pass()
51
52 function! s:conceal_pass() abort
53     highlight! password_store_password guifg=DarkGray guibg=DarkGray ctermfg=8 ctermbg=8
54 endfunction
55 command! Conceal call <SID>conceal_pass()
56 normal! GG
57
58 " Cleanup at end
59 let &cpoptions = s:save_cpo