changeset 59:6df571869f4a

Added statusline and fold-related mappings.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 08 Dec 2011 17:16:47 -0800
parents a6513d65eccf
children d4843752d31f
files vim/vimrc
diffstat 1 files changed, 58 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/vim/vimrc	Thu Dec 08 17:13:23 2011 -0800
+++ b/vim/vimrc	Thu Dec 08 17:16:47 2011 -0800
@@ -6,6 +6,8 @@
 "
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
+" Global Setup {{{
+
 " Use Vim settings, rather then Vi settings (much better!).
 " This must be first, because it changes other options as a side effect.
 set nocompatible
@@ -40,6 +42,10 @@
     set columns=135
 endif
 
+" }}}
+
+" General Settings {{{
+
 " Disable modelines.
 set modelines=0
 
@@ -131,6 +137,9 @@
 " Going left and right let you go to other lines.
 set whichwrap+=<,>,h,l
 
+" Folds are defined by markers in the text.
+set foldmethod=marker
+
 " And now, for some system-dependent settings:
 " - font to use
 if $PLATFORM == "windows"
@@ -159,10 +168,17 @@
 " Enable file type detection.
 filetype indent plugin on
 
+" }}}
+
+" Plugin Settings {{{
+
 " Navigate MiniBufExplorer with CTRL+Tab/CTRL+Shift+Tab.
 let g:miniBufExplMapCTabSwitchBufs = 1
 
-" Custom mappings.
+" }}}
+
+" Mappings {{{
+
 let mapleader=","
 
 " Edit & source the VIMRC.
@@ -185,11 +201,51 @@
 " Simple way to close a buffer without closing the window.
 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr>
 
-" Abbreviations
+" Toggle folds with <space>
+nnoremap <space> za
+
+" Create folds with <space> (in visual mode)
+vnoremap <space> zf
+
+" }}}
+
+" Abbreviations {{{
+
 iabbrev @@      ludovic@chabant.com
 iabbrev ccopy   Copyright &copy;2011 Ludovic Chabant, all rights reserved.
 iabbrev ssig    --<cr>l u d o .<cr>. 8 0 17 80
 
+" }}}
+
+" Status Line {{{
+
+set statusline=%f    " Path.
+set statusline+=%m   " Modified flag.
+set statusline+=%r   " Readonly flag.
+set statusline+=%w   " Preview window flag.
+
+set statusline+=\    " Space.
+
+set statusline+=%#redbar#                       " Highlight the following as a warning.
+set statusline+=%{SyntasticStatuslineFlag()}    " Syntastic errors.
+set statusline+=%*                              " Reset highlighting.
+
+set statusline+=%=   " Right align.
+
+" File format, encoding and type.  Ex: "(unix/utf-8/python)"
+set statusline+=(
+set statusline+=%{&ff}                        " Format (unix/DOS).
+set statusline+=/
+set statusline+=%{strlen(&fenc)?&fenc:&enc}   " Encoding (utf-8).
+set statusline+=/
+set statusline+=%{&ft}                        " Type (python).
+set statusline+=)
+
+" Line and column position and counts.
+set statusline+=\ (line\ %l\/%L,\ col\ %03c)
+
+" }}}
+
 " Functions {{{
 
 function! s:ToggleSpellCheck() abort
@@ -243,11 +299,6 @@
 "  set statusline+=%=%-14.(Line:\ %l\ of\ %L\ [%p%%]\ -\ Col:\ %c%V%)
 "endif
 
-" When started as "evim", evim.vim will already have done these settings.
-"if v:progname =~? "evim"
-"  finish
-"endif
-
 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
 " let &guioptions = substitute(&guioptions, "t", "", "g")