How to avoid multi cursor on wrapped lines in VS Code?
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
add a comment |
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
add a comment |
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
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
visual-studio-code vscode-settings
edited Nov 16 '18 at 10:33
Fabian
asked Nov 13 '18 at 14:17
FabianFabian
94112
94112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Follow the next steps:
Alt
+Shift
+i
to put a cursor on every selected lineCmd/Ctrl
+←
to move all cursors to the beginning of the [wrapped] linesCmd/Ctrl
+←
(again) to move all cursors to the actual beginning of the [wrapped] lines
Enjoy! 🙂
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 theHome
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 ofCmd
+←
moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would beCtrl
+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 theCmd
+←
shortcut. I don't know if in Windows/Linux it would be the same typingCtrl
+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
add a comment |
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
);
);
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%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
Follow the next steps:
Alt
+Shift
+i
to put a cursor on every selected lineCmd/Ctrl
+←
to move all cursors to the beginning of the [wrapped] linesCmd/Ctrl
+←
(again) to move all cursors to the actual beginning of the [wrapped] lines
Enjoy! 🙂
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 theHome
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 ofCmd
+←
moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would beCtrl
+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 theCmd
+←
shortcut. I don't know if in Windows/Linux it would be the same typingCtrl
+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
add a comment |
Follow the next steps:
Alt
+Shift
+i
to put a cursor on every selected lineCmd/Ctrl
+←
to move all cursors to the beginning of the [wrapped] linesCmd/Ctrl
+←
(again) to move all cursors to the actual beginning of the [wrapped] lines
Enjoy! 🙂
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 theHome
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 ofCmd
+←
moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would beCtrl
+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 theCmd
+←
shortcut. I don't know if in Windows/Linux it would be the same typingCtrl
+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
add a comment |
Follow the next steps:
Alt
+Shift
+i
to put a cursor on every selected lineCmd/Ctrl
+←
to move all cursors to the beginning of the [wrapped] linesCmd/Ctrl
+←
(again) to move all cursors to the actual beginning of the [wrapped] lines
Enjoy! 🙂
Follow the next steps:
Alt
+Shift
+i
to put a cursor on every selected lineCmd/Ctrl
+←
to move all cursors to the beginning of the [wrapped] linesCmd/Ctrl
+←
(again) to move all cursors to the actual beginning of the [wrapped] lines
Enjoy! 🙂
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 theHome
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 ofCmd
+←
moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would beCtrl
+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 theCmd
+←
shortcut. I don't know if in Windows/Linux it would be the same typingCtrl
+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
add a comment |
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 theHome
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 ofCmd
+←
moves the cursor to the beginning of the current line instead of jumping over one word. You're right, in Windows/Linux it would beCtrl
+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 theCmd
+←
shortcut. I don't know if in Windows/Linux it would be the same typingCtrl
+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
add a comment |
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.
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%2f53283020%2fhow-to-avoid-multi-cursor-on-wrapped-lines-in-vs-code%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