microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.63k stars 29.43k forks source link

Allow to create multi-cursor with keyboard #20742

Open Tekbr opened 7 years ago

Tekbr commented 7 years ago

-- Sorry for the English, I used Google Translator --

Allow me to place multiple cursors by navigating with the arrow keys.

Like this extension multi-cursor-plus of Atom. Press alt + x to highlight a cursor, use the arrow keys to scroll to the next location you want (by pressing the altkey), and press again.

If I wanted to take some specific cursor, I'll enter the arrows to the location and press alt + x again.

68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6b616e6b61726973746f2f61746f6d2d6d756c74692d637572736f722d706c75732f6769662f73686f77636173652e676966

alexdima commented 7 years ago

This could be done from an extension. Out of the box, we ship with ctrl+alt+down that adds a cursor down for each cursor or alt+click.

In this specific example, I would select ': ' and use ctrl+d to swiftly and efficiently select all those instances.

ricardofreeman commented 7 years ago

I am looking for this exact feature on VSCode, I love it on Atom and was trying to replicate it on VSCode. Ctrl-Alt-Down/Up is not the same thing, I'd like to be able to freely move the active cursor while holding Alt and marking it with X whenever I want. After releasing Alt all cursors would be positioned where I wanted. It's a lot faster than using the mouse.

eromoe commented 7 years ago

In sublime Ctrl-Alt-Down/Up, create cursors, and ctrl+ x would cut all cursors lines. But vscode not, only cut the original cursor line.

vscodebot[bot] commented 6 years ago

We try to keep VS Code lean and we think the functionality you're asking for is great for a VS Code extension. Maybe you can already find one that suits you in the VS Code Marketplace. Just in case, in a few simple steps you can get started writing your own extension. See also our issue reporting guidelines.

Happy Coding!

Tekbr commented 6 years ago

-- Sorry for the English, I used Google Translator --

@mjbvz , sorry, but simply remove and re-add the label "* extension-candidate" to the bot to close the question? Really? Being an extension-candidate does not justify closing ... if someone is interested it will be easier to find.

Yes, in fact this issue was based on an Atom extension, but that might well be native to VSCode. I urge you to reopen the issue, or show a justification for closing it other than "Many Houses Open" or "Few Votes." For a significant vote, not to the point of being a priority.

Tekbr commented 6 years ago

@mjbvz or @alexandrudima , did you reopen the issue?

Tekbr commented 6 years ago

-- Sorry for the English, I used Google Translator --

A lot, but thank you very much @alexandrudima , for reopening the issue !! ❤️ 😍

I'm happy for your understanding and other users still want this feature (either natively or by extension) 😄 👍

vjdw commented 6 years ago

I don't know how this compares to how it's done in Atom, but the cursor-tools extension solves this issue for me.

Tekbr commented 6 years ago

-- Sorry for the English, I used Google Translator --

@vjdw The Atom extension works most intuitively to date for me. Try it. It has more features. See the gif in the first post.

eromoe commented 6 years ago

@vjdw Sorry, this ext doesn't work at all. ctrl+alt + downarrow would not add a cursor in down position of current.

ricardofreeman commented 6 years ago

cursor-tools extension works @eromoe, check your keybindings. You might have them already being applied to something else. I set the option to mark the cursor with Alt+X and the option to enable all marks with Alt+Z and it works like a charm: cursor_tools

Tekbr commented 6 years ago

-- Sorry for the English, I used Google Translator --

@ricardofreeman It still does not convince me ... Maybe you can explain how it worked! 🤔

1- After activating some cursors, edit what you need, how can I disable only one cursor by navigating the file with (up, down, left, right) without affecting the position of the other cursors? 2 - After activating some cursors, edit what you need, how can I activate another cursor by navigating the file with (up, down, left, right) without affecting the position of the other cursors?

ricardofreeman commented 6 years ago

