aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init/config.vim
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-07-28 21:01:19 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-07-28 21:01:19 +0800
commit9b564fcfeec95ed965252ef4acc6ee42702ded88 (patch)
tree6e3eec076baf803724879be796cf5a5324cd8fb0 /vim/init/config.vim
parent0e010ae8e8686e3a374a27885391f99d3ea315cc (diff)
Update
Diffstat (limited to 'vim/init/config.vim')
-rw-r--r--vim/init/config.vim30
1 files changed, 15 insertions, 15 deletions
diff --git a/vim/init/config.vim b/vim/init/config.vim
index 4e1c06c..4181ad3 100644
--- a/vim/init/config.vim
+++ b/vim/init/config.vim
@@ -3,7 +3,7 @@
3" Do some autocommand for by contexts 3" Do some autocommand for by contexts
4"====================================================================== 4"======================================================================
5 5
6" Unnamed Buffer ----------------{{{ 6" Unnamed Buffer {{{
7 7
8" Automatically delete unnamed empty buffer when leaving 8" Automatically delete unnamed empty buffer when leaving
9augroup DeleteUnnamedEmptBuffer! 9augroup DeleteUnnamedEmptBuffer!
@@ -12,7 +12,7 @@ augroup DeleteUnnamedEmptBuffer!
12augroup END 12augroup END
13 13
14" }}} 14" }}}
15" Small Terminal ----------------{{{ 15" Small Terminal {{{
16 16
17augroup TerminalSize 17augroup TerminalSize
18 au! 18 au!
@@ -27,13 +27,13 @@ augroup TerminalSize
27augroup END 27augroup END
28 28
29" }}} 29" }}}
30" X11 ----------------{{{ 30" X11 {{{
31 31
32" Change IM to US when exit to Normal mode 32" Change IM to US when exit to Normal mode
33autocmd InsertLeave * :silent !fcitx-remote -c &>/dev/null || true 33autocmd InsertLeave * :silent !fcitx-remote -c &>/dev/null || true
34 34
35" }}} 35" }}}
36" TMUX ----------------{{{ 36" TMUX {{{
37 37
38" 有 tmux 何没有的功能键超时(毫秒) 38" 有 tmux 何没有的功能键超时(毫秒)
39if $TMUX != '' 39if $TMUX != ''
@@ -60,7 +60,7 @@ if !has('gui_running') && &term =~ '^\%(screen\|tmux\)'
60endif 60endif
61 61
62" }}} 62" }}}
63" KeyCode ----------------{{{ 63" KeyCode {{{
64 64
65"---------------------------------------------------------------------- 65"----------------------------------------------------------------------
66" 终端下允许 ALT,详见:http://www.skywind.me/blog/archives/2021 66" 终端下允许 ALT,详见:http://www.skywind.me/blog/archives/2021
@@ -114,22 +114,22 @@ call s:key_escape('<S-F11>', '[23;2~')
114call s:key_escape('<S-F12>', '[24;2~') 114call s:key_escape('<S-F12>', '[24;2~')
115 115
116" }}} 116" }}}
117" Filetype ----------------{{{ 117" Filetype {{{
118 118
119augroup InitFileTypes 119augroup InitFileTypes
120 120
121 au! 121 au!
122 122
123 " Filetype for Vim ----------------{{{ 123 " Filetype for Vim {{{
124 124
125 " Help page 125 " Help page
126 autocmd BufEnter *.txt if &filetype == 'help' | wincmd T | endif 126 autocmd BufEnter * if &filetype == 'help' | wincmd T | set buflisted | endif
127 127
128 " quickfix: hide line number 128 " quickfix: hide line number
129 autocmd FileType quickfix setlocal nonumber 129 autocmd FileType quickfix setlocal nonumber
130 130
131 " }}} 131 " }}}
132 " Shebeng: Set filetype from shebeng ----------------{{{ 132 " Shebeng: Set filetype from shebeng {{{
133 function! s:ApplyShebang() 133 function! s:ApplyShebang()
134 let l:filetype = matchstr(getline(1), '^#!.*[ /]\zs[[:alnum:]]\+$') 134 let l:filetype = matchstr(getline(1), '^#!.*[ /]\zs[[:alnum:]]\+$')
135 let l:shebangMatch = #{ node: "javascript" } 135 let l:shebangMatch = #{ node: "javascript" }
@@ -143,7 +143,7 @@ augroup InitFileTypes
143 endfunction 143 endfunction
144 autocmd BufReadPost * call <SID>ApplyShebang() 144 autocmd BufReadPost * call <SID>ApplyShebang()
145 " }}} 145 " }}}
146 " Markdown ----------------{{{ 146 " Markdown {{{
147 147
148 augroup Config_Markdown 148 augroup Config_Markdown
149 au! 149 au!
@@ -168,7 +168,7 @@ augroup InitFileTypes
168 augroup END 168 augroup END
169 169
170 " }}} 170 " }}}
171 " HTML ----------------{{{ 171 " HTML {{{
172 172
173 " Usage: <leader>cl(ass) or <leader>id to edit html tag attribute 173 " Usage: <leader>cl(ass) or <leader>id to edit html tag attribute
174 function! s:ChangeAttr(pattern) 174 function! s:ChangeAttr(pattern)
@@ -192,17 +192,17 @@ augroup InitFileTypes
192 192
193 " Reload preview server 193 " Reload preview server
194 autocmd BufWrite *.html,*.js,*.css call ReloadServer() 194 autocmd BufWrite *.html,*.js,*.css call ReloadServer()
195 function ReloadServer() 195 function! ReloadServer()
196 silent !browser-sync reload &>/dev/null 196 silent !browser-sync reload &>/dev/null
197 endfunction 197 endfunction
198 198
199 " }}} 199 " }}}
200 " Mail ----------------{{{ 200 " Mail {{{
201 201
202 autocmd BufRead /tmp/mutt-* set tw=72 202 autocmd BufRead /tmp/mutt-* set tw=72
203 203
204 " }}} 204 " }}}
205 " Password ----------------{{{ 205 " Password {{{
206 206
207 " Hide the first line of a file if editing password file 207 " Hide the first line of a file if editing password file
208 " TODO a better way to determine a file is related to password-store, now use 208 " TODO a better way to determine a file is related to password-store, now use
@@ -218,7 +218,7 @@ augroup InitFileTypes
218 norm! ggzfl 218 norm! ggzfl
219 endfunction 219 endfunction
220 " }}} 220 " }}}
221 " Beancount ----------------{{{ 221 " Beancount {{{
222 222
223 autocmd BufRead,BufNewFile *.bean call PrepareBean() 223 autocmd BufRead,BufNewFile *.bean call PrepareBean()
224 function PrepareBean() 224 function PrepareBean()