]> git.madduck.net Git - etc/vim.git/blobdiff - autoload/password_store.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:

Sort of correct
[etc/vim.git] / autoload / password_store.vim
index 9e3c5b6ce806b815c940eb0410ae5bec38007124..6b6260b7df1493fcd012b489d435f1e48f2519e0 100644 (file)
@@ -11,7 +11,8 @@ set compatible&vim
 " Return vim to users choice
 function! password_store#generate() abort
     if executable('pwgen')
 " 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
 
     endif
 endfunction
 
@@ -19,4 +20,18 @@ function! password_store#replace() abort
     execute 's/\<.*\>/' . password_store#generate() . '/'
 endfunction
 
     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
 let &cpoptions = s:save_cpo