I know you can add line numbers in vim by using,
:set number
How do I set this to default behavior?
" turn relative line numbers on :set relativenumber :set rnu " turn relative line numbers off :set norelativenumber :set nornu " toggle relative line numbers :set relativenumber! :set rnu! Like most commands in Vim, the j and k (or ↑ and ↓ ) keys can be prefixed with a number.
If you want to select the entire line in a file, press V. Now when you press k or j to go up and down, vim will select the entire line above and below your cursor. Finally, you can select text in columns by pressing ctrl+v and moving up or down the block.
add this line to ~/.vimrc (if not exist, create a new file)
:set nu
and save the file
the settings in $HOME/.vimrc
file would be loaded automatically.
Except for set number
to show linenumber, I have this to toggle normal line number and relative line number: (by pressing <leader>nu
)
"---------------------------------------------------------
"toggle relativeline number
"---------------------------------------------------------
function! ToggleRelativeNumber()
let &relativenumber = &relativenumber?0:1
"let &number = &relativenumber? 0:1
endfunction
nnoremap <silent> <Leader>nu :call ToggleRelativeNumber()<cr>
https://github.com/sk1418/myConf/blob/master/common/.vimrc#L704
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With