Vim NERDTree colors - vim

I want to change default blue color of folders
How to set it?

:hi Directory guifg=#FF0000 ctermfg=red

If you want to customize file colors based on extension, I created this plugin. You can use it with vim-devicons, but If you don't have it, you can add this line to your .vimrc and it will highlight the filenames:
let g:NERDTreeFileExtensionHighlightFullName = 1

Not a heavy vim user, but, I think you can add the following to your .vimrc to highlight the folders/directories in Cyan
highlight Directory ctermfg=cyan
Have only tried this out in MacOS 10.14

NERDTree doesn't provide such an option but looking at the source
and reading about highlight you could come up with some customization.

Related

How to change specific 'theme' colors in vim

I would like vim to roughly match the color scheme of a python file in textmate. Here is a comparison of the two:
For example, I want a comment to be blue instead of red. If I have the hex codes for each of these colors, is there a place that I can change this in the vimrc or somewhere else? For example, how would I pass a hex code into the vim colorscheme:
" syntax highlighting
hi Comment cterm=NONE ctermfg=#ddd gui=NONE guifg=#ddd
hi Constant cterm=NONE ctermfg=DarkGreen gui=NONE guifg=green3
I was able to achieve what you wanted in two different ways, the first one was much simpler, I just added
hi Comment guifg=#ddd
into my vimrc just after the colorscheme [colorscheme name].
The second method is better for a big amount of changes and it's much harder. It bases around changing your colorscheme. You would do as follows:
Check what's your current colorscheme, by typing the command :colorscheme while in vim. if it's one of the defaults (blue.vim, darkblue.vim, default.vim, delek.vim, desert.vim, elflord.vim, evening.vim, industry.vim, koehler.vim, macvim.vim, morning.vim, murphy.vim, pablo.vim, peachpuff.vim, ron.vim, shine.vim, slate.vim, torte.vim, zellner.vim), then you need to go to $VIMRUNTIME/colors and edit which is yours. Otherwise check your ~/.vim directory for "colors" or search where you store plugins for the name of your theme. For example if you use vim-plug then plugins and themes are stored in ~/.vim/plugged. Copy the folder to not mess up the original theme and use a different name.
2.After opening the folder of your theme open the only file in it - [theme].vim and search for the item you want to change, e.g. "Comment", change the hex value of the color, background etc.
Repeat to your liking to the time you'll get your theme looking how you want it to.
Set your colorscheme via colorscheme [name-you-picked-earlier]
The second option is also useful for creating full themes suited just to you.

Changing background colors

Okay, I'm rather new to vim. I couldn't figure out how to change background colors. I'm editing my vimrc file to set these colors, but I couldn't find anything for background colors.
I'm using a color scheme and I just need to know how I could override it or what is to look for so I can change it in my colors/theme.vim file. I need to change two background colors. I point to them in the image attached.
As it turns out the big blue section is controlled by highlight NonText
I added my .vimrc file to this:
highlight NonText ctermfg=59 ctermbg=0 cterm=NONE guifg=#414e58 guibg=#232c31 gui=NONE
and that gave me exactly what I wanted.
VIM has some color scheme, which store under /usr/share/vim/vimcurrent/colors, and it named as desert.vim for example.
you can simply add one line in your vimrc file, which should be locate in your $HOME, if there is NOT, you can create one, and add:
colorscheme desert
also some command you can use to set the background color like:
set background=light
or
set background=dark
I think for SSH, light is better:) If you use X windows, I suggest to use bensday.vim, it can be download from web

Changing vim 'gutter' color

See the screenshot of how I have vim configured below. The 'gutter' i.e. where the '+' and '~' symbols appear show my git status using this amazing sublime text port for vim: https://github.com/airblade/vim-gitgutter
How do I change the color of the gutter where there are no '+'/'~' symbols? I.e. the grey part? This is how you change the number column: VIM initial settings: change backgound color for line number on the left side? but I can't find how to change the 'gutter' color.
Any ideas?
Many thanks.
This "gutter" is called the signs column. (See :help signs for more information.) The highlight group associated with this column is called SignColumn, and can be set like this (using the example from the help section):
:highlight SignColumn guibg=darkgrey
To change the color in your ~/.vimrc so that your gutter is the same color as where your line numbers show up is the following:
highlight clear SignColumn
The git-gutter docs have some other helpful suggestions.
Another option that hasn't been mentioned is to eliminate the sign column entirely and put the signs into the number column.
Adding this to your ~/.vimrc
set signcolumn=number
produces
(this is using custom symbols with the Ale plugin in iterm Vim).
This is available in "full" Vim versions 7.4.2201 or newer that include the +signs feature (I use the version installed by Homebrew on MacOS).
From the screenshot, I think you're using https://github.com/altercation/vim-colors-solarized/ as your colorscheme, as I was. Another solution for this particular case is to switch to https://github.com/ericbn/vim-solarized, as #altercation's version has a bunch of open PRs fixing that very issue and no changes in the last decade.

Setting vim omnicompletion colors (Pmenu) in vimrc not working

I am trying to customize my vim popup completion menu as per this guide:
Vim Wiki: "Omni completion popup menu". It notes
add to your vimrc if you always want this choice.
However, with the following settings in my .vimrc file
colo desert
filetype plugin on
set ofu=syntaxcomplete#Complete
highlight Pmenu guibg=brown gui=bold
I get the following:
Note: when I manually enter the highlight command manually, it works:
How do I get the popup to use a color scheme defined in .vimrc without having to enter it in manually each time?
if you put your commands in below sequence, you can get what you want. the syntax option will override your highlight option.
"" gui configuration
color murphy
syntax one
highlight Pmenu guibg=brown gui=bold
See vim - Override colorscheme
Short answer is that you can't. If you use a colorscheme, then all other color scheme tweaks in your .vimrc are ignored. The AfterColors plugin solved the problem for me.
Hmm, most likely there is a highlighting command coming afterwards that is overriding your option. Probably when the filetype is determined and adjusts options. Try running it without the filetype plugin on option set.
If that works, you'll need to adjust the filetype detection to run your special options afterwards.

What are good ways to highlight Tabs with color in Vim on Putty?

I always use putty to connect to Linux machines. I really want to make the Tabs in file visible in Vim.
I can have the Tabs highlighted in Gvim with the scripts below.
syntax match Tab /\t/
hi Tab gui=underline guifg=blue ctermbg=blue
However Vim with Putty, it doesn't work. I try to change gui to cterm, guifg to ctermfg. But still not work.
I know there is other way to make Tabs visible like the scripts below. The tabs will be displayed with ">----". However I don't prefer this way.
set lcs=tab:>-
set list!
Do you guys know any way to highlight Tabs with color in Vim on Putty?
set list allows you to see invisible characters, including tabs.
I added this stuff to my vimrc so that the characters look nicer:
set listchars=tab:▸\ ,eol:¬
The spacehi.vim plugin works for me in Putty connecting to a Linux machine.
The ctermfg and ctermbg options take a color number, not an English color name. Try 9. The table of numbers and their usual meanings is in vim's online help :help ctermfg
A workaround solution is if you do not prefer separate plugin..
Add the following scrpts in .vimrc:
function! HiTabs()
syntax match TAB /\t/
hi TAB ctermbg=blue ctermfg=red
endfunction
au BufEnter,BufRead * call HiTabs()
This will highlight all tabs even in vim help files....
Suggest use spacehi.vim.
Search for the tab special character
/\t
Also make sure Search Highlighting is enabled
:set hlsearch

Resources