How to avoid multi cursor on wrapped lines in VS Code?










2















QUESTION:



I have turned on wordWrap in VSCode, so that lines are wrapped if I resize the window.



If I want to comment out some code or text, I usually just move the cursor to the beginning of the first line of the block of code, use ctrl+shift+down to add cursors, and type the // or # etc..



The problem with wordWrap is that I do not only get cursors in the beginning of each actual line, but in the beginning of every line as it is displayed at the moment in the editor.



Assume the document:

1 This is the first line.
2 Second line.



which might be wrapped as follows:

1 This is the first
line.
2 Second line.



So if I use the method above and add % I would get:

1 %This is the first
%line.
2 %Second line.



But what I want is the following:

1 %This is the first
line.
2 %Second line.



Otherwise, I have a % in the middle of the line, just because I resize the editor window...



At the moment, I actually turn off wordWrap to achieve this, but I hope there is a better way?



PLEASE NOTE:



For adding comments, it is actually way simpler to use ctrl + / or shift + alt + a.
But maybe the question is still interesting for other cases.










share|improve this question




























    2















    QUESTION:



    I have turned on wordWrap in VSCode, so that lines are wrapped if I resize the window.



    If I want to comment out some code or text, I usually just move the cursor to the beginning of the first line of the block of code, use ctrl+shift+down to add cursors, and type the // or # etc..



    The problem with wordWrap is that I do not only get cursors in the beginning of each actual line, but in the beginning of every line as it is displayed at the moment in the editor.



    Assume the document:

    1 This is the first line.
    2 Second line.



    which might be wrapped as follows:

    1 This is the first
    line.
    2 Second line.



    So if I use the method above and add % I would get:

    1 %This is the first
    %line.
    2 %Second line.



    But what I want is the following:

    1 %This is the first
    line.
    2 %Second line.



    Otherwise, I have a % in the middle of the line, just because I resize the editor window...



    At the moment, I actually turn off wordWrap to achieve this, but I hope there is a better way?



    PLEASE NOTE:



    For adding comments, it is actually way simpler to use ctrl + / or shift + alt + a.
    But maybe the question is still interesting for other cases.










    share|improve this question


























      2












      2








      2


      1






      QUESTION:



      I have turned on wordWrap in VSCode, so that lines are wrapped if I resize the window.



      If I want to comment out some code or text, I usually just move the cursor to the beginning of the first line of the block of code, use ctrl+shift+down to add cursors, and type the // or # etc..



      The problem with wordWrap is that I do not only get cursors in the beginning of each actual line, but in the beginning of every line as it is displayed at the moment in the editor.



      Assume the document:

      1 This is the first line.
      2 Second line.



      which might be wrapped as follows:

      1 This is the first
      line.
      2 Second line.



      So if I use the method above and add % I would get:

      1 %This is the first
      %line.
      2 %Second line.



      But what I want is the following:

      1 %This is the first
      line.
      2 %Second line.



      Otherwise, I have a % in the middle of the line, just because I resize the editor window...



      At the moment, I actually turn off wordWrap to achieve this, but I hope there is a better way?



      PLEASE NOTE:



      For adding comments, it is actually way simpler to use ctrl + / or shift + alt + a.
      But maybe the question is still interesting for other cases.










      share|improve this question
















      QUESTION:



      I have turned on wordWrap in VSCode, so that lines are wrapped if I resize the window.



      If I want to comment out some code or text, I usually just move the cursor to the beginning of the first line of the block of code, use ctrl+shift+down to add cursors, and type the // or # etc..



      The problem with wordWrap is that I do not only get cursors in the beginning of each actual line, but in the beginning of every line as it is displayed at the moment in the editor.



      Assume the document:

      1 This is the first line.
      2 Second line.



      which might be wrapped as follows:

      1 This is the first
      line.
      2 Second line.



      So if I use the method above and add % I would get:

      1 %This is the first
      %line.
      2 %Second line.



      But what I want is the following:

      1 %This is the first
      line.
      2 %Second line.



      Otherwise, I have a % in the middle of the line, just because I resize the editor window...



      At the moment, I actually turn off wordWrap to achieve this, but I hope there is a better way?



      PLEASE NOTE:



      For adding comments, it is actually way simpler to use ctrl + / or shift + alt + a.
      But maybe the question is still interesting for other cases.







      visual-studio-code vscode-settings






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 '18 at 10:33







      Fabian

















      asked Nov 13 '18 at 14:17









      FabianFabian

      94112




      94112






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Follow the next steps:




          1. Alt+Shift+i to put a cursor on every selected line


          2. Cmd/Ctrl+ to move all cursors to the beginning of the [wrapped] lines


          3. Cmd/Ctrl+ (again) to move all cursors to the actual beginning of the [wrapped] lines

          Enjoy! 🙂






          share|improve this answer























          • Thanks. Pretty close to what I wanted ;) I guess the arrow left key is the home or Pos1 key. Then it works, but without ctrl, otherwise the cursor jumps to the beginning of the document. Only problem is if one cursor is already in the beginning of a line and other cursors are in the middle of a line. Then pressing home key repeatedly makes the cursors jump between the first letter of the line and the actual first column of that line and since the cursors start in different positions, some are at the first character and others at column 1. Only relevant if the lines are indented.

            – Fabian
            Nov 15 '18 at 8:35












          • Nope, the key is not the Home one. Here you have an image 🙂

            – Javier Ferrer González
            Nov 16 '18 at 10:37












          • ok :) but that is just the normal jump over one word instead of one character?

            – Fabian
            Nov 16 '18 at 12:06











          • Sorry, my bad 😅. In MacOS the behaviour of Cmd+ moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would be Ctrl+home in order to jump to the beginning of the line

            – Javier Ferrer González
            Nov 16 '18 at 13:21











          • What you ask in your first comment about jumping to the actual first column instead of the beginning of the text, that's the reason why I suggested to execute 2 times the Cmd+ shortcut. I don't know if in Windows/Linux it would be the same typing Ctrl+home two times. Could you confirm me that in order to edit my response and let it be accepted? 🙂

            – Javier Ferrer González
            Nov 16 '18 at 13:23










          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',
          autoActivateHeartbeat: false,
          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%2f53283020%2fhow-to-avoid-multi-cursor-on-wrapped-lines-in-vs-code%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Follow the next steps:




          1. Alt+Shift+i to put a cursor on every selected line


          2. Cmd/Ctrl+ to move all cursors to the beginning of the [wrapped] lines


          3. Cmd/Ctrl+ (again) to move all cursors to the actual beginning of the [wrapped] lines

          Enjoy! 🙂






          share|improve this answer























          • Thanks. Pretty close to what I wanted ;) I guess the arrow left key is the home or Pos1 key. Then it works, but without ctrl, otherwise the cursor jumps to the beginning of the document. Only problem is if one cursor is already in the beginning of a line and other cursors are in the middle of a line. Then pressing home key repeatedly makes the cursors jump between the first letter of the line and the actual first column of that line and since the cursors start in different positions, some are at the first character and others at column 1. Only relevant if the lines are indented.

            – Fabian
            Nov 15 '18 at 8:35












          • Nope, the key is not the Home one. Here you have an image 🙂

            – Javier Ferrer González
            Nov 16 '18 at 10:37












          • ok :) but that is just the normal jump over one word instead of one character?

            – Fabian
            Nov 16 '18 at 12:06











          • Sorry, my bad 😅. In MacOS the behaviour of Cmd+ moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would be Ctrl+home in order to jump to the beginning of the line

            – Javier Ferrer González
            Nov 16 '18 at 13:21











          • What you ask in your first comment about jumping to the actual first column instead of the beginning of the text, that's the reason why I suggested to execute 2 times the Cmd+ shortcut. I don't know if in Windows/Linux it would be the same typing Ctrl+home two times. Could you confirm me that in order to edit my response and let it be accepted? 🙂

            – Javier Ferrer González
            Nov 16 '18 at 13:23















          0














          Follow the next steps:




          1. Alt+Shift+i to put a cursor on every selected line


          2. Cmd/Ctrl+ to move all cursors to the beginning of the [wrapped] lines


          3. Cmd/Ctrl+ (again) to move all cursors to the actual beginning of the [wrapped] lines

          Enjoy! 🙂






          share|improve this answer























          • Thanks. Pretty close to what I wanted ;) I guess the arrow left key is the home or Pos1 key. Then it works, but without ctrl, otherwise the cursor jumps to the beginning of the document. Only problem is if one cursor is already in the beginning of a line and other cursors are in the middle of a line. Then pressing home key repeatedly makes the cursors jump between the first letter of the line and the actual first column of that line and since the cursors start in different positions, some are at the first character and others at column 1. Only relevant if the lines are indented.

            – Fabian
            Nov 15 '18 at 8:35












          • Nope, the key is not the Home one. Here you have an image 🙂

            – Javier Ferrer González
            Nov 16 '18 at 10:37












          • ok :) but that is just the normal jump over one word instead of one character?

            – Fabian
            Nov 16 '18 at 12:06











          • Sorry, my bad 😅. In MacOS the behaviour of Cmd+ moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would be Ctrl+home in order to jump to the beginning of the line

            – Javier Ferrer González
            Nov 16 '18 at 13:21











          • What you ask in your first comment about jumping to the actual first column instead of the beginning of the text, that's the reason why I suggested to execute 2 times the Cmd+ shortcut. I don't know if in Windows/Linux it would be the same typing Ctrl+home two times. Could you confirm me that in order to edit my response and let it be accepted? 🙂

            – Javier Ferrer González
            Nov 16 '18 at 13:23













          0












          0








          0







          Follow the next steps:




          1. Alt+Shift+i to put a cursor on every selected line


          2. Cmd/Ctrl+ to move all cursors to the beginning of the [wrapped] lines


          3. Cmd/Ctrl+ (again) to move all cursors to the actual beginning of the [wrapped] lines

          Enjoy! 🙂






          share|improve this answer













          Follow the next steps:




          1. Alt+Shift+i to put a cursor on every selected line


          2. Cmd/Ctrl+ to move all cursors to the beginning of the [wrapped] lines


          3. Cmd/Ctrl+ (again) to move all cursors to the actual beginning of the [wrapped] lines

          Enjoy! 🙂







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 23:50









          Javier Ferrer GonzálezJavier Ferrer González

          1,89121514




          1,89121514












          • Thanks. Pretty close to what I wanted ;) I guess the arrow left key is the home or Pos1 key. Then it works, but without ctrl, otherwise the cursor jumps to the beginning of the document. Only problem is if one cursor is already in the beginning of a line and other cursors are in the middle of a line. Then pressing home key repeatedly makes the cursors jump between the first letter of the line and the actual first column of that line and since the cursors start in different positions, some are at the first character and others at column 1. Only relevant if the lines are indented.

            – Fabian
            Nov 15 '18 at 8:35












          • Nope, the key is not the Home one. Here you have an image 🙂

            – Javier Ferrer González
            Nov 16 '18 at 10:37












          • ok :) but that is just the normal jump over one word instead of one character?

            – Fabian
            Nov 16 '18 at 12:06











          • Sorry, my bad 😅. In MacOS the behaviour of Cmd+ moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would be Ctrl+home in order to jump to the beginning of the line

            – Javier Ferrer González
            Nov 16 '18 at 13:21











          • What you ask in your first comment about jumping to the actual first column instead of the beginning of the text, that's the reason why I suggested to execute 2 times the Cmd+ shortcut. I don't know if in Windows/Linux it would be the same typing Ctrl+home two times. Could you confirm me that in order to edit my response and let it be accepted? 🙂

            – Javier Ferrer González
            Nov 16 '18 at 13:23

















          • Thanks. Pretty close to what I wanted ;) I guess the arrow left key is the home or Pos1 key. Then it works, but without ctrl, otherwise the cursor jumps to the beginning of the document. Only problem is if one cursor is already in the beginning of a line and other cursors are in the middle of a line. Then pressing home key repeatedly makes the cursors jump between the first letter of the line and the actual first column of that line and since the cursors start in different positions, some are at the first character and others at column 1. Only relevant if the lines are indented.

            – Fabian
            Nov 15 '18 at 8:35












          • Nope, the key is not the Home one. Here you have an image 🙂

            – Javier Ferrer González
            Nov 16 '18 at 10:37












          • ok :) but that is just the normal jump over one word instead of one character?

            – Fabian
            Nov 16 '18 at 12:06











          • Sorry, my bad 😅. In MacOS the behaviour of Cmd+ moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would be Ctrl+home in order to jump to the beginning of the line

            – Javier Ferrer González
            Nov 16 '18 at 13:21











          • What you ask in your first comment about jumping to the actual first column instead of the beginning of the text, that's the reason why I suggested to execute 2 times the Cmd+ shortcut. I don't know if in Windows/Linux it would be the same typing Ctrl+home two times. Could you confirm me that in order to edit my response and let it be accepted? 🙂

            – Javier Ferrer González
            Nov 16 '18 at 13:23
















          Thanks. Pretty close to what I wanted ;) I guess the arrow left key is the home or Pos1 key. Then it works, but without ctrl, otherwise the cursor jumps to the beginning of the document. Only problem is if one cursor is already in the beginning of a line and other cursors are in the middle of a line. Then pressing home key repeatedly makes the cursors jump between the first letter of the line and the actual first column of that line and since the cursors start in different positions, some are at the first character and others at column 1. Only relevant if the lines are indented.

          – Fabian
          Nov 15 '18 at 8:35






          Thanks. Pretty close to what I wanted ;) I guess the arrow left key is the home or Pos1 key. Then it works, but without ctrl, otherwise the cursor jumps to the beginning of the document. Only problem is if one cursor is already in the beginning of a line and other cursors are in the middle of a line. Then pressing home key repeatedly makes the cursors jump between the first letter of the line and the actual first column of that line and since the cursors start in different positions, some are at the first character and others at column 1. Only relevant if the lines are indented.

          – Fabian
          Nov 15 '18 at 8:35














          Nope, the key is not the Home one. Here you have an image 🙂

          – Javier Ferrer González
          Nov 16 '18 at 10:37






          Nope, the key is not the Home one. Here you have an image 🙂

          – Javier Ferrer González
          Nov 16 '18 at 10:37














          ok :) but that is just the normal jump over one word instead of one character?

          – Fabian
          Nov 16 '18 at 12:06





          ok :) but that is just the normal jump over one word instead of one character?

          – Fabian
          Nov 16 '18 at 12:06













          Sorry, my bad 😅. In MacOS the behaviour of Cmd+ moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would be Ctrl+home in order to jump to the beginning of the line

          – Javier Ferrer González
          Nov 16 '18 at 13:21





          Sorry, my bad 😅. In MacOS the behaviour of Cmd+ moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would be Ctrl+home in order to jump to the beginning of the line

          – Javier Ferrer González
          Nov 16 '18 at 13:21













          What you ask in your first comment about jumping to the actual first column instead of the beginning of the text, that's the reason why I suggested to execute 2 times the Cmd+ shortcut. I don't know if in Windows/Linux it would be the same typing Ctrl+home two times. Could you confirm me that in order to edit my response and let it be accepted? 🙂

          – Javier Ferrer González
          Nov 16 '18 at 13:23





          What you ask in your first comment about jumping to the actual first column instead of the beginning of the text, that's the reason why I suggested to execute 2 times the Cmd+ shortcut. I don't know if in Windows/Linux it would be the same typing Ctrl+home two times. Could you confirm me that in order to edit my response and let it be accepted? 🙂

          – Javier Ferrer González
          Nov 16 '18 at 13:23

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283020%2fhow-to-avoid-multi-cursor-on-wrapped-lines-in-vs-code%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







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3

          Museum of Modern and Contemporary Art of Trento and Rovereto