4 ms·
Ok, also am curious about multi-insertion with cntr-left/right that vscode does: For example, let’s say I have a json object with variety of field names, one p
by ricksharp 6y ago
Ok, also am curious about multi-insertion with cntr-left/right that vscode does:
For example, let’s say I have a json object with variety of field names, one per line and I want to remove the quotes.
With vscode, I can alt select all lines, Home Ctrl+right del cntl+right del.
The trick is the field names are different length, does vim have multi-edit with the ability to navigate relative to each insertion point?
Edit: Here is a good video example (https://youtu.be/iomWEDMBlcE https://youtu.be/iomWEDMBlcE)
Can vim do something like that?
- stewbrew 6y agoI vaguely remember there is a plugin that does multi line edits - what I never found useful. I personally would rather use :s (search-replace) for that. Regexp is your friend.
- dhmiller 6y agoThere are things that vim does better. There are things that VS Code does better. There are things that Visual Studio does better. You can memorize all sorts of things about your particular editor of choice and you will be more efficient and effective in that editor. If I wanted to cherry pick examples of what vim does better, I could start all of them with, "first ssh into a random server." What makes vim great is that it has a tremendous number of features and is available nearly everywhere. Can VS Code do that?
- imtringued 6y agosshing into a server invalidates all the time you spent on customizing your local vim.
- alwillis 6y agoIf you’re on your machine, you can do all of your stuff because you can edit files remotely from within Vim using SSH as the transport: http://usevim.com/2012/03/16/editing-remote-files http://usevim.com/2012/03/16/editing-remote-files If you’re on a new machine, you can grab your dotfile repo from wherever you keep it—like GitHub for example—and you’ve got your complete config, since there just text files. Takes 5 minutes. But even plain vanilla Vim is more than enough for many tasks on a new Unix/Linux box.
- bjoli 6y agoNot if you use Emacs/evil. Tramp invalidates most of the "well, vim is available on all my remote servers, whereas Emacs never is". I just remote into a server from within Emacs. Evil is also the best and most complete vim experience outside of vim.
- snorlaxle 6y agoVS Code can (sort of) do that: https://github.com/cdr/sshcode https://github.com/cdr/sshcode
- Lio 6y agoThere's a couple of ways you could tackle editing that depending on what your json looks like. For example you could use the visual block mode (ctrl-v) and highlight to the end of the line using $ and then use A to edit the end of every line at the same time. That works with lines of different length. Or you could use a regex inside of a block selection. Or there's a multi-cursor plugin available for the same approach as you're currently using in VSCode: https://github.com/terryma/vim-multiple-cursors https://github.com/terryma/vim-multiple-cursors Vim Golf is an excellent resource for seeing how to efficiently edit things in Vim: https://www.vimgolf.com/ https://www.vimgolf.com/
- RMPR 6y agoFor your use case there are a lot of ways to do that in Vim without using the multi cursor, here[0] is one thing I just recorded to show you a glimpse of what's possible with just a search and replace: I just find a pattern and replace it with a part of the same pattern. > Here is a good video example (https://youtu.be/iomWEDMBlcE https://youtu.be/iomWEDMBlcE) Again, you can do everything here without using multicursors, just record a macro for one line and repeat with a count and you're set. Now if you absolutely want the multicursor feature, there are more than one plugin[1][2] for that, but I never felt the urge to use multiple cursors in Vim. 0: https://youtu.be/YR7rRC-vwj4 https://youtu.be/YR7rRC-vwj4 1: https://github.com/terryma/vim-multiple-cursors https://github.com/terryma/vim-multiple-cursors 2: https://github.com/paradigm/vim-multicursor https://github.com/paradigm/vim-multicursor