Surround active bufer with higlight

220 views
Skip to first unread message

Rich Healey

unread,
Feb 1, 2012, 10:47:44 PM2/1/12
to vim...@googlegroups.com
When I have my window split with many buffers, the title line on the active pane is a different color, but is it possible to have all 4 borders of the current split different the way tmux et al does?

Sometimes when I have many splits I find it hard to find where I left my focus.

Paul Isambert

unread,
Feb 2, 2012, 3:54:29 AM2/2/12
to vim...@googlegroups.com
Rich Healey <heale...@gmail.com> a écrit:

>
> When I have my window split with many buffers, the title line on the active
> pane is a different color, but is it possible to have all 4 borders of the
> current split different the way tmux et al does?

I don't think that's possible. However, perhaps the following (which
might be improved) will suit your needs; it uses ColorColumn to change
the background color of inactive windows (of course you'll need ColorColumn
suitably set; darker than Normal would be good, I suppose), so the
current window seems highlighted (it would be better still to set NonText
too):


function! s:SetCurrentWindow()
for i in range(1, tabpagewinnr(tabpagenr(), '$'))
let l:range = ""
if i != winnr()
for j in range(1, winwidth(i))
let l:range = l:range . j . ","
endfor
let l:range = substitute(l:range, ',$', '', '')
endif
call setwinvar(i, '&cc', l:range)
endfor
endfunction

au WinEnter * call s:SetCurrentWindow()


Best,
Paul

John Little

unread,
Feb 2, 2012, 4:30:53 AM2/2/12
to vim_use
On Feb 2, 4:47 pm, Rich Healey <healey.r...@gmail.com> wrote:
>
> Sometimes when I have many splits I find it hard to find where I left my
> focus.

Sounds like your cursor is insufficiently conspicuous. If you're
using gvim, see :h guicursor. I have

set guicursor=n-c:hor20,v:hor25,ve:ver35,o:hor50,i-ci:ver25,
\r-cr:hor35-ErrorMsg,sm:block
" this looks odd, but it works; the second setting of guicursor does
not undo
" the previous settings
set guicursor=a:blinkwait200-blinkon200-blinkoff200

Otherwise, your terminal emulator may have possibilities. F. ex,

xterm -bc -bcf 200 -bcn 200 -cr red

or have a look in the wiki: http://vim.wikia.com/wiki/Configuring_the_cursor

Regards, John

Christian Brabandt

unread,
Feb 2, 2012, 6:30:49 AM2/2/12
to vim...@googlegroups.com
May be just as simple as:

au WinEnter * :set cul
au WinLeave * :set nocul

regards,
Christian

Rich Healey

unread,
Feb 2, 2012, 4:56:24 PM2/2/12
to vim...@googlegroups.com
Thanks all for your replies. I'm going to experiment with all 3 approaches today and see which I prefer.
Reply all
Reply to author
Forward
0 new messages