user3139545
user3139545

Reputation: 7374

Only use relative linenumbers in current buffer for Vim in Terminal

I want to use relativenumbers only for the current buffer and when Vim is that active pane in Tmux. This is so that I can use gdb in one pane and vim in another and be able to see the actual linenumbers in the Vim C sourcefile.

This is what im trying right now:

autocmd BufLeave * : set number                                                             
autocmd BufEnter * : set relativenumber 

This does however not give me the wanted behavior since nothing happens when I switch out of Vim.

Upvotes: 2

Views: 266

Answers (1)

Kent
Kent

Reputation: 195029

you need setlocal, try these two lines in your vimrc:

autocmd BufLeave * : setlocal norelativenumber
autocmd BufEnter * : setlocal relativenumber

Upvotes: 3

Related Questions