8 ms·
My favorite is multi-selection mode. It's not the same as "Column Mode" you find in other IDEs but try it and you will never want another editor again: (Option
by coding123 8y ago
My favorite is multi-selection mode. It's not the same as "Column Mode" you find in other IDEs but try it and you will never want another editor again:
(Option)Alt-Cmd + Down or Up arrow key
From there, you can use arrow keys as normal, but instead of controlling one carrot, you control all the ones you created. So if I use the shortcut key to move to the next word, they all do, same with end of line, or what have you. In the past I had to use regex in my editors to extract quoted text in each line... now I just use multi-select. Each carrot can also be created with the mouse in the Selection menu.
Edit: Apparently it's a feature lifted from Sublime and in other IDEs - thanks!
- parmesan 8y agoI believe it is the same functionality as in Sublime, IntelliJ, Eclipse and others. It's a total lifesaver when editing bulk stuff, like a lot of constants and what not! One of my must-haves in an IDE.
- deleted 8y ago[deleted]
- matthewmacleod 8y agoI'm not sure where this feature originated, but it's been a core feature of Sublime for as long as I've used it, and is also broadly available in other editors. Definitely not a VS Code-specific thing, though it's still great!
- jobigoud 8y agoI believe Sublime introduced the feature. I looked it up and it was already present in the first release on January 18, 2008.
- dexterdog 8y agoColumn editing? That was in a shareware text editor that I wrote for Windows in the mid 90s and I didn't invent it.
- setr 8y agomulti-selection; multiple cursors, arbitrary (non-contiguous) columns, arbitrary rows.
- ehsankia 8y agoEditors like n++ have column editing, but Sublime takes it to a different level. It's most generalized, it's multi-cursor. You can for example put your cursor on a word, spam ctrl+d (of press alt+f3) to select all instances of that word, and start editing them all at ones, no matter where they are. They don't have to be perfectly in a column. You can also copy X items from anywhere, and if you have X cursors again somewhere else and paste, they'll each go in their respective slot.
- JonathonW 8y agoI doubt it's where it originated, but I was using multi-select/multi-caret editing in jEdit before Sublime came around. That and arbitrary window splitting (split any pane horizontally or vertically) are two features I really miss when they're not present. The latter's surprisingly hard to find; Sublime and VS Code don't do it (Atom does).
- tenryuu 8y agoVisual Studio gets this feature soon, otherwise I use it all the time in sublime https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/4408859-native-multi-editing-multiple-cursors-and-selecti https://visualstudio.uservoice.com/forums/121579-visual-stud...
- staticassertion 8y agoThis exists in most editors I've used (intellij is alt + shift + click or double tap alt, if I recall). I don't know how people program without this feature - they should teach this shit in school. Multicursor is amazing. One thing it's been great for: I have code like: byte b1 = array[0]; And I want to do this for 16 bytes. Control + D to duplicate 15x. Double tap control, hit up 15 times - now there's a cursor at every row. Hold control, hit right (jump by word), index to end of 'b1' on each line. Ctrl + shift + a, 'increment duplicates' - now every line is 1, 2, 3, 4... 16. `ctrl + right` my way to the index key and do the same thing. It's awesome. edit: I just found 'duplicate and increment' :o
- tmerr 8y agoAnd here I am using for loops like a caveman
- alexeldeib 8y agoI think loop unrolling is super cool. We're typically trained in programming to try to eliminate the kind of reuse that unrolling typically looks like, but when applied properly it can work really well. I guess that applies to most tools, though.
- ben-schaaf 8y agoSometimes I have 2 alternatives for a piece of code, one commented out and the other not, and I'd like to toggle between the two. With multicursor I just select both and hit `ctrl-/` to toggle them on and off. I've had issues in IDEs where they have shitty implementations of multicursor that break that example.
- nickjj 8y agoI recently discovered a vscode extension literally called "Insert Cursor at Beginning of Each Line Selected". Super handy when you want multiple cursors to line up at the start of every line (by default vscode will wrap the cursor around to the end of the longer lines if you try to move around with the arrow keys). There's about 20 other extensions I routinely use, which I documented at https://nickjanetakis.com/blog/switching-to-vscode-from-sublime-text#vscode-extensions https://nickjanetakis.com/blog/switching-to-vscode-from-subl....
- 0x6c6f6c 8y agoWhat's this do differently from just pressing Home with multicursors?
- nickjj 8y ago> What's this do differently from just pressing Home with multicursors? Pressing home doesn't always put you at the true beginning of the line. It will put you at the first non-whitespace character.
- kwood 8y agoIt saves a whole keypress (because you need to go into multicursor mode first, then press Home / Ctrl+A to get to the beginning of the line. Additionally, there is a case where if you don't select the last line until the end, you end up in a state where the last cursor is already at the beginning. If you press "Home" now, you end up having that last cursor at the beginning of the line - and the other ones at the indentation level (see https://github.com/Microsoft/vscode/issues/14919#issuecomment-258928515 https://github.com/Microsoft/vscode/issues/14919#issuecommen...) (Disclaimer: Author of the mentioned plugin, so I am heavily biased against my own workflow and saving-keypresses-obsession :P)
- conistonwater 8y agocarrot?
- humanrebar 8y agocaret
- ccharles 8y agos/carrot/caret/: https://en.wikipedia.org/wiki/Cursor_(user_interface)#Text_cursor https://en.wikipedia.org/wiki/Cursor_(user_interface)#Text_c...
- unhammer 8y agoIn Emacs this feature is called multiple-cursors: http://emacsrocks.com/e13.html http://emacsrocks.com/e13.html – Emacs got it after Sublime. But I find I typically get things done faster with keyboard macros, or maybe I'm just too stuck in my ways :)
- andrepd 8y agoSublime's multicursor works the same way, I believe.
- marssaxman 8y ago(I think you mean "caret" and not "carrot".)
- SSLy 8y agoV to for block-visual highlight, then do your motion, hit esc and I'll be repeated on every line