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

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