diff options
Diffstat (limited to 'vim/init')
-rw-r--r-- | vim/init/basic.vim | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/vim/init/basic.vim b/vim/init/basic.vim index 4bf068f..2867f69 100644 --- a/vim/init/basic.vim +++ b/vim/init/basic.vim | |||
@@ -24,9 +24,9 @@ | |||
24 | "---------------------------------------------------------------------- | 24 | "---------------------------------------------------------------------- |
25 | 25 | ||
26 | let mapleader = "," " Always use comma as leader key | 26 | let mapleader = "," " Always use comma as leader key |
27 | set nocompatible " Disable vi compatible, today is 20XX | 27 | set nocompatible " Disable vi compatible, today is 20XX |
28 | set path=.,** " Allow :find with completion | 28 | set path=.,** " Allow :find with completion |
29 | set mouse= " Disable mouse selection | 29 | set mouse= " Disable mouse selection |
30 | set winaltkeys=no " Allow alt key for mapping | 30 | set winaltkeys=no " Allow alt key for mapping |
31 | set cursorline | 31 | set cursorline |
32 | set whichwrap=b,s | 32 | set whichwrap=b,s |
@@ -104,9 +104,9 @@ autocmd FocusGained,BufEnter .* checktime | |||
104 | 104 | ||
105 | let g:quitVimWhenPressingCtrlC = 1 | 105 | let g:quitVimWhenPressingCtrlC = 1 |
106 | function! ToggleQuit() | 106 | function! ToggleQuit() |
107 | let g:quitVimWhenPressingCtrlC = g:quitVimWhenPressingCtrlC ? 0 : 1 | 107 | let g:quitVimWhenPressingCtrlC = g:quitVimWhenPressingCtrlC ? 0 : 1 |
108 | let message = g:quitVimWhenPressingCtrlC ? "Unlock" : "Lock" | 108 | let message = g:quitVimWhenPressingCtrlC ? "Unlock" : "Lock" |
109 | echo message | 109 | echo message |
110 | endfunction | 110 | endfunction |
111 | 111 | ||
112 | nnoremap <leader><leader>gl :call ToggleQuit()<CR> | 112 | nnoremap <leader><leader>gl :call ToggleQuit()<CR> |
@@ -136,30 +136,30 @@ set hidden | |||
136 | " Put these in an autocmd group, so that you can revert them with: | 136 | " Put these in an autocmd group, so that you can revert them with: |
137 | " ":augroup vimStartup | au! | augroup END" | 137 | " ":augroup vimStartup | au! | augroup END" |
138 | augroup vimStartup | 138 | augroup vimStartup |
139 | au! | 139 | au! |
140 | 140 | ||
141 | " When editing a file, always jump to the last known cursor position. | 141 | " When editing a file, always jump to the last known cursor position. |
142 | " Don't do it when the position is invalid, when inside an event handler | 142 | " Don't do it when the position is invalid, when inside an event handler |
143 | " (happens when dropping a file on gvim) and for a commit message | 143 | " (happens when dropping a file on gvim) and for a commit message |
144 | " (it's likely a different one than last time). | 144 | " (it's likely a different one than last time). |
145 | autocmd BufReadPost * | 145 | autocmd BufReadPost * |
146 | \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' | 146 | \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' |
147 | \ | exe "normal! g`\"" | 147 | \ | exe "normal! g`\"" |
148 | \ | endif | 148 | \ | endif |
149 | augroup END | 149 | augroup END |
150 | 150 | ||
151 | " Set filetype for beancount | 151 | " Set filetype for beancount |
152 | autocmd BufRead,BufNewFile *.bean call PrepareBean() | 152 | autocmd BufRead,BufNewFile *.bean call PrepareBean() |
153 | function PrepareBean() | 153 | function PrepareBean() |
154 | set filetype=beancount | 154 | set filetype=beancount |
155 | silent !setsid fava ~/bean/main.bean &>/dev/null | 155 | silent !setsid fava ~/bean/main.bean &>/dev/null |
156 | autocmd VimLeave * silent !killall fava | 156 | autocmd VimLeave * silent !killall fava |
157 | endfunction | 157 | endfunction |
158 | 158 | ||
159 | " Set filetype for index.html | 159 | " Set filetype for index.html |
160 | autocmd BufWrite *.html,*.js,*.css call ReloadServer() | 160 | autocmd BufWrite *.html,*.js,*.css call ReloadServer() |
161 | function ReloadServer() | 161 | function ReloadServer() |
162 | silent !browser-sync reload &>/dev/null | 162 | silent !browser-sync reload &>/dev/null |
163 | endfunction | 163 | endfunction |
164 | 164 | ||
165 | " Hide the first line of a file if editing password file | 165 | " Hide the first line of a file if editing password file |
@@ -167,13 +167,13 @@ endfunction | |||
167 | " files under /dev/shm as filter | 167 | " files under /dev/shm as filter |
168 | autocmd BufRead /dev/shm/*.txt call SetPasswordFile() | 168 | autocmd BufRead /dev/shm/*.txt call SetPasswordFile() |
169 | function SetPasswordFile() | 169 | function SetPasswordFile() |
170 | setlocal foldminlines=0 | 170 | setlocal foldminlines=0 |
171 | setlocal foldmethod=manual | 171 | setlocal foldmethod=manual |
172 | function s:custom() | 172 | function s:custom() |
173 | return "Password" | 173 | return "Password" |
174 | endfunction | 174 | endfunction |
175 | setlocal foldtext=s:custom() | 175 | setlocal foldtext=s:custom() |
176 | norm! ggzfl | 176 | norm! ggzfl |
177 | endfunction | 177 | endfunction |
178 | 178 | ||
179 | 179 | ||
@@ -192,10 +192,10 @@ set smartindent | |||
192 | " ENCODING_PREFERENCE | 192 | " ENCODING_PREFERENCE |
193 | "---------------------------------------------------------------------- | 193 | "---------------------------------------------------------------------- |
194 | if has('multi_byte') | 194 | if has('multi_byte') |
195 | set encoding=utf-8 | 195 | set encoding=utf-8 |
196 | set fileencoding=utf-8 | 196 | set fileencoding=utf-8 |
197 | " Try encodings by this order | 197 | " Try encodings by this order |
198 | set fileencodings=utf-8,big5,ucs-bom,gbk,gb18030,euc-jp,latin1 | 198 | set fileencodings=utf-8,big5,ucs-bom,gbk,gb18030,euc-jp,latin1 |
199 | endif | 199 | endif |
200 | 200 | ||
201 | 201 | ||