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!










share|improve this question





















  • 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














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!










share|improve this question





















  • 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












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!










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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
















  • 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















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












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'





share|improve this answer




















  • Great explanation, thanks!
    – Carson Wilcox
    Nov 14 at 18:31

















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).






share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    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

























    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'





    share|improve this answer




















    • Great explanation, thanks!
      – Carson Wilcox
      Nov 14 at 18:31














    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'





    share|improve this answer




















    • Great explanation, thanks!
      – Carson Wilcox
      Nov 14 at 18:31












    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'





    share|improve this answer












    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'






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 12 at 8:14









    Ingo Karkat

    128k14141193




    128k14141193











    • 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




    Great explanation, thanks!
    – Carson Wilcox
    Nov 14 at 18:31












    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).






    share|improve this answer
























      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).






      share|improve this answer






















        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).






        share|improve this answer












        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).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 21:49









        Kent

        142k25150212




        142k25150212



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo