How do I set the UI language in vim?
VimUser InterfaceVim Problem Overview
I saw this on reddit, and it reminded me of one of my vim gripes: It shows the UI in German. Damn you, vim! I want English, but since my OS is set up in German (the standard at our office), I guess vim is actually trying to be helpfull.
What magic incantations must I perform to get vim to switch the UI language? I have tried googling on various occasions, but can't seem to find an answer (No, Google, you're my friend *pat*, *pat*, but I allready know how to change the syntax highlighting, thank you!)...
EDIT: Using all the good tips below, I ended up adding this to the top of my .vimrc
(running Vim 7.2 on Windows 7)
set langmenu=en_US.UTF-8 " sets the language of the menu (gvim)
language en " sets the language of the messages / ui (vim)
Vim Solutions
Solution 1 - Vim
For reference, in Windows (7) I just deleted the directory C:\Program Files (x86)\Vim\vim72\lang
. That made it fallback to en_US.
Solution 2 - Vim
Try this in _vimrc. It works with my win7.
set langmenu=en_US
let $LANG = 'en_US'
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
Solution 3 - Vim
As Ken noted, you want the :language
command.
Note that putting this in your .vimrc
or .gvimrc
won’t help you with the menus in gvim, since their definition is loaded once at startup, very early on, and not re-read again later. So you really do need to set LC_ALL
(or more specifically LC_MESSAGES
) in your environment – or on non-Unixoid systems (eg. Windows), you can pass the --cmd
switch (which executes the given command first thing, as opposed to the -c
option):
gvim --cmd "lang en_US"
As I mentioned, you don’t need to use LC_ALL
, which will forcibly switch all aspects of your computing environment. You can do more nuanced stuff. F.ex., my own locale settings look like this:
LANG=en_US.utf8
LC_CTYPE=de_DE.utf8
LC_COLLATE=C
This means I get a largely English system, but with German semantics for letters, except that the default sort order is ASCIIbetical (ie. sort by codepoint, not according to language conventions). You could use a different variation; see man 7 locale
for more.
Solution 4 - Vim
Putting this line of code at the top of my _vimrc file saved my day:
set langmenu=en_US.UTF-8
Solution 5 - Vim
This worked for changing vim's menu language
set langmenu=en_US.UTF-8 [or just set langmenu=en for short]
But
language en
gave me an error sayng it couldn't set en as a language but this line did the job
:let $LANG = 'en'
The latter come from the Vim's docs. I added both lines at the beginning of the _vimrc file. I use a Windows 7 64 computer.
PS: this line changes both language and menus language
language messages en
In the .vimrc file (or _vimrc file if you are in windows)
Solution 6 - Vim
Ubuntu 10.10 + VIM 7.2 IMproved. Code below changes language for console vim. Add it at top of your vim.rc
if has('unix')
language messages C
else
language messages en
endif
Solution 7 - Vim
:help language
:language fr_FR.ISO_8859-1
Solution 8 - Vim
These two lines at the begining of your .vimrc file will do the job:
let $LANG = 'en'
set langmenu=none
Solution 9 - Vim
Adding this to _vimrc works for me in windows 8:
set langmenu=en_US
let $LANG = 'en_US'
(note that _vimrc is in the same directory that contains my vim74 dir, thats the _vimrc file that vim reads at startup)
Solution 10 - Vim
Start vim with a changed locale:
LC_ALL=en_GB.utf-8 vim
Or export that variable per default in your bashrc/profile.
Solution 11 - Vim
Two Vim installations on Windows
Nothing from here around have helped me until I have realized that I have 2 Vim installed.
- Git Bash via MinGW (Cygwin, mintty)
- A separate installation in the Program Files on Windows
Next command will filter you all watched vimrc-files and their locations.
vim --version | grep vimrc
- _vimrc (Windows & CMD)
- .vimrc (Bash for Git)
- vimrc (has different locations for both)
1: Vim on Windows & CMD
Only renaming (deletion) of the lang folder helped me.
You can find it here C:\Program Files (x86)\Vim\vim80\lang
I tried all config settings listed here around and it was useless.
2.1: Git Bash through MinGW, Cygwin, mintty
For Git Bash I added language messages en_US
at the top of C:\Program Files\Git\etc\vimrc
Of course, if you prefer to delete the lang folder you can find it here
C:\Program Files\Git\usr\share\vim\vim80\lang
C:\Users\User_name_xxx\AppData\Local\Programs\Git\usr\share\vim\vim80\lang
for a local user installation.
2.2: Tuning only Git's Bash (MinGW64, Cygwin, mintty)
At the end, for Bash on Windows I have chosen to skip manipulations with vimrc
I opened C:\Program Files\Git\etc\bash.bashrc
and added the following line
LANG='en_US'
or
LANG=C
Try to do not use en_US.UTF-8
because it forces some bash commands to produce weird chars. For example in find 'xxx_yyy_zzz_aaa.bbbddd'
for a non-existing file.
Solution 12 - Vim
I don't know why all of the above answers did not work for me. I kept getting errors about the locales not existing. Maybe it's a Windows thing. At any rate, my solution was to add this to my vimrc: let $LANG = 'en'
Ah, I spoke too soon. The menus of gVim are still in Japanese, but the intro screen is in English.
Solution 13 - Vim
Try adding this to your _vimrc:
let $LANG='en_US'
Solution 14 - Vim
Had similar issue, but neither one of above solution worked: https://superuser.com/questions/552504/vim-ui-language-issue/552523
I've resolved it by removing all vim packets and build vim from sources.
Hope it'll help someone.
Solution 15 - Vim
If you're on Windows and don't want to be bothered issuing commands
To prevent the GUI from loading localization files
Just go to Program Files\Vim\vim80\lang
and put an underscore as a prefix in front of all the files that look like they have something to do with your locale.
To prevent VIM itself from loading localization files
In the same folder as above, prefix with an underscore the folder named with your country code.
Note: Windows 10 will probably ask for Administrator privileges by raising a UAC warning.
By the way
This same technique can be applied to a lot of Unix/Linux tools ported on Windows, and generally all software packages where the localization files can readily be accessed. If you rename those to prevent the application from finding them, the fallback language will most probably be English.