for (g)vim, use the following:
set colorcolumn=80
or whatever width you wish. Works in both vim & gvim. I have mine within an IF so it's conditional based on which type of files I edit.
You may also use a +x/-x to base position of the column +/- from &textwidth.
set textwidth=80
set colorcolumn=-2
would effective draw the colored bar at char position 78. Of course, you may or may not set textwidth yourself, so it might be 0 (default). I use the absolute position form.
You may also change the color used if you wish:
highlight ColorColumn ctermbg=green guibg=orange
(I don't recommend THOSE colors though)
This option was added in (g)vim 7.3.
Problem is that coding Latin-2 (iso-8859-2) and Windows-1250 (used by windows) differ in some characters:
ž, š, ť, Ž, Š, Ť
All differences are summarized at Wikipedia or Czech version
If you set encoding=cp1250
, then it'll be ok.
I don't want to prolong comments so I'm adding that here.
There is a problem that standard code page uses only 1byte
(hex 100) for characters, so there are ISO standards for different languages.
If you have set encoding iso-8859-2
and trying to add unicode character (hex 160) Š
, than gvim loops over to character (hex 60). You have to use codes ISO-8859-2, where Š
ìs (hex 089). Other codes here: http://cs.wikipedia.org/wiki/ISO_8859-2
UTF-8 on the other hand uses 2bytes
and contains simultaineously all? letters and signs. So if you use set encoding=utf-8
and then add U0160
or U5927
you'll get Š
resp. 大
.
Fixedsys
contains ů and Ů, OR there is a difference in font versions between Windows language mutations (I use Czech version), but I doubt that. You can use windows utility Charmap.exe
, there you can select desired font and check which characters it supports, even their unicode code.
I was trying briefly some of default fonts in GVim and there seems to be some that supports Chinese (ie MS Mincho
), but I don't which signs are important.
GVim seems to be supporting only monospace
character fonts so, if you'll be searching for another font be aware of that. :)
Best Answer
The short answer is to open the file in Vim and then type "
:set fileformat=unix
" then write the file. From that point on, Vim should treat the file as Unix fileformat and only use newline characters instead of carriage-return+newline.The long answer is that this sometimes does not work, because when you open the file in Vim you see actual ^M characters at the end of most of the lines. In this case it could be for two reasons:
:%s/\%x0d$//g
then write.:help 'fileformats'
" (the single quotes are part of the help command).Finally, if you are using Vim on a Windows machine you may need to change the mentioned 'fileformats' option to "unix,dos" in your
~/_vimrc
instead of the default "dos,unix" that it is set to in DOS/Windows environments. This will cause Vim to create new buffers in the Unix format instead of DOS format. (Again, refer to the help for details.)