Solarized를 사용하는 iTerm2의 vim에서 잘못된 색상
터미널 vim (비 GUI) 및 태양 광 색 구성표에서 iTerm2에 이상한 문제가 있습니다. 먼저 iTerm2를 어두운 태양 광 색 구성표를 사용하도록 설정했습니다.
나는 또한 vim을 위해 solarized를 사용하고 있습니다. 내 .vimrc에 다음 줄이 있습니다.
set background=dark
colorscheme solarized
터미널에서 색 구성표가 잘못 보입니다.
참고로 이것은 MacVim (gui vim)에서 어떻게 보이는지입니다.
콘솔 vim에서 색상을 올바르게 표시하려면 iTerm 또는 .vimrc에서 무엇을 변경해야합니까?
확인해야 할 몇 가지 사항 :
iTerm2의 환경 설정-> 프로파일-> 터미널의 "터미널 에뮬레이션"에서 "보고서 터미널 유형 :"이 xterm-256color로 설정되어 있습니다.
.vimrc에는 256 색을 사용하도록 설정할 수있는 몇 가지 옵션이 있습니다.
그리고 그중 하나가 작동하지만 먼저 # 1입니다.set background=dark " solarized options let g:solarized_visibility = "high" let g:solarized_contrast = "high" colorscheme solarized
BUT, if you're using the default, built in vim on Snow Leopard, it won't work, as it's not built with support for 256 colors. I believe the built in version in Lion does.
Edit: Based on several comments on this answer, I've removed let g:solarized_termcolors = 256
line from the .vimrc
example above. It appears that could be a problem for some. Another says that adding the line let g:solarized_termcolors = 16
fixed a color display problem. Your own mileage may vary.
Second Edit: If you've loaded the solarized color palette into iTerm2, then you must let g:solarized_termcolors=16
. Only let g:solarized_termcolors=256
if you are not using the solarized palette as your iTerm2 color preset.
The above answers didn't work for me.
I'm using iTerm2 with vim 7.3 on OS X 10.7.4.
If the above solutions didn't work for you too, try this
syntax on
set background=dark
let g:solarized_termtrans = 1
colorscheme solarized
Update: According to Jim Stewart, this works on Kitty too.
https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized
Download Solarized package (https://github.com/altercation/solarized) and follow instructions:
Open iTerm 2, open Preferences, click on the "Profiles" (formerly Addresses, formerly Bookmarks) icon in the preferences toolbar, then select the "colors" tab. Click on the "load presets" and select "import...". Select the Solarized Light or Dark theme file.
You have now loaded the Solarized color presets into iTerm 2, but haven't yet applied them. To apply them, simply select an existing profile from the profile list window on the left, or create a new profile. Then select the Solarized Dark or Solarized Light preset from the "Load Presets" drop down.
====================================
Or:
cd ~/.vim/bundle
git clone git://github.com/altercation/vim-colors-solarized.git
Modify .vimrc
Dark Theme:
syntax enable
set background=dark
colorscheme solarized
Light
syntax enable
set background=light
colorscheme solarized
This worked for me in OS X 10.9.1 in iTerm 2 as well as Terminal. One mistake I was making was putting the colorscheme declaration before the termtrans and termcolors settings (and I needed both of these to make it work). As others have said, I set my terminal type to xterm-256color
if !has("gui_running")
let g:solarized_termtrans=1
let g:solarized_termcolors=256
endif
colorscheme solarized
set background=dark
I struggled with the same problem on OSX 10.11.6, iTerm2 Build 3.0.12.
Here is my fix for it.
.vimrc
syntax enable set background=dark colorscheme solarized
Set Report Terminal Type to
xterm-256color
.
- Set color preset in the profile to Solarized Dark
From the creator: http://ethanschoonover.com/solarized/vim-colors-solarized
IMPORTANT NOTE FOR TERMINAL USERS:
If you are going to use Solarized in Terminal mode (i.e. not in a GUI version like gvim or macvim), please please please consider setting your terminal emulator’s colorscheme to used the Solarized palette. I’ve included palettes for some popular terminal emulator as well as Xdefaults in the official Solarized download available from Solarized homepage. If you use Solarized without these colors, Solarized will need to be told to degrade its colorscheme to a set compatible with the limited 256 terminal palette (whereas by using the terminal’s 16 ansi color values, you can set the correct, specific values for the Solarized palette).
If you do use the custom terminal colors, solarized.vim should work out of the box for you. If you are using a terminal emulator that supports 256 colors and don’t want to use the custom Solarized terminal colors, you will need to use the degraded 256 colorscheme. To do so, simply add the following line before the colorschem solarized line:
let g:solarized_termcolors=256
Again, I recommend just changing your terminal colors to Solarized values either manually or via one of the many terminal schemes available for import.
Bill Turner's answer works, but there is a way to get the colors to match MacVim exactly. Solarized has support specifically for iTerm2, among other terminal emulators.
- Go to the iterm2-colors-solarized github page
- Follow the instructions under "Installation"
- Make sure your .vimrc has the line
colorscheme solarized
This should set the vim colors in iTerm2 to be exactly as they are in gui editors.
A simple way to solve this problem is:
In colors dir on vim-color-solarized exist an arquive named 'solarozed.vim'
Open this file and search:
exe "let s:bg_back = ' ".s:vmode."bg=".s:back ."'"
replace to:
exe "let s:bg_back = ' ".s:vmode."bg=".s:none ."'"
I tried all of the previous suggestions. I just added set t_Co=256
to .vimrc and it was fixed. I didn't need to create a tmux
alias or change my config file.
여전히 문제가있는 경우 iterm2 solarized color profile을 설치했습니다 . vim 번들에 vim-color-solarized 를 설치 하고 지침을 따르는 것은 불필요하고 호환되지 않았습니다. 위의 화면 캡처와 같이 재미있는 강조 표시 문제가있었습니다.
교훈 : 둘 다하지 마십시오.
참고 URL : https://stackoverflow.com/questions/7278267/incorrect-colors-with-vim-in-iterm2-using-solarized
'Development Tip' 카테고리의 다른 글
WebView에서 스크롤을 비활성화 하시겠습니까? (0) | 2020.09.25 |
---|---|
S3에서 10,000 개의 파일을 공개하는 방법 (0) | 2020.09.25 |
VS2017 / VS 2019 작업 표시 줄에서 관리자 권한으로 실행 (0) | 2020.09.25 |
Windows에서 GPG 파일을 해독하기 위해 개인 / 비밀 ASC 키를 내보내는 방법 (0) | 2020.09.25 |
ZSH iterm2 increase number of lines history (0) | 2020.09.25 |