forked from wsdjeg/SpaceVim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
58 lines (54 loc) · 1.86 KB
/
init.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"=============================================================================
" init.vim --- Language && encoding in SpaceVim
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
let s:SYSTEM = SpaceVim#api#import('system')
"Use English for anything in vim
try
if s:SYSTEM.isWindows
silent exec 'lan mes en_US.UTF-8'
elseif s:SYSTEM.isOSX
silent exec 'language en_US.UTF-8'
else
let s:uname = system('uname -s')
if s:uname ==# "Darwin\n"
" in mac-terminal
silent exec 'language en_US.UTF-8'
elseif s:uname ==# "SunOS\n"
" in Sun-OS terminal
silent exec 'lan en_US.UTF-8'
elseif s:uname ==# "FreeBSD\n"
" in FreeBSD terminal
silent exec 'lan en_US.UTF-8'
else
" in linux-terminal
silent exec 'lan en_US.UTF-8'
endif
endif
catch /^Vim\%((\a\+)\)\=:E197/
call SpaceVim#logger#error('Can not set language to en_US.utf8')
endtry
" try to set encoding to utf-8
if s:SYSTEM.isWindows
" Be nice and check for multi_byte even if the config requires
" multi_byte support most of the time
if has('multi_byte')
" Windows cmd.exe still uses cp850. If Windows ever moved to
" Powershell as the primary terminal, this would be utf-8
set termencoding=cp850
setglobal fileencoding=utf-8
" Windows has traditionally used cp1252, so it's probably wise to
" fallback into cp1252 instead of eg. iso-8859-15.
" Newer Windows files might contain utf-8 or utf-16 LE so we might
" want to try them first.
set fileencodings=ucs-bom,utf-8,gbk,utf-16le,cp1252,iso-8859-15
endif
else
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
endif
scriptencoding utf-8