-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
45 lines (37 loc) · 2.23 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
" Setting some decent VIM settings for programming
set shiftwidth=2 " 设定 << 和 >> 命令移动时的宽度
set softtabstop=2 " 使得按退格键时可以一次删掉 n 个空格
set tabstop=2 " 设定 tab 长度
set ai " set auto-indenting on for programming
set showmatch " automatically show matching brackets. works like it does in bbedit.
set vb " turn on the "visual bell" - which is much quieter than the "audio blink"
set ruler " show the cursor position all the time
set laststatus=2 " make the last line where the status is two lines deep so you can see status always
set backspace=indent,eol,start " make that backspace key work the way it should
set nocompatible " vi compatible is LAME
set background=dark " Use colours that work well on a dark background (Console is usually black)
set showmode " show the current mode
syntax on " turn syntax highlighting on by default
" Show EOL type and last modified timestamp, right after the filename
set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P
"------------------------------------------------------------------------------
" Only do this part when compiled with support for autocommands.
if has("autocmd")
"Set UTF-8 as the default encoding for commit messages
autocmd BufReadPre COMMIT_EDITMSG,git-rebase-todo setlocal fileencodings=utf-8
"Remember the positions in files with some git-specific exceptions"
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$")
\ && expand("%") !~ "COMMIT_EDITMSG"
\ && expand("%") !~ "ADD_EDIT.patch"
\ && expand("%") !~ "addp-hunk-edit.diff"
\ && expand("%") !~ "git-rebase-todo" |
\ exe "normal g`\"" |
\ endif
autocmd BufNewFile,BufRead *.patch set filetype=diff
autocmd BufNewFile,BufRead *.diff set filetype=diff
autocmd Syntax diff
\ highlight WhiteSpaceEOL ctermbg=red |
\ match WhiteSpaceEOL /\(^+.*\)\@<=\s\+$/
autocmd Syntax gitcommit setlocal textwidth=74
endif " has("autocmd")