-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
134 lines (122 loc) · 4.87 KB
/
vimrc
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
"===============================================================================
"= Set system runtime
"===============================================================================
if has('win32') || has('win64') || has('win16')
" Windows(GVIM) system runtime startup code
source $VIMRUNTIME/vimrc_example.vim
set nobackup " Disable creating backup files
set noundofile " Disable creating undo files
behave xterm
else
try
let os_str = substitute(system('uname'), '\n', '', '')
catch
let os_str = 'Unknown'
endtry
if has('mac') || os_str == 'Darwin'
"MacOS system runtime startup code
set modelines=0 " CVE-2007-2438
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " More powerful backspacing
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup
let skip_defaults_vim=1
elseif has('linux') || os_str == 'Linux'
runtime! debian.vim
" TODO: Write linux system runtime startup code for other distro
elseif has('unix')
" TODO: Write unix system runtime startup code
endif
unlet os_str
endif
if !has('ide')
"===============================================================================
"= Enable syntax highlight
"===============================================================================
if has("syntax")
syntax on
endif
"===============================================================================
"= Plugin configuration (load if available)
"===============================================================================
let plugin_path = $HOME . "/.vim/plugins.vim"
if filereadable(plugin_path)
execute 'source ' . plugin_path
endif
unlet plugin_path
"===============================================================================
"= Source a global configuration if available
"===============================================================================
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
"===============================================================================
"= set gui related configurations
"===============================================================================
if has("gui_running")
set guioptions-=T " remove toolbar from gvim
set guioptions-=l " Do not display left scrollbar on general
set guioptions-=L " Do not display left scrollbar even necessary
set guioptions-=r " Do not display right scrollbar on general
set guioptions-=R " Do not display right scrollbar even necessary
set lines=40 " 40 lines of text instead of 24
if has("gui_win32")
set guifont=D2Coding:h10:cANSI
elseif has("gui_macvim")
set guifont=D2Coding:h14 "YOUR FONT
endif
else
if &term == 'xterm' || &term == 'screen'
set t_Co=256 "Enable 256 colors
endif
endif
"===============================================================================
"= Set colorscheme
"===============================================================================
let color_use = "PaperColor"
try
set background=dark
execute 'colorscheme ' . color_use
catch
" When the colorscheme doesn't exist, try use default skin
execute 'colorscheme pablo'
endtry
unlet color_use
endif "!has("ide")
"===============================================================================
"= Key mapping (Move window with Ctrl + hjkl)
"===============================================================================
nmap <c-h> <c-w>h
nmap <c-j> <c-w>j
nmap <c-k> <c-w>k
nmap <c-l> <c-w>l
"===============================================================================
"= Key mapping (Resize window with Shift + <>+)
"===============================================================================
nmap <s-h> <c-w><
nmap <s-j> <c-w>-
nmap <s-k> <c-w>+
nmap <s-l> <c-w>>
"===============================================================================
"= Default configuration (view)
"===============================================================================
set ruler " Show line number and its column
set number " Show line number indicator on left
set showmatch " Show matching pair bracket
set laststatus=2 " Show status bar at bottom
set cursorline " Highlight current line
"===============================================================================
"= Default configuration (edit)
"===============================================================================
set tabstop=4 " Set tab width to 4 spaces
set shiftwidth=4 " Set indent width to 4 spaces
set autoindent " Auto indent
set smartindent " Smart indent
set encoding=utf-8 " Set default encoding to UTF-8
"===============================================================================
"= Default configuration (search)
"===============================================================================
set hlsearch " Highlight search
set smartcase " Search smart case option