How to highlight tabs and spaces in vim [duplicate] - vim

This question already has answers here:
Make Vim show ALL white spaces as a character
(23 answers)
Closed 7 years ago.
I want to highlight tabs and spaces. In sublime text I activated an "draw_white_space": "all" option. After that all tabs and spaces is highlighting.
I want to activate the same option in vim, but all what I used didn't work.
I tried set follow options:
set listchars=tab:--
set list
How is it possible to activate it, and how to make highlighting tabs and spaces the same sympols like in picture above?

As icwnd says use
set list
set listchars=tab:▸·
However you may find that you still cannot see the characters because they are the same color as the background. Adding the following will change the color of those characters
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
As Ben mentions, this does not work for spaces.
Edit
You can now do the same for spaces, see https://stackoverflow.com/a/29787362/1427295.

There is a vim plugin called spacehi which does that with tabs.
Download the spacehi.vim file, copy that into your ~/.vim/plugin/ folder, restart vim and activate/deactivate with F3.
If you don't want to use the plugin you could use this:
set list
set listchars=tab:--,trail:.,eol:¬,extends:>,precedes:<
For even nicer indentation also take a look at the vim-indent-guides.

Related

How to test if I my setting in vi is tabs or spaces

I set the setting in the vi file to spaces, and I want to verify that it is working correctly is there a way to test it ?
I know it is a trivial question but I am new to vi editor
take a look at :set list / :help list
you can set listchars like so:
set listchars=tab:>-,trail:~,extends:>,precedes:< " mark all kinds of whitespace
as an example, this setting will show tabs as > so you know where your tabs are.
useful links:
Make Vim show ALL white spaces as a character
http://vim.wikia.com/wiki/See_the_tabs_in_your_file

Remove tab dots from vim indentation/tabs

I am using spf13-vim and whenever I press tab, I get these dots. They are there even when I press space.
How I can remove these dots. I want the indentation to happen but without dots. I searched a lot on the web but there is no information available or I could not find.
What changes should I do in my .vimrc to hide these dots?
EDIT
I tried ,ig command or added let g:indent_guides_enable_on_vim_startup = 0 in .vimrc.local but I am still getting the dots.
EDIT
:set nolist worked for me, as suggested by #Christian Brabandt in the comments
What you want to do goes by the term disabling tab highlighting. More information is here:
spf13-vim disable tab highlighting
Add set nolist to ~/.vimrc.local to override default spf13-vim settings.
That behaviour is caused by the following lines in .vimrc (233, 234):
set list
set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
list mode is used to display whitespace and special characters, listchars allows to configure corresponding characters that will be displayed.

How to keep original program format when copying to vim? [duplicate]

This question already has answers here:
Turning off auto indent when pasting text into vim
(25 answers)
Closed 7 years ago.
there,
I found that every-time when I copy piece of code from eclipse into vim, the format will totally be screwed up, and the indentation will be broken by adding lots of tabs in vim. Could someone has clues about how to keep the original program format when copying to vim?
Try enabling paste mode:
set paste
You probably have a different set of tabstops in eclipse and in vim. Then when you have some tabs filled by spaces and others by tabs the spacing gets all messed up.
The default tabstop in vim is 8 spaces - either change that to whatever you use in eclipse or else change the eclipse tabstops to 8.
When I get started in a new environment the first thing I do in vim is this command:
:set ts=4 sw=4 et
That sets tabstops to 4, shiftwidth to 4, and expands tabs to spaces so that you don't have this problem if you open it with a different set of tabstops.

In VIM how do I change the backbround color of just the QuickFix window? [duplicate]

This question already has answers here:
How do I change the background color of current buffer or pane in vim?
(5 answers)
Closed 8 years ago.
Subject says it all: In VIM how do I change the backbround color of just the QuickFix window? Something that can go in a script or the .vimrc.
You can't do it directly, but you could cheat your way to it by using a colorcolumn at each column of text in that window. Of course, you also only get one global color for the colorcolumn, so that might not help much.
Another idea is to use signs. If you place a sign on every single line in the quickfix window, you can set the background color of each sign to color the entire window. Since this is window-local, and the coloring will be incorrect if the number of lines increases, you will also need to re-process the signs on autocmds. WinEnter, QuickFixCmdPost, etc. may be helpful. You could store the number of lines in a window-local variable and check for that variable doesn't exist or doesn't match the lines in the buffer to determine whether to do an update.

How do I stop vim from drawing horizontal lines in indentation/leading whitespace? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
VIM: Don't underline leading whitespace in HTML links
Some of my lines in vim are getting weird horizontal lines in the leading whitespace. I don't know why. Maybe a plugin I have installed?
Here's a picture
Only some lines get them. I've tried closing and opening the file.
Does anyone know how to turn this off?
Those lines are part of the underline syntax highlighting of hyperlinks. Notice that they occur inside <a> tags. Some colorschemes won't underline hyperlinked content inside <a>, but if you wanted to continue using the same colorscheme you would need to modify or override the HtmlHiLink directives in the html.vim syntax files.

Resources