Vim split bar styling - vim

How do I style or remove the grey bar that appears on window split?

You'll need to edit your colorscheme. The highlight group is VertSplit.
If you want to get rid of the pipe characters you can set ctermbg and ctermfg to the same value.
Additional information on styling vertical split borders*:
*Taken from ib. answer below.
In order to get rid of | characters, one should rather change vertical separator using:
:set fillchars+=vert:\
(note the significant whitespace after the '\' character)

highlight VertSplit cterm=NONE

I kind of tweak it a little to make it look like there is no splitbar with something like this
hi LineNr guibg=bg
set foldcolumn=2
hi foldcolumn guibg=bg
hi VertSplit guibg=bg guifg=bg
Note that I'm using gvim so I'm using guibg to change the background guifg to change the foreground with the same color of my vim's background, if you're not using a gui and you're on terminal vim you should change the guibg and guifg parameters for ctermbg and ctermfg

If you add a comment with " after the whitespace, you don't have a trailing white space. I don't like these, so my vim config shows them (vim-airline plugin) and I remove them regularly.
:set fillchars+=vert:\ "White space at the end

Related

vim - show whitespace for selection only

Is it possible to show whitespace characters (space, tabs, newlines) only in visual mode, specifically in the selected text?
Or is there already a nice plugin that does the job?
Depending on how the highlighting is set up for visual mode, it is possible to set the foreground color of your white space characters to the background color of the window.
This is a sample Normal highlight group (taken from my own colorscheme) which defines the background color of the whole window:
hi Normal ctermbg=235 ctermfg=250 guibg=#262626 guifg=#bcbcbc cterm=NONE gui=NONE
The values we want are 235 for color terminals and #262626 for the GUI.
This is a sample Visual highlight group. It's only one foreground color on one background color:
hi Visual ctermbg=110 ctermfg=235 guibg=#8fafd7 guifg=#262626 cterm=NONE gui=NONE
The colors themselves don't really matter.
This is how we could set up the SpecialKey highlight group, using the values above:
hi SpecialKey ctermbg=NONE ctermfg=235 guibg=NONE guifg=#262626 cterm=NONE gui=NONE
And this is how it should look:
You'll need to edit your colorscheme for this to work across the board or to add this to your vimrc:
augroup colors
autocmd!
autocmd ColorScheme * hi SpecialKey ctermfg=235 guifg=#262626
autocmd ColorScheme * hi NonText ctermfg=235 guifg=#262626
augroup END
Of course, the colors above are are just an example; YMMV.
The "list" option in Vim will show whitespace characters:
List mode: Show tabs as CTRL-I is displayed, display $ after end of
line. Useful to see the difference between tabs and spaces and for
trailing blanks.
See:
:help list
That being said...
This isn't exactly what you want, but Tim Pope's unimpaired plugin provides a very easy way to toggle off the "list" option (among many other options).
When the
So, if you need to take a quick glance at those whitespace characters you can toggle them on/off with:
col
I consider unimpaired an essential, very light-weight plugin (basically just a set of mappings)
It is not possible, to permantly switch the display of the visual selection to enable the list mode, while the rest of the buffer does not have list set.
A workaround however is, after visually selecting some lines, press : so the command line looks like this: :'<,'> and then just use the :list command (which can be shortened to :l). So using :'<,'>l will echo the selected range of lines as if the list setting has been turned on. This however works only linewise, so it is not possible to only print the block selected region.
See the help at :h :l.

Vim higlight : multiple values to a key

I want to make vim not only bold my current line but also to underline it.
My current .vimrc looks like this:
hi cursorline term=bold cterm=bold guibg=Grey40
set cursorline
is it possible to add a value to my cterm?
Something like
cterm=bold&underline
OR
cterm=bold cterm+=underline
Thanks
You should use a comma:
cterm=bold,underline
as explained in :help attr-list:
attr-list is a comma separated list (without spaces) of the
following items (in any order):
bold
underline
undercurl not always available
reverse
inverse same as reverse
italic
standout
NONE no attributes used (used to reset it)

Set vim bracket highlighting colors

I'm using :set showmatch to highlight the matching bracket or brace when the cursor is over one.
I'd like to change the highlight-color so that it's radically different from the cursor color, because I've got the situation shown in the screenshots.
When the cursor is over the second brace:
and when the cursor is to the immediate-right of the brace:
This uses my terminal color scheme, which is taken from Solarized. Unfortunately, it's a bit of a pain to see which highlight is the brace matching and which is the cursor, when the braces are close together.
Is there a vim setting I can use to change the color of that to, say, the bold magenta ANSI? I'm not particularly interested in remapping my ANSI colors within the terminal or shell - I'd like a vim-specific option, if it exists.
you can change the colors to, e.g., blue over green
hi MatchParen cterm=none ctermbg=green ctermfg=blue
just put it in your vimrc file.
basically, cterm determines the style, which can be none, underline or bold, while ctermbg and ctermfg are, as their names suggest, background and foreground colors, so change them as you see fit.
for your case, you may want
hi MatchParen cterm=bold ctermbg=none ctermfg=magenta
I'm using the vividchalk color scheme with macvim, and none of the various solutions I tried worked for me. But I searched the file:
~/.vim/colors/vividchalk.vim
for MatchParen and I found this line:
call s:hibg("MatchParen","#1100AA","DarkBlue",18)
I commented out that line, then I copied that line, and I changed it to:
call s:hibg("MatchParen","#FF0000","Red",18)
which succeeded in highlighting the matching parenthesis in red, which is a LOT easier to see. I hope that helps someone else.
If you want to briefly jump to the opening bracket/paren/brace when you type the closing bracket/paren/brace, then adding:
set showmatch
to ~/.vimrc worked for me.
A very handy trick is setting the cursor on a bracket/paren/brace and then typing % to jump to the matching bracket/paren/brace. That is especially useful when the matching bracket/paren/brace has scrolled off the page. Typing % a second time will jump back to where you came from.
Try :!ls $VIMRUNTIME/colors these are default color schemes Vim supply. Than change color scheme :colorscheme name find color scheme that You like and copy color scheme :!cp $VIMRUNTIME/colors/<name>.vim ~/.vim/colors/new_name.vim edit it and set with color scheme command or better add colorscheme name to vimrc file. After changes to color file :colorscheme name reloads Vim's colors. It's handy :vsp vim, edit colors file in one half, check changes in other. I used nye17 answer and add hi MatchParen line to my color_file.vim it work's just fine.
Links:
Vim help
How to control colors
About Termianl colors
The colours that I use for vim highlighting, (from my ~/.vimrc):
" set sensible highlight matches that don't obscure the text
:highlight MatchParen cterm=underline ctermbg=black ctermfg=NONE
:highlight MatchParen gui=underline guibg=black guifg=NONE
NONE uses the character colour from the
:colourscheme ron (or which ever you prefer from :!ls $VIMRUNTIME/colors )

In Vim can you stop the color change of white space characters with 'set cursorline' on?

In this Vim screenshot you can see that when moving the cursor over a line it changes the normal color of the whitespace characters (shown on the left) from grey to black. Can I stop this and leave them showing grey always, regardless of cursor position?
I've tried setting these in the colour scheme but no luck:
hi SpecialKey guibg=bg guifg=#CCCCCC gui=none
hi NonText guibg=bg guifg=#CCCCCC gui=none
You can use :match to highlight the tabs.
:match NonText '^\s\+'
That seems to override the cursor line. It would be better of course to use matchadd() but it seems to be overriden by the cursor line. There might be a way to make it work
Following lines in .vimrc fixed the problem for me.
au VimEnter * call matchadd('SpecialKey', '^\s\+', -1)
au VimEnter * call matchadd('SpecialKey', '\s\+$', -1)
It overrides other styles application for tabs and trailing spaces inside a cursor line.
Yes you can. From :help listchars (at the end):
The "NonText" highlighting will be used for "eol", "extends" and
"precedes". "SpecialKey" for "nbsp", "tab" and "trail".
With this knowledge you can modify your color scheme accordingly or add a call to highlight in your vimrc.
I believe you have 'cursorline' set. The CursorLine highlight group defines the highlights for the same. Either you set nocursorline, (which can speed line movements) or change the CursorLine highlight groups fg colors.

How do you change the background color of the empty tab space in vim?

In vim, when you create a new tab, the tab bar appears at the top of the screen. On the left are all your tabs, on the far right is an "X" for closing the tabs. In between, there is "empty" space, that on my screen appears white.
I'll admit, I'm very picky about how my terminal looks, and this bright white bar at the top of the screen is distracting. Is it possible to change this color to black, or maybe even gray?
TLDR;
For a black tab bar (color 0)
:hi TabLineFill term=bold cterm=bold ctermbg=0
Explanation
Use vim's highlight command to set the attributes you want on the TabLineFill group.
This command will show you a list of all the current groups and their highlight attributes.
:hi
Find TabLineFill, and next to it you will see a preview of how your "tab line" will appear. Also note the attributes on this line.
In order for the color you want to be displayed, the attribute representing your terminal needs to be set to "bold". The two options are "term" and "cterm". If your using vim in a color terminal, then cterm will apply, otherwise term will apply. Set these attributes to bold like this:
:hi TabLineFill term=bold cterm=bold
The attribute "ctermbg" may or may not appear on the TabLineFill line, but it is used to define the color of the terminal background. See the list of cterm-color options by typing:
:help cterm-colors
Choose a color (for unobtrusive, I recommend 0, which is Black), then set the ctermbg attribute to the code for that color:
:hi TabLineFill ctermbg=0
This can all be combined into one single command:
:hi TabLineFill term=bold cterm=bold ctermbg=0
Try the following: (you can put that in your .vimrc)
:hi TabLineFill ctermbg=100
you can play with the colors and choose one that you like.
If you came here looking to change colours of the tab character, you want this:
:highlight SpecialKey guifg=<color> ctermfg=<color>
Since this is the first google result for "vim tab background color":
TabLineFill's ctermbg doesn't do anything for me. Set ctermfg=N where N is the desired background color. Don't set ctermbg, and definitely don't set ctermbg=ctermfg as this creates a white background.
That color is controlled by the current colorscheme. You can use :colorscheme to change schemes and find one you like (that has a better color for that area). You can see some sample schemes here (albeit without a tab bar shown).
vi, set the background color of tabs:
Manually in vim at the vim command terminal:
:syn match Tab "\t"
:hi def Tab ctermbg=darkgreen guibg=#003000
I used the following commands in the vim syntax file to make the changes permanent: (they didn't work in the ~/.vimrc nor the colors/monokai.vim colorscheme files)
syn match Tab "\t"
hi def Tab ctermbg=darkgreen guibg=#003000
I got these results:
Alternatively, There is a syntax highlighting scheme called: "whitespace.vim" that manipulates these background colors. It should just work and you can see it in action by using the command:
:set syntax=whitespace
It has custom colors for the various types of whitespace, you can follow that and see how it works to copy it.

Resources