solarized icon indicating copy to clipboard operation
solarized copied to clipboard

VIM Toggle function error in X11

Open mattmartini opened this issue 14 years ago • 9 comments

Using vim in an xterm on OSX:

Hitting F5 generates this error:

Error detected while processing function <SNR>15_TogBG: line 1: E121: Undefined variable: g:colors_name E15: Invalid expression: "colorscheme " . g:colors_name Press ENTER or type command to continue

The F5 toggle works fine in macvim and AppleTerminal.app.

Using: commit 4727d3afd6ac9278e4e5dcee6762ed8bb3501eef Date: Sun Apr 10 00:10:24 2011 -0700

mattmartini avatar Apr 12 '11 22:04 mattmartini

can you confirm your vim version in X11?

I suspect you'll have a similar error, but if you could also update to the current repo code you'll have a new function that maps f5. I'd like to normalize our test environments (yours and mine) before I start asking more detailed questions.

Thanks, Ethan

altercation avatar Apr 12 '11 23:04 altercation

$ vim --version VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 27 2011 16:47:54) MacOS X (unix) version Included patches: 1-135 Compiled by [email protected] Huge version without GUI. Features included (+) or not (-): +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent -clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl/dyn +persistent_undo +postscript +printer +profile +python/dyn -python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/local/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp -arch i386 -arch x86_64 -Os -g -pipe -mdynamic-no-pic -D_FORTIFY_SOURCE=1
Linking: gcc -arch i386 -arch x86_64 -L/usr/local/lib -o vim -lncurses -liconv -framework Cocoa -L/usr/local/lib -L/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE -lm -lutil -lc

I just did a pull to version 4a9b7ecc66e6a451e273befcf418d36cb7167637. The togglebg.vim does not seem to be loading. F5 does nothing, :ToggleBG is not found

On Apr 12, 2011, at 7:33 PM, altercation wrote:

can you confirm your vim version in X11?

I suspect you'll have a similar error, but if you could also update to the current repo code you'll have a new function that maps f5. I'd like to normalize our test environments (yours and mine) before I start asking more detailed questions.

Thanks, Ethan

Reply to this email directly or view it on GitHub: https://github.com/altercation/solarized/issues/55#comment_992787

mattmartini avatar Apr 12 '11 23:04 mattmartini

Are you using pathogen? If not, did you put the script contained in autoload in an equivalent .vim/autoload directory?

altercation avatar Apr 12 '11 23:04 altercation

Yes, I am using pathogen. Pathogen is working for other bundles.

On Apr 12, 2011, at 7:59 PM, altercation wrote:

Are you using pathogen? If not, did you put the script contained in autoload in an equivalent .vim/autoload directory?

Reply to this email directly or view it on GitHub: https://github.com/altercation/solarized/issues/55#comment_992884

mattmartini avatar Apr 12 '11 23:04 mattmartini

Ok, I'll look into this some more.

altercation avatar Apr 13 '11 00:04 altercation

This should be fixed in the current code on github (as of the date of this post). I've changed ToggleBG. Also worth checking the new Solarized help section on this (:help solarized or :help togglebg ).

I'm closing this issue but PLEASE do reopen it if the new code doesn't fix the issue.

altercation avatar May 02 '11 18:05 altercation

It is better, but still does not work properly.

The first issue is that togglebg.vim is not getting autoloaded properly. I am using pathogen, but I have tested by placing togglebg.vim directly into the .vim/autoload directory and it still doesn't load. I have tested thes under Terminal vim (7.3p135), X11 vim (7.3p135) and MacVim (7.3p0). I know that solarized is there because I get a Solarized menu under MacVim.

Editing a file F5 does nothing and :ToggleBG gives the error: "E492: Not an editor command: ToggleBG " If I manually source the togglebg.vim file then F5/:ToggleBG work.

The second issue is that ToggleBG still does not function properly under X11. Here is what I'm seeing:

Terminal vim: F5/ToggleBG work as expected. The colorscheme toggles between light and dark solarized.

MacVim: F5/ToggleBG work as expected. The colorscheme toggles between light and dark solarized.

X11 vim: Does not work properly. Pressing F5 (or :ToggleBG) causes the background to turn dark (initally it is light) and the colorscheme becomes "default". Pressing F5 again and the background stays dark, but some of the text colors change, and the colorscheme stays "default". Subsiquently pressing F5 toggle between the two different versions of dark "default"

I can send you screenshots, or my .vimrc if that will help.

Matt

mattmartini avatar May 02 '11 20:05 mattmartini

I have the same issue when I set g:solarized_termcolors=256 g:colors_name does not exist after the first toggle.. Otherwise it works fine.

I'm using Terminator on Linux Mint 12 (Had the same problem on ubuntu 11.10).

erikzaadi avatar Feb 22 '12 07:02 erikzaadi

This still doesn't work in anything but MacVim, and even there you have to call togglebg#map("F5") to get it to load. Tested with vim 8.0.134 on iTerm2 (build 3.0.12), Terminal (2.5.3), XQuartz 2.7.11 (xorg-server 1.18.4), and MacVim 8.0.119.

The pull request above fixes the broken toggling although you still have to call togglebg#map("F5")

mattmartini avatar Dec 22 '16 18:12 mattmartini