From 24b96a93258908176503c7e6d9c4c0b912f87b2b Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Fri, 26 Jun 2009 17:58:37 +0100 Subject: [PATCH] Handle uncluttered buffers. Don't set signs and numbers if Uncluttered_Buffer() returns true. A buffer is uncluttered if the uncluttered_buffer variable is true. A buffer is uncluttered if buftype is non-null. A buffer is uncluttered if its filetype is svn, perforce or gitcommit. --- .vimrc | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index 9cc96fd..3f4fd1d 100644 --- a/.vimrc +++ b/.vimrc @@ -366,6 +366,34 @@ map Q " Vim tip 99: What's the highlighting group under the cursor? call Mapping("h", ":echo \"hi<\" . synIDattr(synID(line(\".\"),col(\".\"),1),\"name\") . '> trans<' . synIDattr(synID(line(\".\"),col(\".\"),0),\"name\") . \"> lo<\" . synIDattr(synIDtrans(synID(line(\".\"),col(\".\"),1)),\"name\") . \">\"") +fun! Uncluttered_Buffer() + if exists("uncluttered_buffer") + if uncluttered_buffer == 1 + return 1 + endif + endif + + if version >= "600" + if &buftype != '' + return 1 + endif + endif + + if &ft == 'perforce' + return 1 + endif + + if &ft == 'svn' + return 1 + endif + + if &ft == 'gitcommit' + return 1 + endif + + return 0 +endfun + fun! Startup_Resize() let l:columns = 0 @@ -393,7 +421,7 @@ fun! Startup_Resize() endfun " Show numbers by default. -au Display VimEnter * call Number(0) +au Display VimEnter * if ! Uncluttered_Buffer() | call Number(0) | endif endif """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -529,7 +557,7 @@ fun! Place_Sign(number, line, old, name) endfun fun! Highlight_Signs(...) - if ! has("signs") || ! g:marksigns + if ! has("signs") || ! g:marksigns || Uncluttered_Buffer() return endif -- 2.20.1