aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/init/basic.vim60
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
26let mapleader = "," " Always use comma as leader key 26let mapleader = "," " Always use comma as leader key
27set nocompatible " Disable vi compatible, today is 20XX 27set nocompatible " Disable vi compatible, today is 20XX
28set path=.,** " Allow :find with completion 28set path=.,** " Allow :find with completion
29set mouse= " Disable mouse selection 29set mouse= " Disable mouse selection
30set winaltkeys=no " Allow alt key for mapping 30set winaltkeys=no " Allow alt key for mapping
31set cursorline 31set cursorline
32set whichwrap=b,s 32set whichwrap=b,s
@@ -104,9 +104,9 @@ autocmd FocusGained,BufEnter .* checktime
104 104
105let g:quitVimWhenPressingCtrlC = 1 105let g:quitVimWhenPressingCtrlC = 1
106function! ToggleQuit() 106function! 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
110endfunction 110endfunction
111 111
112nnoremap <leader><leader>gl :call ToggleQuit()<CR> 112nnoremap <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"
138augroup vimStartup 138augroup vimStartup
139au! 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).
145autocmd 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
149augroup END 149augroup END
150 150
151" Set filetype for beancount 151" Set filetype for beancount
152autocmd BufRead,BufNewFile *.bean call PrepareBean() 152autocmd BufRead,BufNewFile *.bean call PrepareBean()
153function PrepareBean() 153function 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
157endfunction 157endfunction
158 158
159" Set filetype for index.html 159" Set filetype for index.html
160autocmd BufWrite *.html,*.js,*.css call ReloadServer() 160autocmd BufWrite *.html,*.js,*.css call ReloadServer()
161function ReloadServer() 161function ReloadServer()
162 silent !browser-sync reload &>/dev/null 162 silent !browser-sync reload &>/dev/null
163endfunction 163endfunction
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
168autocmd BufRead /dev/shm/*.txt call SetPasswordFile() 168autocmd BufRead /dev/shm/*.txt call SetPasswordFile()
169function SetPasswordFile() 169function 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
177endfunction 177endfunction
178 178
179 179
@@ -192,10 +192,10 @@ set smartindent
192" ENCODING_PREFERENCE 192" ENCODING_PREFERENCE
193"---------------------------------------------------------------------- 193"----------------------------------------------------------------------
194if has('multi_byte') 194if 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
199endif 199endif
200 200
201 201