Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show whitespace characters in gvim

Tags:

vim

whitespace

Is there an easy way to display whitespace characters such as space and tab in gvim? Something like what is implemented in Gedit, Geany, Komodo, and other GUI editors where (when the option is turned on) spaces show as a muted or greyed-out '.' and tabs as '-->'.

like image 721
memilanuk Avatar asked Feb 14 '11 23:02

memilanuk


People also ask

How do I check space in Vim?

To see all the spaces inserted within this file of data, you need to add the “hls” command on the command area of Vim. So, after adding the text within the Vim text file, navigate towards the normal mode by pressing the Esc key. Press the “:” character to open the command area.

How do I show tabs and spaces in Vim?

set tabstop=4 : tells Vim to display 4 spaces on the screen wherever there is a Tab character. set expandtab : tells Vim to insert 4 spaces instead of a Tab character when user press <Tab> on insert mode.

How do you highlight a space in Vim?

With the following, and the default backslash Leader key, you can type \wn to switch highlighting on, and \wf to switch it off. With Vim 7.1. 40 and later, you can use the matchadd() function to define matches (making the :match command available for other purposes).

How do I see tabs in GVim?

Of course, if you're using Vim's GUI, GVim, you can also use the mouse to switch between tabs or use keyboard shortcuts. In GVim, you can also access a context menu for tabs by right-clicking on the tab bar. Here you can open new tabs with a new buffer or an existing file, or close the current tab.


1 Answers

Check out listchars and list options in Vim. An example use of this feature:

" part of ~/.vimrc " highlight tabs and trailing spaces set listchars=tab:>-,trail:- set list 
like image 175
Marek Sapota Avatar answered Oct 01 '22 04:10

Marek Sapota