jamessan / vim-gnupg

This script implements transparent editing of gpg encrypted files.
http://www.vim.org/scripts/script.php?script_id=3645
728 stars 73 forks source link

colorscheme not loaded #58

Closed louwers closed 8 years ago

louwers commented 8 years ago

For some reason, my .vimrc is not sourced when I open .asc files using this plugin. After disabling all other plugins and custom code, the problem persisted.

Any ideas on how I can identify the cause?

jamessan commented 8 years ago

What does :scriptnames show when you open an .asc file?

louwers commented 8 years ago

~/.vimrc is there. Session with .asc file:

  1: /etc/vimrc
  2: /usr/share/vim/vimfiles/archlinux.vim
  3: ~/.vimrc
  4: /usr/share/vim/vim74/ftoff.vim
  5: ~/dotfiles/.vim/bundle/Vundle.vim/autoload/vundle.vim
  6: ~/dotfiles/.vim/bundle/Vundle.vim/autoload/vundle/config.vim
  7: /usr/share/vim/vim74/filetype.vim
  8: /usr/share/vim/vimfiles/ftdetect/nginx.vim
  9: /usr/share/vim/vim74/ftplugin.vim
 10: /usr/share/vim/vim74/indent.vim
 11: /usr/share/vim/vim74/syntax/syntax.vim
 12: /usr/share/vim/vim74/syntax/synload.vim
 13: /usr/share/vim/vim74/syntax/syncolor.vim
 14: ~/dotfiles/.vim/colors/monokai.vim
 15: ~/dotfiles/.vim/bundle/vim-gnupg/plugin/gnupg.vim
 16: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
 17: /usr/share/vim/vim74/plugin/gzip.vim
 18: /usr/share/vim/vim74/plugin/logiPat.vim
 19: /usr/share/vim/vim74/plugin/matchparen.vim
 20: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 21: /usr/share/vim/vim74/plugin/rrhelper.vim
 22: /usr/share/vim/vim74/plugin/spellfile.vim
 23: /usr/share/vim/vim74/plugin/tarPlugin.vim
 24: /usr/share/vim/vim74/plugin/tohtml.vim
 25: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 26: /usr/share/vim/vim74/plugin/zipPlugin.vim
 27: /usr/share/vim/vim74/scripts.vim

These additinal files seem to load with a normal session:

 28: /usr/share/vim/vim74/ftplugin/vim.vim
 29: /usr/share/vim/vim74/indent/vim.vim
 30: /usr/share/vim/vim74/syntax/vim.vim
 31: /usr/share/vim/vim74/syntax/lua.vim
 32: /usr/share/vim/vim74/syntax/perl.vim
 33: /usr/share/vim/vim74/syntax/pod.vim
 34: /usr/share/vim/vim74/syntax/ruby.vim
 35: /usr/share/vim/vim74/syntax/python.vim

Note that when I do :so ~/.vimrc after loading an .asc file, everything goes back to normal.

jamessan commented 8 years ago

Ok, so what's the actual problem you're experiencing? Those latter files are loaded when you edit a vim filetype buffer, so that's not really relevant unless the .asc file is foo.vim.asc.

louwers commented 8 years ago

Thank you very much for your help @jamessan.

I mistakenly believed that none of my .vimrc loaded, but apparently it's just my colorscheme that fails to load... I'll figure it out (another colorscheme did work, so it's probably not vim-gnupg).

Thanks again! Very useful plugin, enjoying it a lot.

jamessan commented 8 years ago

Well, your colorscheme was loaded:

14: ~/dotfiles/.vim/colors/monokai.vim

louwers commented 8 years ago

Yes, but my eyes are telling something different, it's weird!

autocmd User GnuPG :colorscheme monokai

actually 'solves' the problem. :laughing:

jamessan commented 8 years ago

Ooh, I might have an idea. Are you manually setting t_Co in your vimrc?

louwers commented 8 years ago

I'm impressed! monokai.vim was setting it. I moved it to my .vimrc, because I need it if I ever want to change themes.

Is this a bug after all?

jamessan commented 8 years ago

Ugh, monokai shouldn't be doing that, but if it insists on doing so it should be done from a TermChanged autocmd.

The plugin has to re-set 'term' due to other factors (described in #17), and this undoes what monokai is doing. However, it's never a good idea to set that manually, anyway. Your terminal should be advertising the correct $TERM, which may require configuration.

louwers commented 8 years ago

Gotcha! I set TERM and everything works perfect now. Much appreciated James. Pull request submitted to monokai. :wink: