i have tried to move my configuration of VIM in Mac to Linux Mint.
However, the default font of gvim cannot be set. I have already put set guifont=Monaco:h14 into my .vimrc and I have also downloaded the font into my system. I have checked out this question, the verbose command can be used to find the setting of gui_font. I used the verbose command and the result pointed to my .vimrc.
The most interesting part is that I can set the gui font by the same command: set guifont=Monaco:h14 in the running environment of gvim.
You are using the wrong format.
This format:
set guifont=Monaco:h14
is for Mac OS X while you should use:
set guifont=Monaco\ 14
on Linux.
Everything is explained very clearly in :help 'guifont'.
Hint #1: you can do :set guifont=* to open a GUI dialog, once you have chosen your font you can simply do :set guifont to see the correct string to use in your ~/.vimrc. Don't forget to escape spaces.
Hint #2: this other answer shows you how to make different platform-specific settings.
Related
I am new to tmux and also not an expert on VIM, I tried to use tmux these days, but seems that airline disappeared when I used vim inside tmux. I would like to show you the screen shots and hopefully anyone can help me solve this problem.
airline in vim
airline inside tmux
You need to correctly set $TERM environment variable to make vim properly detect 256 colors support by doing the following before opening vim:
export TERM=screen-256color
While the accepted answer works, it is not cheap. Manually setting the value of the $TERM variable will usually be set correctly by itself.
It is usually a good a idea to force tmux to assume the terminal supports 256 colors.
In your ~/.bash_aliases, add:
tmux='tmux -2'
Answer based on the following posts:
What is the difference between screen-256 color and xterm-256color
tmux vim colorscheme background is not showing
Add the following line in your .tmux.conf
set -g default-terminal screen-256color
In my case, using ubuntu 20.04 inside windows with WSL2, the accepted answer (export TERM=screen-256color), just freeze the tmux pane.
The fix for me was add to ~/.vim/vimrc:
set t_Co=256
I've googled it for hours but I can't find a solution.
I use raspian, on a raspberry pi and I want to have colorscheems work on it.
Default terminal in raspian seems to be set at 8 colors as when I enter
tput colors
I get 8.
I'm sure there must be a way to have the term work with 256 colors but I don't know how. Anyway I set tmux in the config file to support 256 colors, so I created a .tmux.conf file in my home directory and have
set -g default-terminal "screen-256color"
now if I check with tput within tmux I get 256.
Anyway I know you can set VIM to force think you support 256 color by adding
set t_Co=256
but this seems to make no actual change.
If I run this color test
:runtime syntax/colortest.vim
in normal terminal from raspian I get only 8 different colors. If I do this on tmux I get more but not all of them because some of them (red and lightred for example) still look the same.
did you add set t_Co=256 after the line colorscheme <yourColourScheme>? That was a problem I had early on.
Let me know if you're still having trouble, because I managed to solve a similar problem (only I'm using MobaXterm and GNU screen), and wouldn't mind the excuse to dig into this a bit more.
I was having a similar problem and have solved it with the following setup. .zshrc on my OSX laptop contains:
TERM=xterm-256color
after I ssh into raspbian, tput colors returns 256. On raspbian, I don't have TERM explicitly set (which means it pulls it from ssh), and have the following in .tmux.conf:
set -g default-terminal "xterm-256color"
Then after I do tmux (and I don't even need the -2), tputs colors still reports 256 colors and vim looks right. I am using vanilla solarized with no edits in .vimrc or elsewhere in the vim configs.
Here is my .vimrc
1 syntax on
2 set ts=4
3 set number
4 set smartindent
5 set shiftwidth=4
However, I tried to edit HelloWorld.java and HelloWorld.c. Both have pure regular black font. No any highlighting!
I also tried :syntax on after the vim is open, but no luck.
\>vim -version
VIM - Vi IMproved 7.3 (2010 Aug 15)
\>cat /etc/*-release
openSUSE 11.4 (x86_64)
VERSION = 11.4
CODENAME = Celadon
When you edit the file, are you using
vim filename
This can matter. In some server configurations, if you do vi filename you get vim, but it's a very stripped down version of vim that is very much like the original vi (which does not, among other things, do syntax coloring). On a system configured in this way, if you instead type vim filename, you get the full featured vim.
I just worked through this with a person who was on a server that had the vim-minimal package installed as well as another vim package. I suspect (but did not verify that) the vim-minimal package installed its executable as /bin/vi.
The difference was very clear when you looked at the actual files (i.e. ls -l /bin/vi vs ls -l /usr/bin/vim)--one was about ten times the size. Both of them were actually vim, same version number and everything, but the /bin/vi one was compiled with very few features enabled.
To make it even more confusing:
vi existing.pl
opened the .pl file, gave no syntax coloring
vi [enter]
gave the vim splash screen, and from there
:e existing.pl
opened the file with syntax coloring on.
A comment from Jan Wilamowski suggests checking by doing:
vi --version
If that shows that the syntax feature was not compiled in, try
vim --version
and see if it is compiled in there.
You'll need to install the vim-data package on openSUSE for vim syntax colouring to work.
Sounds strange, I know that this is not pulled in by default with the vim package but AFAIK it's for people who want to create tiny base installs.
Package vim-data contains the runtime files.
Also make sure your remote environment has an appropriate TERM variable set TERM=screen-256color, TERM=xterm, TERM=xterm-256color should all work just fine with ssh and ssh with screen/tmux.
If all above have been done and you see some underlines and bold instead of actual colors... this might work for you:
export TERM=xterm-color
in your .vimrc, I don't see filetype setting. you could try to add:
filetype plugin indent on
to your vimrc.
if you don't have set nocp, add this line too.
if you read :h filetype
:filetype on
Each time a new or existing file is edited, Vim will try to recognize the type
of the file and set the 'filetype' option. This will trigger the FileType
event, which can be used to set the syntax highlighting, set options, etc.
For some strange reason on MacOS, 'syntax on' must be the first line in your .vimrc file. The line appears to be ignored if placed elsewhere in the file.
One item not mentioned is :set syntax=<type>, e.g. :set syntax=markdown.
This has been successful in instances where other techniques above were not.
I really apologize because I know that this question has been asked multiple times. I have gone through all of the previous questions, but I still have yet to have any luck setting up the Solarized colorscheme in my Terminal.app for OS X Mountain Lion. So far this is what I have:
My .vimrc currently is set up like the following:
set number
syntax enable
set background="dark"
colorscheme solarized
but for my MacVim I get this:
This is what I would like to have my Terminal.app display as well. The only thing that my .vimrc says for MacVim is
colorscheme solarized
Edit
After I had asked this question, I eventually moved to iTerm2, which proved to be much nicer.
I'm not 100% sure, but I think the newer versions of OS X terminal will support 256 colors out of the box.
I had the same issue, then I downloaded an alternate implementation of the Solarized theme for the Mountain Lion terminal, and this appears to have solved it.
Just add let g:solarized_termcolors=256 to your vimrc
Ensure that TERM is set to xterm-256color to let Vim know that the terminal supports 256 colors. This is the default for Terminal in Lion 10.7 and later†, so your preferences were customized at some point.
To tell Terminal to set TERM to a different value, go to
Terminal > Preferences > Settings > [profile] > Advanced
and change Declare terminal as: to xterm-256color.
[Note that all this preference does is set the value of the TERM environment variable. It does not alter the behavior of Terminal or affect what sort of terminal it emulates.]
† Prior to Lion, the default was xterm-color.
Add to your ~/.vimrc
" Solarized Dark
syntax enable
set t_Co=256
let g:solarized_termcolors=256
set background=dark
colorscheme solarized
This works on both ansi and xterm-256color versions of Solarized. Tested on Terminal 2.3 on a new OS X 10.8.5 VM installation.
NB This answer supersedes the previous one that proposed changes to the profile swatches. I recently realised I had these commands in my .vimrc file that actually configured Solarized.
To run vim with 256 colors you must use a 256 color terminal. You can set your terminal to xterm-256color, for example, with export TERM=xterm-256color and then start vim. You can export this $TERM setting in one of your terminal startup scripts (e.g. .bashrc, .zshrc, etc.).
It may seem counterintuitive, but use set g:solarized_termcolors=16. This is confirmed to be the correct setting with :h solarized.
I'm trying to get the following into my .vimrc
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
Those lines are from here are worked perfectly in vim 7.2
I recently compiled and installed vim 7.3 and now those characters aren't understood by vim.
Also: Ctrl+V then U in insert doesn't let me insert any characters, it just seems to ignore that.
Any ideas?
This is what I see:
set listchars=tab:�~V�\ ,eol:¬
You need to compile vim with multi-byte support.
The easiest way to do this is to run
./configure --with-features=big
make
This will build vim with the correct support.
You can verify that it was compiled correctly with
:version
in vim or by running
vim --version
and looking for +multi_byte. If it says -multi_byte it will not work.
I have the following in my .vimrc
scriptencoding utf-8
set encoding=utf-8
and that in my .gvimrc
set listchars=trail:·,precedes:«,extends:»,eol:↲,tab:▸\
and works fine(notice there is a space after the ▸\ ).
I had the same issue with the vim that ships with OS X Lion although it was compiled with multi_byte.
The issue was the encoding used by vim. I added set encoding=utf-8 in my ~/.vimrc and the issue was solved.
Ref: Terminal Vim redraw issues in OS X Lion
Make sure you're using a compatible font. My problem was that inconsolata-g does not support the utf-8 characters in my document.
also, this was all I needed in my gvimrc:
set enc=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf8,prc
set guifont=Monaco:h14
set guifontwide=NSimsun:h14
I had this issue while being in a screen session.
It's gone with setting the following in my .bashrc:
export LANG=en_US.UTF-8
Don't forget, if you're running vim in a terminal, make sure the terminal itself is using utf-8 as well.
When all else failed, telling vim to save with UTF-8 encoding seemed to work (for now at least):
:write ++enc=utf-8
Do you need a
scriptencoding utf-8
or whatever encoding your .vimrc is actually in?
The accepted answer didn't work for me. Working off of the downloaded source on a Mac running Lion, I went into the src directory and ran:
make clean
export CONF_OPT_MULTIBYTE='--enable-multibyte'
make reconfig
Running: ./vim --version to check for +muti_byte then:
make install
Via: http://vim.1045645.n5.nabble.com/compiling-vim7-1-huge-version-gets-build-with-normal-version-td1162314.html