-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
137 lines (105 loc) · 3.04 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
134
135
136
137
if $SHELL =~ '/fish$'
set shell=zsh
endif
set encoding=utf-8
scriptencoding utf-8
""""""""""""""""""""""""""""""""""""""""""""""""""
set background=dark
syntax on
""""""""""""""""""""""""""""""""""""""""""""""""""
set cursorline
set number
" color number
" ref: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
hi LineNr ctermfg=231 ctermbg=234=
hi VertSplit ctermfg=231 ctermbg=234
set ruler
set wrap
set list
set listchars=tab:▸\ ,trail:-,eol:¬
""""""""""""""""""""""""""""""""""""""""""""""""""
set backspace=2
""""""""""""""""""""""""""""""""""""""""""""""""""
set showmatch
set showcmd
set noshowmode
""""""""""""""""""""""""""""""""""""""""""""""""""
set hlsearch
set ignorecase
set smartcase
""""""""""""""""""""""""""""""""""""""""""""""""""
set backupdir=~/.vim_backup/
set undodir=~/.vim_backup/
set tags=./tags;,tags;
set clipboard=unnamed,autoselect
""""""""""""""""""""""""""""""""""""""""""""""""""
set swapfile
set directory=$HOME/.vim_swap
""""""""""""""""""""""""""""""""""""""""""""""""""
set confirm
""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent
set smartindent
set tabstop=4
set shiftwidth=2
set smarttab
""""""""""""""""""""""""""""""""""""""""""""""""""
if !has('gui_running')
set t_Co=256
endif
""""""""""""""""""""""""""""""""""""""""""""""""""
" .vimrc
nnoremap <silent> <C-]> :<C-u>edit $MYVIMRC<CR>
augroup reload_vimrc
autocmd!
autocmd bufwritepost $MYVIMRC nested source $MYVIMRC
augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""
" show zenkaku space
" ref: http://inari.hatenablog.com/entry/2014/05/05/231307
function! ShowZenkakuSpace()
highlight ShowZenkakuSpace cterm=underline ctermfg=lightblue guibg=darkgray
endfunction
if has('syntax')
augroup ShowZenkakuSpace
autocmd!
autocmd ColorScheme * call ShowZenkakuSpace()
autocmd VimEnter,WinEnter,BufRead * let w:m1=matchadd('ShowZenkakuSpace', ' ')
augroup END
call ShowZenkakuSpace()
endif
""""""""""""""""""""""""""""""""""""""""""""""""""
" auto cursorline
" http://thinca.hatenablog.com/entry/20090530/1243615055
augroup vimrc-auto-cursorline
autocmd!
autocmd CursorMoved,CursorMovedI * call s:auto_cursorline('CursorMoved')
autocmd CursorHold,CursorHoldI * call s:auto_cursorline('CursorHold')
autocmd WinEnter * call s:auto_cursorline('WinEnter')
autocmd WinLeave * call s:auto_cursorline('WinLeave')
let s:cursorline_lock = 0
function! s:auto_cursorline(event)
if a:event ==# 'WinEnter'
setlocal cursorline
let s:cursorline_lock = 2
elseif a:event ==# 'WinLeave'
setlocal nocursorline
elseif a:event ==# 'CursorMoved'
if s:cursorline_lock
if 1 < s:cursorline_lock
let s:cursorline_lock = 1
else
setlocal nocursorline
let s:cursorline_lock = 0
endif
endif
elseif a:event ==# 'CursorHold'
setlocal cursorline
let s:cursorline_lock = 1
endif
endfunction
augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""
" autosave
autocmd CursorHold * wall
set updatetime=5000