-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move functions to autoload dir. #52
Conversation
6d28582
to
e312c44
Compare
ee6fcbf
to
55324b8
Compare
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 on master:
on this PR:
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. |
55324b8
to
4c92e9a
Compare
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. |
The "GPG" prefix is not needed anymore. All public functions now have the prefix "gnupg#" and all script local functions did not need to be put in a separate "namespace" all along. Same for variables.
4c92e9a
to
7db65fb
Compare
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 |
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
It works for me there?! |
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) |
Ah, #32 - 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.