Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gvim display underscore as space

Tags:

vim

The gvim installed in my gentoo linux can not properly display underscore (_). Once it is typed, the screen displays a whitespace, same as the output after pressing space key. However, one can still distinguish underscore from white space by searching underscores (e.g., :/_).

Interestingly this problem does not applear in vim, as both underscore and white space can be displayed properly.

here are the version information for gvim and vim:

gvim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 20 2014 12:49:32)
Included patches: 1-762
Modified by Gentoo-7.3.762
Compiled by [email protected]
Huge version with GTK2-GNOME 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_gui +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_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +multi_byte +multi_lang 
-mzscheme -netbeans_intg +path_extra -perl +persistent_undo +postscript 
+printer +profile +python -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_interact +xterm_clipboard -xterm_save 
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/vim/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2  -D_REENTRANT -DORBIT2=1 -pthread -I/usr/include/libgnomeui-2.0 -I/usr/include/gnome-keyring-1 -I/usr/include/libbonoboui-2.0 -I/usr/include/libxml2 -I/usr/include/libgnome-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/orbit-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gail-1.0 -I/usr/include/libart-2.0 -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/gnome-vfs-2.0 -I/usr/lib64/gnome-vfs-2.0/include -I/usr/include/gconf/2 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include    -O2 -pipe -march=native -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: x86_64-pc-linux-gnu-gcc   -Wl,-O1 -Wl,--as-needed -L/usr/local/lib -Wl,--as-needed -o gvim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfreetype -lfontconfig   -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBit-2 -lgnomecanvas-2 -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lfreetype -lfontconfig -lgdk_pixbuf-2.0 -lgnomevfs-2 -lgconf-2 -lgthread-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lelf   -lacl -lattr -lgpm -ldl     -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic
vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 19 2014 22:06:12)
Included patches: 1-762
Modified by Gentoo-7.3.762
Compiled by chenming@mybox
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset 
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info 
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff 
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_
+find_in_path +float +folding -footer +fork() +gettext -hangul_input
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispi
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mous
+mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_sgr -mous
+mouse_urxvt +mouse_xterm +multi_byte +multi_lang -mzscheme +netbean
+path_extra -perl +persistent_undo +postscript +printer +profile +py
-python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs +sma
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobj
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextr
+vreplace +wildignore +wildmenu +windows +writebackup +X11 +xfontset
+xsmp_interact +xterm_clipboard -xterm_save 
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H  
Linking: x86_64-pc-linux-gnu-gcc   -Wl,-O1 -Wl,--as-needed -L/usr/lolICE -lm -lncurses -lelf -lnsl   -lacl -lattr -lgpm -ldl     -L/usr/xport-dynamic      
like image 391
Chenming Zhang Avatar asked Feb 23 '14 05:02

Chenming Zhang


People also ask

Why underscore is not visible in Gvim?

Once it is typed, the screen displays a whitespace, same as the output after pressing space key. However, one can still distinguish underscore from white space by searching underscores (e.g., :/_). Interestingly this problem does not applear in vim, as both underscore and white space can be displayed properly.

How do I write an underscore in Vim?

ct_ will change up to the underscore and leave it be. cf_ will change up to the underscore and eat it as well. Alternatively, you can use set iskeyword-=_ which will make the “_” character a valid word boundary.


1 Answers

That may caused by squashed line spacing. Try to run :set linespace=5 to increase the line spacing

like image 88
Chenming Zhang Avatar answered Oct 25 '22 10:10

Chenming Zhang