I have an error while installing Vim, if you know how to recover please guide me! Thanks you!
It looks like you are using the vim-airline plugin for a status line.
The [No Name] string is the name of the current buffer. If you opened up vim without an argument, it opens up a buffer that has no name until you save it.
The [dos] string is probably showing the filetype of your buffer (I don't know why the default is dos though).
The funny characters between NORMAL and [No Name] are where vim-airline puts powerline font characters. If your font can't support these characters, then turn off powerline characters with this in your ~/.vimrc.
let g:airline_powerline_fonts = 1
Related
I'm running gVim 8.2 with default configuration on Windows 7 with russian language (so all the system text and menu items are in russian). When I open a utf8 file with russian text in it, it's displayed incorrectly in cp1251 for some reason:
:set encoding?
encoding=cp1251
manually setting :set encoding=utf8 fixes it.
Other encoding-related options have following values:
:set fileencoding?
fileencoding=
:set fileencodings?
fileencodings=ucs-bom
I find vim help confusing here, because it doesn't seem to explain how it guesses the encoding. For some reason other applications I tried (Notepad++, Sublime Text 4, even Windows Notepad) guess the file encoding correctly. As I mentioned in the beginning, I run gVim with default configuration, so there's no custom vimrc anywhere:
:echo $MYVIMRC
D:\Program Files (x86)\Vim\_vimrc
What would be the correct way to fix this problem?
Create a vimrc with set encoding=utf-8 in it. This should be the default in newer versions of Vim on Windows, as can be seen from :help 'encoding'.
'encoding' 'enc' string (default for MS-Windows: "utf-8",
otherwise: value from $LANG or "latin1")
The default value used to be latin1 on Windows but it was changed to utf-8 recently.
This should be enough to solve your issue.
Again from :help 'encoding':
Sets the character encoding used inside Vim. It applies to text in
the buffers, registers, Strings in expressions, text stored in the
viminfo file, etc. It sets the kind of characters which Vim can work
with.
Vim uses fileencodings (plural) to try and guess the encoding of your file. fileencoding (singular) is the encoding that Vim guessed (or that you've set) for your file. You probably don't need to change either of these.
My GVim distribution on a Windows 8.1 machine has both vimwiki and Vim-Latex-Suite installed through Vundle.
It bothers me that the following display (on the left) will occur when I do the following:
Open a *.wiki file (thereby enter the filetype vimwiki once);
In the same GVim session, open another *.tex file.
Notice that almost all those math symbols are no longer readable on the left. The quoted code-segment was displayed correctly (on the right) when opened by itself, through a new Gvim.exe session.
For this specific case, my guess is that, Vim is incapable of:
Correctly identify and display all math symbols (e.g. subscripts are displayed as a square);
Correctly displaying math symbols in full-width. (By default, half-width is default and this is why those \phi or \int are hiding all its right part.)
The goal for this post is not to "display math symbols in Vim" correctly. It is too wild and LyX can handle it pretty well. Instead, I would like to know:
How can I stop Vimwiki from interfering the display of *.tex
documents?
Any suggestion? Thank you in advance :)
Original answer from #Sato Katsura
This is the conceal feature. It works better in gVim, provided that you use a font that has all the relevant symbols. You can disable it with:
set conceallevel=0
Further details for Vimwiki
Vimwiki has specified g:vimwiki_conceallevel=2 by default according to line 2100 of the help file. Unfortunately, this "default value" was set globally for all buffers.
Specific solution:
For ~\vimfiles\ftplugin\tex.vim, add the following to the end:
setlocal conceallevel=0
For ~\vimfiles\ftplugin\vimwiki.vim, add the following to the end:
setlocal conceallevel=2
I've had the same problem what made me research until reach this mapping:
nnoremap <Leader>c :let &cole=(&cole == 2) ? 0 : 2 <bar> echo 'conceallevel ' . &cole <CR>
It toggles between conceallevel=0 to conceallevel=2
I am using Linux Mint 13 Maya Cinnamon 64-bit. My Vim version is 7.3 and I installed the latest version of Janus.
I found that for any files with a hash "#" in its content, the syntax highlight for the file does not work. For example,
# test
print "Hello"
The 'print' has color while I am editing the file. But when I save it and open it again the whole file loses syntax highlight.
If I deleted the first line and save, the syntax highlight comes back after I open it again.
This applies to all kinds of files such as .py, .c and .h. If there is a hash "#" character in the file, syntax highlighting does not work.
I have already tried "syntax on" but nothing changes.
I don't know Janus so this answer might not be 100% useful for you, but let's see. You could try finding out where the settings have been set. Try this:
Get current settings:
:set filetype? syntax?
Check where these have been set:
:verbose set filetype? syntax?
Execute these commands when you lost your syntax highlighting:
:syntax on
:set ft=python
:verbose set ft? syn?
Here you should see which script changed your filetype after saving. Normally, vim uses heuristics to determine the correct filetype if the file extension is ambiguous. In cases where these heuristics don't work, you usually set a global variable in your vimrc to a fixed value. In your case this would be something like:
let g:filetype_py="python"
I'm a rookie VIM user. My problem is that VIM doesn't let me type the character "á" even though there's no problem with other characters specific to Magyar (Hungarian), like "ő" and "í". I have UTF-8 encoding and Dejavu Sans Mono font set and am using Windows 7. I already tried doing :unmap á but it only resulted in a "No such mapping" message. Thanks for any tips!
Update: Executing :set keymap=magyar_utf-8 didn't make a difference. I have the mapping file named magyar_utf-8.vim in $VIMRUNTIME/keymap and the version I'm using is 7.3.
Furthermore "á" makes the cursor jump to the end of line in INSERT mode. Uppercase "Á" works as expected.
Try these things:
If there is a /key/ on your keyboard for the character á, type this on the command line:
:unmapC-v(that key>
to see what it is recognized as.
Alternatively, find the digraph for it
:dig
Possibly, using the above found key code, map it to use the digraph (on my system the digraph is C-k'a)
For completeness, special keyboard layout in general are handled by keymap settings, SO has a number of posts on how to use them in combination with e.g. dvorak keyboards.
Finally I've found the solution. So for everyone who happen to use gVIM on a Hungarian system with the auto-pairs plugin, comment out line 196 in auto-pairs.vim so you can type the letter á as you would expect.
I have auto-pairs plugin version 1.1.1 and in my file the line to be changed reads:
execute 'inoremap <buffer> <silent> <M-a> <END>
I work on webpages involving non-English scripts from time to time, most of them are encoded using UTF-8.
Vim and gVim do not display those UTF-8 characters correctly.
I'm using Vim 7.3.46 on Windows 7, 64-bit, with set guifont=Monaco:h10 in _vimrc.
Is there a way to fix this?
Update: I've googled around and found set guifontwide acts as second fallback for regional languages.
I added the following lines to _vimrc and most of my problems got solved.
set enc=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf8,prc
set guifont=Monaco:h11
set guifontwide=NSimsun:h12
The above NSimsun font works for Chinese, The problem is, I don't know how they got the font name to work with Vim, Courier New is mentioned as Courier_New also NSimsun is nowhere in the font directory. The font I want to use is Latha But, I don't know how to use it in the _vimrc file. set guifontwide=latha:h12 or set guifontwide=Latha:h12 doesn't work.
If I successfully set the guifontwide to latha, then my problem will be solved. How to do it?
Did you try
:set encoding=utf-8
:set fileencoding=utf-8
?
Try to reload the document using:
:e! ++enc=utf8
If that works you should maybe change the fileencodings settings in your .vimrc.
If Japanese people come here, please add the following lines to your ~/.vimrc
set encoding=utf-8
set fileencodings=iso-2022-jp,euc-jp,sjis,utf-8
set fileformats=unix,dos,mac
On Microsoft Windows, gvim wouldn't allow you to select non-monospaced fonts. Unfortunately Latha is a non-monospaced font.
There is a hack way to make it happen: Using FontForge (you can download Windows binary from http://www.geocities.jp/meir000/fontforge/) to edit the Latha.ttf and mark it as a monospaced font. Doing like this:
Load fontforge, select latha.ttf.
Menu: Element -> Font Info
Select "OS/2" from left-hand list on Font Info dialog
Select "Panose" tab
Set Proportion = Monospaced
Save new TTF version of this font, try it out!
Good luck!
this work for me and do not need change any config file
vim --cmd "set encoding=utf8" --cmd "set fileencoding=utf8" fileToOpen
In Linux, Open the VIM configuration file
$ sudo -H gedit /etc/vim/vimrc
Added following lines:
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
Save and exit, and terminal command:
$ source /etc/vim/vimrc
At this time VIM will correctly display Chinese.
Is this problem solved meanwhile?
I had the problem that gvim didn't display all unicode characters (but only a subset, including the umlauts and accented characters), while :set guifont? was empty; see my question. After reading here, setting the guifont to a sensible value fixed it for me. However, I don't need characters beyond 2 bytes.
I couldn't get any other fonts I installed to show up in my Windows GVim editor, so I just switched to Lucida Console which has at least somewhat better UTF-8 support. Add this to the end of your _vimrc:
" For making everything utf-8
set enc=utf-8
set guifont=Lucida_Console:h9:cANSI
set guifontwide=Lucida_Console:h12
Now I see at least some UTF-8 characters.
On Windows gvim just select "Lucida Console" font.