Closed lucc closed 5 years ago
Bump: rebased after some changes in master.
The functions must be named gpg#... Instead of s:...
Thanks for updating this, @lucc. I haven't forgotten. I'm just waiting to merge until I get a new release of Debian's vim-addon-manager out that way I don't prevent getting updates of this addon into Debian.
@Konfekt which functions specifically. If I execute grep '^function' **/*.vim
I get these results:
on master:
plugin/gnupg.vim:function s:shellescape(s, ...)
plugin/gnupg.vim:function s:GPGInit(bufread)
plugin/gnupg.vim:function s:GPGCleanup()
plugin/gnupg.vim:function s:GPGDecrypt(bufread)
plugin/gnupg.vim:function s:GPGEncrypt()
plugin/gnupg.vim:function s:GPGViewRecipients()
plugin/gnupg.vim:function s:GPGEditRecipients()
plugin/gnupg.vim:function s:GPGFinishRecipientsBuffer()
plugin/gnupg.vim:function s:GPGViewOptions()
plugin/gnupg.vim:function s:GPGEditOptions()
plugin/gnupg.vim:function s:GPGFinishOptionsBuffer()
plugin/gnupg.vim:function s:GPGCheckRecipients(tocheck)
plugin/gnupg.vim:function s:GPGNameToID(name)
plugin/gnupg.vim:function s:GPGIDToName(identity)
plugin/gnupg.vim:function s:GPGPreCmd()
plugin/gnupg.vim:function s:GPGPostCmd()
plugin/gnupg.vim:function s:GPGSystem(dict)
plugin/gnupg.vim:function s:GPGExecute(dict)
plugin/gnupg.vim:function s:GPGDebug(level, text)
on this PR:
autoload/gnupg.vim:function s:shellescape(s, ...)
autoload/gnupg.vim:function gnupg#GPGInit(bufread)
autoload/gnupg.vim:function gnupg#GPGCleanup()
autoload/gnupg.vim:function gnupg#GPGDecrypt(bufread)
autoload/gnupg.vim:function gnupg#GPGEncrypt()
autoload/gnupg.vim:function gnupg#GPGViewRecipients()
autoload/gnupg.vim:function gnupg#GPGEditRecipients()
autoload/gnupg.vim:function s:GPGFinishRecipientsBuffer()
autoload/gnupg.vim:function gnupg#GPGViewOptions()
autoload/gnupg.vim:function gnupg#GPGEditOptions()
autoload/gnupg.vim:function s:GPGFinishOptionsBuffer()
autoload/gnupg.vim:function s:GPGCheckRecipients(tocheck)
autoload/gnupg.vim:function s:GPGNameToID(name)
autoload/gnupg.vim:function s:GPGIDToName(identity)
autoload/gnupg.vim:function s:GPGPreCmd()
autoload/gnupg.vim:function s:GPGPostCmd()
autoload/gnupg.vim:function s:GPGSystem(dict)
autoload/gnupg.vim:function s:GPGExecute(dict)
autoload/gnupg.vim:function s:GPGDebug(level, text)
So you can see that I already changed the functions that need to be changed. All the other functions are only called from within the same file and can still be script-local. Please point me to the function in question if I'm wrong.
Alright, I read the commit wrongly. It's all fine, sorry for the noise.
It would be nice to have a single (autoload) function that allows for init+loading, so that it can be used when lazy-loading this in a plugin manager.
@jamessan I rebased ontop of master.
@blueyed Can you open a feature request for this? I don't use special settings or plugin managers to only load plugins in special conditions (hence this PR for a little sped up :), so I have little understanding of what is needed for this.
@jamessan
Can we make this happen, please? (moving the plugin's core into autoload
)
I could pick it up to resolve the conflict, if you or @lucc do not want to do it.
Just for reference, I am using the following now to autoload it with vim-plug:
Plug 'jamessan/vim-gnupg', {'on': []} " custom filetype
" Manual setup for autoloading
let g:GPGFilePattern = '*.\(gpg\|asc\|pgp\)'
function! s:autoload_gnupg(aucmd)
augroup MyGnuPG
au!
augroup END
call plug#load('vim-gnupg')
exe 'doautocmd' a:aucmd
endfunction
augroup MyGnuPG
autocmd!
autocmd BufReadCmd *.\(gpg\|asc\|pgp\) call s:autoload_gnupg('BufReadCmd')
autocmd FileReadCmd *.\(gpg\|asc\|pgp\) call s:autoload_gnupg('FileReadCmd')
augroup END
Can we make this happen, please? (moving the plugin's core into autoload)
It will happen, but my comment from earlier still stands.
Right now I'd rather spend my time on this plugin figuring out a way to get it to work with Neovim or improving the detection of armored files. Restructuring the plugin is nice, but it's not a priority.
@jamessan Cool!
figuring out a way to get it to work with Neovim
It works for me there?! What are you referring to?
Restructuring the plugin is nice, but it's not a priority.
I agree. But given an existing PR already, that will cause conflicts over and over again.
Good to know where you stand there though, so we can wait with updating this PR.
(and there is a workaround for vim-plug, which can be adopted for other plugin managers likely, so it is fine for me in this regard)
Neovim
Ah, https://github.com/jamessan/vim-gnupg/issues/32 - I am using gpg-agent (and asymmetric encryption), so this works around this I guess?!
I am using gpg-agent (and asymmetric encryption), so this works around this I guess?!
If you have a GUI pinentry, then that will avoid the problem, yes.
This has been mentioned in #13 but I thought I could just go ahead and do it.
The main advantage is the speed up of startup time (script source time) as reported by --startuptime. On master it is 1.1 msec and on this branch 0.3 msec for me. This is especially useful when you start vim and do not intend to edit a gpg file.