-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc.minimal
More file actions
134 lines (110 loc) · 2.54 KB
/
Copy path.vimrc.minimal
File metadata and controls
134 lines (110 loc) · 2.54 KB
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
134
" vim:fdm=marker
" minimal vim configuration without plugins
" General Settings {{{"
set nocompatible
syntax on
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set cindent
set number
set autoindent
set ignorecase
set smartcase
set infercase
set ruler
set laststatus=2
"set nowrap
" enable instant search
set incsearch
" enable vim command-line completion
set wildmenu
" color theme
colo desert
" automatically reload .vimrc when it saving
autocmd BufWritePost $MYVIMRC source $MYVIMRC
" enable fold
set foldmethod=syntax
set nofoldenable
" enable mouse support
set mouse=a
set ttymouse=xterm2
behave xterm
set selectmode=mouse
" enable filetype
filetype on
filetype indent on
filetype plugin on
" disable expandtab for Makefile
autocmd FileType make setlocal noexpandtab
" set utf-8 encoding
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
"setglobal bomb
set fileencodings=ucs-bom,utf-8,cp936,euc-cn,latin1
endif
" set filename completion case insensitive
if exists("&wildignorecase")
set wildignorecase
endif
" set font for GUI
if has("gui_running")
if has('gui_win32')
set guifont=Fantasque_Sans_Mono:h16
else
set guifont=Fantasque\ Sans\ Mono\ 16
endif
endif
" }}}
" Normal shortcuts {{{
" loacate to the begin/end of a line
nmap LB 0
nmap LE $
" split navigations (Optional)
"nnoremap <C-J> <C-W><C-J>
"nnoremap <C-K> <C-W><C-K>
"nnoremap <C-L> <C-W><C-L>
"nnoremap <C-H> <C-W><C-H>
" traverse window
nnoremap nw <C-W><C-W>
" quick movements in Insert-Mode
inoremap II <Esc>I
inoremap AA <Esc>A
inoremap OO <Esc>o
" mimic Eclipse Shift+Enter, but only works with vim GUI
inoremap <S-CR> <Esc>o
" allow saving file as sudo when forgot to start vim using sudo
cmap w!! w !sudo tee > /dev/null %
" }}}
" Leader shortcuts {{{
let mapleader = "\<Space>"
" save file
nnoremap <Leader>w :w<CR>
" copy to system clipboard
vnoremap <Leader>y "+y
" paste from system clipboard
nmap <Leader>p "+p
" quickly jump to window
nnoremap <Leader>hw <C-W>h
nnoremap <Leader>jw <C-W>j
nnoremap <Leader>kw <C-W>k
nnoremap <Leader>lw <C-W>l
" jump between matchings
"nmap <Leader>m %
nmap <Leader>M %
" toggle invisible character
" note: space option is available after 7.4.711
if has("patch-7.4.711")
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<,space:␣
else
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
endif
nmap <Leader>la :set list!<CR>
" toggle paste mode (this setting may cause incorrectly paste)
"set pastetoggle=<leader>p
" }}}