X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/d6c1a4935fbd3f1f1a37f442693b84b78bdc8575..5af4f8855e8f1d65e24e8988f325413f171de903:/autoload/password_store.vim 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