From 877f36d7a0eb1f8612f5d0e006840f291f00c7b4 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Wed, 22 Jul 2009 10:31:12 +0100 Subject: [PATCH] Vim options. Added smarttab option. Use hex mode for ^A/^X. Numbers with leading zeros are interpreted as octals by default. Usually this is the wrong thing. Setting hex mode works most of the time. Don't jump to the start of the line when using H, L etc. Use UTF-8 listchars. [git://github.com/graywh/dotfiles.git] --- .vimrc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index a715a77..4e1c4b8 100644 --- a/.vimrc +++ b/.vimrc @@ -28,10 +28,15 @@ se ts=2 se expandtab " And << and >> indent by 2. se sw=2 +" Backspace deletes full tab width at the start of a line. +se smarttab " Allow backspace to delete before start of line. se bs=2 +" Don't jump to the start of the line when using H, L etc. +se nosol + " Show the ruler. se ruler " Show partial commands in the ruler. @@ -102,6 +107,9 @@ se suffixes-=*.o,*.obj " cross-platform. se ssop+=unix,slash +" How often do we need to use ^A/^X on octals? +se nf=hex + " Nuke any pre-existing autocommands. augroup Display autocmd! @@ -710,7 +718,20 @@ endfun " Change list mode. fun! Cycle_List() - let basic='tab:\\_,trail:_,extends:<,precedes:>' + " Pretty UTF-8 listchars. + if has('multi_byte') && (&tenc =~? '^u\(tf\|cs\)' || (! strlen(&tenc) && &enc =~? '^u\(tf\|cs\)')) && v:version >= "602" + let basic='tab:»·,trail:…,extends:«,precedes:»' + let eol='eol:¶' + if version >= "700" + let basic=basic . ',nbsp:•' + endif + else + let basic='tab:\\_,trail:_,extends:<,precedes:>' + let eol='eol:$' + if version >= "700" + let basic=basic . ',nbsp:+' + endif + endif call Iain_Vars() let b:iainlist = b:iainlist + 1 if b:iainlist > 2 @@ -722,7 +743,7 @@ fun! Cycle_List() exec "set lcs=" . basic set list else - exec "set lcs=" . basic . ",eol:$" + exec "set lcs=" . basic . "," . eol set list endif endfun -- 2.7.4