This very simple plugin provides commands to simultaneously set the number
and relativenumber
options in vim and to switch between different
combinations of these options.
You can use your favourite installation method. With Tim Pope's
pathogen it is simply a question of
cloning the lineno.vim
repository into your vim bundle directory.
cd ~/.vim/bundle
git clone git://github.com/heindsight/lineno.vim
The :SetLineNoMode
command simultaneously sets the number
and
relativenumber
options in vim. It takes a single integer argument which
determines the line numbering mode:
- No numbering (
'number'
and'relativenumber'
both unset) - Absolute numbering (
'number'
set,'relativenumber'
unset) - Relative numbering (
'number'
unset,'relativenumber'
set) - Relative numbering with absolute numbering for cursor line (
'number'
and'relativenumber'
both set)
Use :SwitchLineNoMode
to cycle between the modes listed above. You may want
to define a mapping for this command in your ~/.vimrc
. Eg:
nmap <silent><F2> :SwitchLineNoMode<CR>
Copyright (c) 2015, Heinrich Kruger. Distributed under the MIT license (see the LICENSE file).