Ver Fonte

added config vim code-folding on indentation. Custom highlight and foldtext.

cinaeco há 15 anos atrás
pai
commit
f20754bc65
1 ficheiros alterados com 21 adições e 1 exclusões
  1. 21 1
      vim/vimrc

+ 21 - 1
vim/vimrc

@@ -30,10 +30,10 @@ set smartindent "guess harder, based on C-like language
 "" UI - Colours
 """"""""""""""""""""""""""""""""""""""""""""""""""""""
 
-hi Comment ctermfg=darkmagenta
 syntax on
 colorscheme desert
 set colorcolumn=80
+hi Folded ctermfg=darkred
 
 
 """"""""
@@ -45,6 +45,26 @@ set relativenumber "current line always 0 (requires 7.3 and up)
 set ruler "show row,col count in status line
 
 
+""""""""
+"" UI - Code Folding
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+set foldmethod=indent
+set foldlevel=1
+set foldtext=MyFoldText()
+
+function! MyFoldText()
+    let line = getline(v:foldstart)
+    let linecount = v:foldend+1 - v:foldstart
+    let plural = ""
+    if linecount != 1
+        let plural = "s"
+    endif
+    let foldtext = '+'.line.'... ('.linecount.' More lines)'
+    return foldtext
+endfunction
+
+
 """"""""
 "" UI - Search
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""