I started to use vim recently, but I miss the character/line selection methods from other text editors. By default vim maps
,
Vim doesn't bend to that easily in my opinion. The terminal one doesn't even recognize Shift-Up in my case! I thought the v
(character-wise selection) or V
(line-wise selection) was among the easier concepts to learn about vi/vim.
If this works (can't test right now), this is something you'll want:
" activate visual mode in normal mode
nmap <S-Up> V
nmap <S-Down> V
" these are mapped in visual mode
vmap <S-Up> k
vmap <S-Down> j
"
" etc...
" similarly <S-Left>, <S-Right> for v
There's an specific option for this: keymodel:
'keymodel' 'km' string (default "")
global
{not in Vi}
List of comma separated words, which enable special things that keys
can do. These values can be used:
startsel Using a shifted special key starts selection (either
Select mode or Visual mode, depending on "key" being
present in 'selectmode').
stopsel Using a not-shifted special key stops selection.
Special keys in this context are the cursor keys, <End>, <Home>,
<PageUp> and <PageDown>.
The 'keymodel' option is set by the |:behave| command.
TL;DR: To enable the behavior you want, use:
set keymodel=startsel
If you also want to leave visual mode when using <Up>
or <Down>
without <Shift>
pressed, you can use:
set keymodel=startsel,stopsel