English 中文(简体)
2. 不改变背景的颜色
原标题:vim colorschemes not changing background color

我试图在网上看到的各种肤色计划。 无论我选择什么办法,背景仍然是白色的,尽管适用办法的筛选显示,背景应当有色。

In some schemes, some of the background change color, but space right of lines containing text still remains white.

Im 采用Vim 7.2 on。 我刚刚开始用非基应用程序做饭,因此,所有东西都应远远超出箱子。

终端窗口的总体环境是否与它相关?

一切照旧。 只有在从终点站开始时,才有奇怪。

问题回答

我在我的先令中就这样了,在我使用普特雅时,我就解决这个问题。

set t_Co=256
set background=dark
colorscheme mustang
highlight Normal ctermbg=NONE
highlight nonText ctermbg=NONE

重要的是,要把彩色装在地圈之前,因为它们必须超越古特西姆确定的那种环境。 这还意味着,在Vim运行期间,你可以转而工作。

我再补充我的第二个答案,因为它与我的第一个回答截然不同,并且可能指出实际问题。

If you look at the actual website for the colorscheme here: Molokai website

你会看到一个与你非常相似的问题。 这里给出的答复,其中表示试图指挥<代码>:t_Co=256,载于你正文中,看它是否固定了:

"- Make sure you’re using a console terminal capable of 256 colors; not all of them do (particularly on mac). You might need to explicitly force Vim to use that by doing “set t_Co=256″ on your .vimrc file. - The windows console is well… totally unsupported, that only does 16 colors so it’s a mess"

在表1中,I有export TERM=xterm-256color,载于我的<代码>.bashrc。 这使人心想像(在建立<条码>后,t_Co=256):

“Vim在固定“TERM”变量之前看花角”。</p

当我从我的<代码>.bashrc上删除这条线并开启一个新的终点站时(exec bash don t. 这是我得到的:

“Vim在固定TERM变量后看花角”</p

终点站通常限于256个肤色,而地静止轨道仅受其台环境的色深度的限制,通常为2^32。

因此,即使周围有许多色谱法,但暗含的是,它们常常是为德国马克设计的,并且为终点站赢得了打工。

如果在上看彩色计划,就经常提到全球倡议或256。 因此,你们必须选择根据具体情况使用哪类物品。

To convert a GUI scheme to terminal you can use the following plugin : CSApprox.

您也可以根据具体情况使用不同的彩色,在座标上添加以下内容:

if has("gui_running")  
    colorscheme [using any color you want]  
else  
    colorscheme [using 256 colors]  
endif  

我认为,问题可能是因肤色而改变违约。 我审视了一些仅仅通过下列方式确定违约的图象:

set background=light

set background=dark

Not sure what limitations of those are. I don t think those work in terminals.

In any case, you should be able to manually set background in a terminal by using the Normal highlight. Insert it into a spot before most of the hi commands in the colorscheme file and it should provide defaults they will work with. F或example:

hi Normal ctermbg=White ctermfg=Black guifg=Black guibg=White

Change ctermfg (col或terminal foreground) and ctermbg (col或terminal background) to be whatever you want (或whatever col或you were expecting to see in the colorscheme but now aren t seeing). (Remember, though, if the colorscheme already has a setting f或hi Normal then this probably isn t your problem.)

F或ctermbg and ctermfg you can enter col或names, but I think there is only a fairly limited number: Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta Brown, DarkYellow LightGray, LightGrey, Gray, Grey DarkGray, DarkGrey Blue, LightBlue Green, LightGreen Cyan, LightCyan Red, LightRed Magenta, LightMagenta Yellow, LightYellow White

Otherwise you should be able to use a number from 0 to 255 in place of the col或name. Or this script gives rough idea, and lets you see how you could also set up to use more col或names: Vim script with col或settings

Also, there are a number of scripts that help you use 或convert colorschemes written f或gui f或use with cterm. E.g.,:

Colorscheme support f或cterm

Does the overall settings f或the terminal window have something to do with it?

Maybe, but I m pretty sure a properly written Vim colorscheme will override any terminal settings you ve made. At least they do f或me in Windows and on Ubuntu. . .

You need to add set termguicolors to your ~/.vimrc

我测试了<条码>t_Co=256和其他选择,但无。

在此之后,您可使用<条码>、bg=光或<条码>、bg=dark<>/条码>,看上去看 w(有些彩色计划接受两种选择)。

这里是一份符合术语表的终端清单:

Does the overall settings for the terminal window have something to do with it?

是的,终点参数高于正轨参数(至少在OSX和iTerm)。 例如,我有以下文字:

setBackground() {  
  osascript -e "tell application "iTerm"  
    set current_terminal to (current terminal)  
    tell current_terminal  
      set current_session to (current session)  
      tell current_session  
        set background color to $1  
      end tell  
    end tell  
  end tell"  
}  

vim() {
       (setBackground "{65025,65025,65025}" &)
       (exec vim $*)
}

以上重新绘制了终点站指挥图,以便在执行行动之前进行背景色变。 背景彩色功能是缩略语(I copied the script from some where...)。 它是临时的。 我的寿命是,你可以适应终点站的工作(连锁产品+pple->应当工作)。

br,
Juha

如果你使用<<>Vim,通过SSH:

  1. 添加到您的地方<代码>。

    export TERM=xterm-256color
    
  2. 摘自.bashrc any TERM各项定义。

如果您使用相同的<代码>.bashrc ,则使用临时环境变量和ever set TERM。 全球:

alias color-ssh= TERM=xterm-256color ssh user@host 

对我来说,这是为了改变背景:

colorscheme hemisu
function! g:ToggleBackground()
  if &background !=  dark 
    set background=dark
  else
    set background=light
    colorscheme hemisu
  endif
endfunction
nnoremap <silent> <F3> :call g:ToggleBackground()<CR>

并尝试为诸如<代码>ctermbg=231等内容提供轻背景,以便tmux能更好地处理。

I have similar issue that the background color of indentation guides (nathanaelkane s vim-indent-guides) cannot be displayed in my Windows Cygwin s mintty terminal.

我用一个线路(Term=xterm-256color)在~/.minttyrc(等值通过权宜选择组:终点站->类型->xterm-256color )。 出口密码=xterm-256color。 如无此,则导致“TERM=“xterm”的缩略语,从而形成“条码” = 8(而不是<条码>t_Co=256),不能显示某种背景。

http://www.hchr.org。

  1. echo $TERM in bash should give xterm-256color.
  2. in vim, :set t_Co should give t_Co=256.




相关问题
Autoupdate VIM Plugins?

Is it possible to update vim plugins automatically?

how to unindent in vim without leaving edit mode?

I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

Vim - Deleting XML Comments

How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...

Limiting a match in vim to certain filetypes?

I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...

Profiling Vim startup time

I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...

热门标签