@Tekbr you're right, I wasn't able to change the active cursors once enabled. Perhaps the developer @sergiirocks will allow this in the future? Still, it's better than nothing :)

tonix-tuft commented 4 years ago

Cursor tools FTW.

idanpa commented 3 years ago

Solved similar problem using different approach - extension for context aware multi-cursor.

mitchellevan commented 3 years ago

Please add the "accessibility" label to this issue. It's important for hands-free voice control or any other assistive technology that emulates a keyboard. Recently added screen reader support for multiple cursors further increases the importance of full keyboard access.

Nabav commented 3 years ago

It is relatively a long time that I can't use the Cursor Tools. Any idea?

zachpoblete commented 2 years ago

2023 Edit: Someone just made a working version of Cursor tools!

I can confirm that Cursor tools, along with its fork, Cursor tools by ctf0, doesn't work as of VS Code v1.70.2. Both have seemed to be abandoned. There is another extension directly inspired by Cursor tools, Cursor Drop; however, that's for Atom.

I've searched to the ends of the earth in the Marketplace, manually combing through each result for the query in "cursor", "multi-cursor", "multicursor", "anchor", "marker", "caret", and "indicator". I've probably looked at at least a thousand extensions, but I haven't found one that can do what Cursor tools could.

I've concluded that no such working extension for the latest release of VS Code exists at the moment. The next best thing to do would be to fork Cursor tools and fix it for the latest release and keep upvoting this issue.

Nabav commented 1 year ago

Need this from deepest point of my heart. :sob: :broken_heart:

srares13 commented 1 year ago

I developed this extension which lets you create cursors and selections wherever you want in the document, with the keyboard: https://marketplace.visualstudio.com/items?itemName=srares13.kcs

Inform me of any issues you have. If you want, for that you can use the Issues tab of the extension's repository.

Nabav commented 1 year ago

Try this, maybe its an answer: https://marketplace.visualstudio.com/items?itemName=srares13.kcs Inform me of any issues you have. If you want, for that you can use the Issues tab of the extension's repository.

What a good news. I should celebrate it today. :wine_glass:

The old extension was using Alt + X and Alt + Y instead of PgDn a PgUp keys as default and it was fantastic. Update: This was my personal keybindings. See below for correction.

Thanks a lot for this gift @srares13 .

zachpoblete commented 1 year ago

@srares13 you are an absolute legend. Thank you for taking the initiative.

@Nabav Actually, the old extension used Ctrl+Alt+Down and Ctrl+Alt+Up. I think you are misremembering because in your review of the original Cursor tools (all the way back in 2018!), you said you rebinded the shortcuts to Alt+X and Alt+Y.

Nabav commented 1 year ago

@srares13 you are an absolute legend. Thank you for taking the initiative.

@Nabav Actually, the old extension used Ctrl+Alt+Down and Ctrl+Alt+Up. I think you are misremembering because in your review of the original Cursor tools (all the way back in 2018!), you said you rebinded the shortcuts to Alt+X and Alt+Y.

Yes, you are right. Sorry for that. 🙈

Malix-Labs commented 11 months ago

At first I thought it was doable with createCursor but apparently not.

Do someone know what the createCursor keyboard shortcut setting do?

Update

Do someone know what the createCursor keyboard shortcut setting do?

Apparently it's broken

srares13 commented 8 months ago

I come back with a comment just to formally respond to something that was requested as well:

1- After activating some cursors, edit what you need, how can I disable only one cursor by navigating the file with (up, down, left, right) without affecting the position of the other cursors? 2 - After activating some cursors, edit what you need, how can I activate another cursor by navigating the file with (up, down, left, right) without affecting the position of the other cursors?

You can achieve both of those points with the Keyboard Cursors and Selections extension. This is made possible by leveraging features of the extension like:

If you place an inactive cursor or selection over another, the existing one will be removed Undo-Redo system Inactive cursors and selections react to document edits

These features are all described within the home page of the extension.