X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/5e46c4df650e55e4f00295f9063486b32a664019..329e21ac77e347520634119b979cf02f26988491:/autoload/password_store.vim?ds=sidebyside diff --git a/autoload/password_store.vim b/autoload/password_store.vim index b5eaf90..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_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