X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/d6c1a4935fbd3f1f1a37f442693b84b78bdc8575..ad87aa7d798f4befb827b9a83d931cb8e1be8966:/autoload/password_store.vim?ds=inline diff --git a/autoload/password_store.vim b/autoload/password_store.vim index 9e3c5b6..6b6260b 100644 --- a/autoload/password_store.vim +++ b/autoload/password_store.vim @@ -11,7 +11,8 @@ set compatible&vim " Return vim to users choice function! password_store#generate() abort if executable('pwgen') - return systemlist('pwgen -N1 ' . g:password_store_settings.pw_length )[0] + let l:result = systemlist('pwgen -N1 ' . password_store#setting('pw_length') ) + return l:result[0] endif endfunction @@ -19,4 +20,18 @@ function! password_store#replace() abort execute 's/\<.*\>/' . password_store#generate() . '/' endfunction +let s:default_settings = { + \ 'pw_length' : '12', + \ 'enable_syntax' : 'true', + \ } + +function! password_store#setting(key) + if exists('g:password_store_settings') && has_key(g:password_store_settings, a:key) + echo 'found key' + return g:password_store_settings[a:key] + else + return s:default_settings[a:key] + endif +endfunction + let &cpoptions = s:save_cpo