From 9d788b57245fa78e7779b183f2f90fa00d5c80c1 Mon Sep 17 00:00:00 2001 From: Josef Fortier Date: Tue, 4 Sep 2018 15:54:54 -0500 Subject: [PATCH] Initial setup --- ftdetect/pass.vim | 20 ++++++++++++++++++++ ftplugin/pass.vim | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 ftdetect/pass.vim create mode 100644 ftplugin/pass.vim diff --git a/ftdetect/pass.vim b/ftdetect/pass.vim new file mode 100644 index 0000000..5cb07c1 --- /dev/null +++ b/ftdetect/pass.vim @@ -0,0 +1,20 @@ +" detect password-store files +if exists('did_pass') || &compatible || version < 700 + finish +endif +let g:did_pass = 'did_pass' +let s:save_cpo = &cpoptions +set compatible&vim + +" this is straight from Tom Ryders plugin +augroup password-store + autocmd! + autocmd VimEnter + \ /dev/shm/pass.?*/?*.txt + \,$TMPDIR/pass.?*/?*.txt + \,/tmp/pass.?*/?*.txt + \ set filetype=pass +augroup END + +" Cleanup at end +let &cpoptions = s:save_cpo diff --git a/ftplugin/pass.vim b/ftplugin/pass.vim new file mode 100644 index 0000000..5f26a1a --- /dev/null +++ b/ftplugin/pass.vim @@ -0,0 +1,39 @@ +if exists('did_pass_ftplugin') || &compatible || version < 700 + finish +endif +let g:did_pass = 'did_pass_ftplugin' +let s:save_cpo = &cpoptions +set compatible&vim + + +setlocal nospell + + +" Check whether we should set redacting options or not +function! s:CheckArgsRedact() + + " Ensure there's one argument and it's the matched file + if argc() != 1 || fnamemodify(argv(0), ':p') !=# expand(':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 + +call s:CheckArgsRedact() + +" Cleanup at end +let &cpoptions = s:save_cpo -- 2.39.2