Why does SHIFT+V (VISUAL LINE) not multi-line insert the way CTRL+V (VISUAL BLOCK) does?
up vote
1
down vote
favorite
I'm just curious, why do I have to use visual block selection to insert into multiple lines instead of visual line?
What is the difference behind the scenes that causes this difference?
Thanks in advance!
vim
add a comment |
up vote
1
down vote
favorite
I'm just curious, why do I have to use visual block selection to insert into multiple lines instead of visual line?
What is the difference behind the scenes that causes this difference?
Thanks in advance!
vim
How would you expect it to work? Where would the text be inserted and why?
– Christian Gibbons
Nov 9 at 21:21
My thinking was that sinceI
inserts at the beginning of a line, when multiple lines were selected it would apply that command to every line. I understood why visual block works like that (thanks to /u/Kent), but not why visual line does not offerI
orA
functionality by default as /u/Ingo_Karkat mentioned. Thanks to his explanation I think I get it now though.
– Carson Wilcox
Nov 14 at 18:31
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm just curious, why do I have to use visual block selection to insert into multiple lines instead of visual line?
What is the difference behind the scenes that causes this difference?
Thanks in advance!
vim
I'm just curious, why do I have to use visual block selection to insert into multiple lines instead of visual line?
What is the difference behind the scenes that causes this difference?
Thanks in advance!
vim
vim
asked Nov 9 at 21:03
Carson Wilcox
697
697
How would you expect it to work? Where would the text be inserted and why?
– Christian Gibbons
Nov 9 at 21:21
My thinking was that sinceI
inserts at the beginning of a line, when multiple lines were selected it would apply that command to every line. I understood why visual block works like that (thanks to /u/Kent), but not why visual line does not offerI
orA
functionality by default as /u/Ingo_Karkat mentioned. Thanks to his explanation I think I get it now though.
– Carson Wilcox
Nov 14 at 18:31
add a comment |
How would you expect it to work? Where would the text be inserted and why?
– Christian Gibbons
Nov 9 at 21:21
My thinking was that sinceI
inserts at the beginning of a line, when multiple lines were selected it would apply that command to every line. I understood why visual block works like that (thanks to /u/Kent), but not why visual line does not offerI
orA
functionality by default as /u/Ingo_Karkat mentioned. Thanks to his explanation I think I get it now though.
– Carson Wilcox
Nov 14 at 18:31
How would you expect it to work? Where would the text be inserted and why?
– Christian Gibbons
Nov 9 at 21:21
How would you expect it to work? Where would the text be inserted and why?
– Christian Gibbons
Nov 9 at 21:21
My thinking was that since
I
inserts at the beginning of a line, when multiple lines were selected it would apply that command to every line. I understood why visual block works like that (thanks to /u/Kent), but not why visual line does not offer I
or A
functionality by default as /u/Ingo_Karkat mentioned. Thanks to his explanation I think I get it now though.– Carson Wilcox
Nov 14 at 18:31
My thinking was that since
I
inserts at the beginning of a line, when multiple lines were selected it would apply that command to every line. I understood why visual block works like that (thanks to /u/Kent), but not why visual line does not offer I
or A
functionality by default as /u/Ingo_Karkat mentioned. Thanks to his explanation I think I get it now though.– Carson Wilcox
Nov 14 at 18:31
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
The blockwise selection is the more generic one, i.e. it allows insertion of multiple lines at any place. Of course, you can think of linewise (and even characterwise) selections as degenerate cases of that, but it would be less universal (linewise would only allow insertion at column 1 or the end of lines), and therefore isn't offered by default; i.e. I
and A
are only available in blockwise visual mode. However, it's trivial to add these to the other selection modes, too:
" VisualI, VisualA Make I/A available in characterwise visual and linewise
" visual mode.
" Source: kana, http://whileimautomaton.net/
function! s:ForceBlockwiseVisualExpr()
if mode() ==# 'v'
return "<Esc>g`<<C-v>g`>"
elseif mode() ==# 'V'
return "<Esc>g`<^<C-v>g`>$"
else
return ''
endif
endfunction
xnoremap <expr> <silent> I <SID>ForceBlockwiseVisualExpr() . 'I'
xnoremap <expr> <silent> A <SID>ForceBlockwiseVisualExpr() . 'A'
Great explanation, thanks!
– Carson Wilcox
Nov 14 at 18:31
add a comment |
up vote
2
down vote
You can understand it as "line-mode" and "column-mode". You want to add something on same column of multiple lines, you use "ctrl-v" (column mode).
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The blockwise selection is the more generic one, i.e. it allows insertion of multiple lines at any place. Of course, you can think of linewise (and even characterwise) selections as degenerate cases of that, but it would be less universal (linewise would only allow insertion at column 1 or the end of lines), and therefore isn't offered by default; i.e. I
and A
are only available in blockwise visual mode. However, it's trivial to add these to the other selection modes, too:
" VisualI, VisualA Make I/A available in characterwise visual and linewise
" visual mode.
" Source: kana, http://whileimautomaton.net/
function! s:ForceBlockwiseVisualExpr()
if mode() ==# 'v'
return "<Esc>g`<<C-v>g`>"
elseif mode() ==# 'V'
return "<Esc>g`<^<C-v>g`>$"
else
return ''
endif
endfunction
xnoremap <expr> <silent> I <SID>ForceBlockwiseVisualExpr() . 'I'
xnoremap <expr> <silent> A <SID>ForceBlockwiseVisualExpr() . 'A'
Great explanation, thanks!
– Carson Wilcox
Nov 14 at 18:31
add a comment |
up vote
2
down vote
accepted
The blockwise selection is the more generic one, i.e. it allows insertion of multiple lines at any place. Of course, you can think of linewise (and even characterwise) selections as degenerate cases of that, but it would be less universal (linewise would only allow insertion at column 1 or the end of lines), and therefore isn't offered by default; i.e. I
and A
are only available in blockwise visual mode. However, it's trivial to add these to the other selection modes, too:
" VisualI, VisualA Make I/A available in characterwise visual and linewise
" visual mode.
" Source: kana, http://whileimautomaton.net/
function! s:ForceBlockwiseVisualExpr()
if mode() ==# 'v'
return "<Esc>g`<<C-v>g`>"
elseif mode() ==# 'V'
return "<Esc>g`<^<C-v>g`>$"
else
return ''
endif
endfunction
xnoremap <expr> <silent> I <SID>ForceBlockwiseVisualExpr() . 'I'
xnoremap <expr> <silent> A <SID>ForceBlockwiseVisualExpr() . 'A'
Great explanation, thanks!
– Carson Wilcox
Nov 14 at 18:31
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The blockwise selection is the more generic one, i.e. it allows insertion of multiple lines at any place. Of course, you can think of linewise (and even characterwise) selections as degenerate cases of that, but it would be less universal (linewise would only allow insertion at column 1 or the end of lines), and therefore isn't offered by default; i.e. I
and A
are only available in blockwise visual mode. However, it's trivial to add these to the other selection modes, too:
" VisualI, VisualA Make I/A available in characterwise visual and linewise
" visual mode.
" Source: kana, http://whileimautomaton.net/
function! s:ForceBlockwiseVisualExpr()
if mode() ==# 'v'
return "<Esc>g`<<C-v>g`>"
elseif mode() ==# 'V'
return "<Esc>g`<^<C-v>g`>$"
else
return ''
endif
endfunction
xnoremap <expr> <silent> I <SID>ForceBlockwiseVisualExpr() . 'I'
xnoremap <expr> <silent> A <SID>ForceBlockwiseVisualExpr() . 'A'
The blockwise selection is the more generic one, i.e. it allows insertion of multiple lines at any place. Of course, you can think of linewise (and even characterwise) selections as degenerate cases of that, but it would be less universal (linewise would only allow insertion at column 1 or the end of lines), and therefore isn't offered by default; i.e. I
and A
are only available in blockwise visual mode. However, it's trivial to add these to the other selection modes, too:
" VisualI, VisualA Make I/A available in characterwise visual and linewise
" visual mode.
" Source: kana, http://whileimautomaton.net/
function! s:ForceBlockwiseVisualExpr()
if mode() ==# 'v'
return "<Esc>g`<<C-v>g`>"
elseif mode() ==# 'V'
return "<Esc>g`<^<C-v>g`>$"
else
return ''
endif
endfunction
xnoremap <expr> <silent> I <SID>ForceBlockwiseVisualExpr() . 'I'
xnoremap <expr> <silent> A <SID>ForceBlockwiseVisualExpr() . 'A'
answered Nov 12 at 8:14
Ingo Karkat
128k14141193
128k14141193
Great explanation, thanks!
– Carson Wilcox
Nov 14 at 18:31
add a comment |
Great explanation, thanks!
– Carson Wilcox
Nov 14 at 18:31
Great explanation, thanks!
– Carson Wilcox
Nov 14 at 18:31
Great explanation, thanks!
– Carson Wilcox
Nov 14 at 18:31
add a comment |
up vote
2
down vote
You can understand it as "line-mode" and "column-mode". You want to add something on same column of multiple lines, you use "ctrl-v" (column mode).
add a comment |
up vote
2
down vote
You can understand it as "line-mode" and "column-mode". You want to add something on same column of multiple lines, you use "ctrl-v" (column mode).
add a comment |
up vote
2
down vote
up vote
2
down vote
You can understand it as "line-mode" and "column-mode". You want to add something on same column of multiple lines, you use "ctrl-v" (column mode).
You can understand it as "line-mode" and "column-mode". You want to add something on same column of multiple lines, you use "ctrl-v" (column mode).
answered Nov 9 at 21:49
Kent
142k25150212
142k25150212
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233237%2fwhy-does-shiftv-visual-line-not-multi-line-insert-the-way-ctrlv-visual-bloc%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How would you expect it to work? Where would the text be inserted and why?
– Christian Gibbons
Nov 9 at 21:21
My thinking was that since
I
inserts at the beginning of a line, when multiple lines were selected it would apply that command to every line. I understood why visual block works like that (thanks to /u/Kent), but not why visual line does not offerI
orA
functionality by default as /u/Ingo_Karkat mentioned. Thanks to his explanation I think I get it now though.– Carson Wilcox
Nov 14 at 18:31