――Ich wollte mehr über Vim wissen, also habe ich ein Vim-Plugin in Python geschrieben (ich benutze Neovim ...)
--Dieses https://github.com/shase/passgen.vim
.
├── autoload
│ └── passgen.vim
├── plugin
│ └── passgen.vim
└── python3
└── passgen.py
python3/passgen.py
import secrets
import string
def passgenvim_generate_password(size=''):
chars = string.ascii_letters + string.digits
return ''.join(secrets.choice(chars) for x in range(int(size)))
autoload/passgen.vim
let s:save_cpo = &cpo
set cpo&vim
py3file <sfile>:h:h/python3/passgen.py
python3 import vim
function! passgen#passgen(size)
python3 vim.command("call setline('.', '%s')" % passgenvim_generate_password(vim.eval('a:size')))
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
plugin/passgen.vim
let s:save_cpo = &cpo
set cpo&vim
command! -nargs=1 PASSGEN call passgen#passgen(<f-args>)
let &cpo = s:save_cpo
unlet s:save_cpo
OK so
Recommended Posts