aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init/config.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/init/config.vim')
-rw-r--r--vim/init/config.vim48
1 files changed, 26 insertions, 22 deletions
diff --git a/vim/init/config.vim b/vim/init/config.vim
index 903d8a0..4e1c06c 100644
--- a/vim/init/config.vim
+++ b/vim/init/config.vim
@@ -5,6 +5,7 @@
5 5
6" Unnamed Buffer ----------------{{{ 6" Unnamed Buffer ----------------{{{
7 7
8" Automatically delete unnamed empty buffer when leaving
8augroup DeleteUnnamedEmptBuffer! 9augroup DeleteUnnamedEmptBuffer!
9 au! 10 au!
10 au BufLeave {} if getline(1, '$') == [''] | setlocal bufhidden=wipe | endif 11 au BufLeave {} if getline(1, '$') == [''] | setlocal bufhidden=wipe | endif
@@ -15,15 +16,14 @@ augroup END
15 16
16augroup TerminalSize 17augroup TerminalSize
17 au! 18 au!
18 function! LayoutForSmall() 19 function! LayoutForSmallTerminal()
19 echo 'vim resized' 20 if &lines < 19
20 if &lines < 18 21 silent! set cmdheight=0 laststatus=0 showtabline=0 signcolumn=no nowrap scrolloff=1
21 set cmdheight=0 laststatus=0 showtabline=0 signcolumn=no nowrap scrolloff=1
22 else 22 else
23 set cmdheight& laststatus& showtabline=2 signcolumn=yes scrolloff=3 23 silent! set cmdheight& laststatus& showtabline=2 signcolumn=yes scrolloff=3
24 endif 24 endif
25 endfunction 25 endfunction
26 autocmd VimResized * call LayoutForSmall() 26 autocmd VimEnter,VimResized * call LayoutForSmallTerminal()
27augroup END 27augroup END
28 28
29" }}} 29" }}}
@@ -144,24 +144,28 @@ augroup InitFileTypes
144 autocmd BufReadPost * call <SID>ApplyShebang() 144 autocmd BufReadPost * call <SID>ApplyShebang()
145 " }}} 145 " }}}
146 " Markdown ----------------{{{ 146 " Markdown ----------------{{{
147 au FileType markdown setlocal wrap 147
148 au FileType markdown set sw=2 ts=2 148 augroup Config_Markdown
149 " Fold by heading level 149 au!
150 function! MarkdownLevel() 150 au FileType markdown setlocal wrap sw=2 ts=2
151 let hash_num = matchstr(getline(v:lnum), '^#\+') 151 au FileType markdown setlocal foldexpr=MarkdownLevel() foldmethod=expr
152 let hash_num_at_top = matchstr(getline(v:lnum-1), '^#\+') 152
153 if empty(hash_num) 153 " Fold by heading level
154 if empty(hash_num_at_top) 154 function! MarkdownLevel()
155 return "=" 155 let hash_num = matchstr(getline(v:lnum), '^#\+')
156 let hash_num_at_top = matchstr(getline(v:lnum-1), '^#\+')
157 if empty(hash_num)
158 if empty(hash_num_at_top)
159 return "="
160 else
161 return ">"..(len(hash_num_at_top))
162 endif
156 else 163 else
157 return ">"..(len(hash_num_at_top)) 164 return len(hash_num) - 1
158 endif 165 endif
159 else 166 endfunction
160 return len(hash_num)-1 167
161 endif 168 augroup END
162 endfunction
163 au FileType markdown setlocal foldexpr=MarkdownLevel()
164 au FileType markdown setlocal foldmethod=expr
165 169
166 " }}} 170 " }}}
167 " HTML ----------------{{{ 171 " HTML ----------------{{{