News for hackers. Stuff that matters.
Re:How Did Vim Become So Popular? by ricksharp on Tuesday June 30, 2020 @10:51PM (#23697250)
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)

Can vim do something like that?

Re:How Did Vim Become So Popular? by dhmiller on Wednesday July 01, 2020 @01:31AM (#23698065)
There 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?

Re:How Did Vim Become So Popular? by snorlaxle on Wednesday July 01, 2020 @08:13AM (#23700530)
VS Code can (sort of) do that: https://github.com/cdr/sshcode
Re:How Did Vim Become So Popular? by imtringued on Wednesday July 01, 2020 @04:26AM (#23699196)
sshing into a server invalidates all the time you spent on customizing your local vim.
Re:How Did Vim Become So Popular? by alwillis on Wednesday July 01, 2020 @05:54AM (#23699733)
If 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

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.

Re:How Did Vim Become So Popular? by bjoli on Thursday July 02, 2020 @05:04AM (#23711342)
Not 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.

Re:How Did Vim Become So Popular? by RMPR on Wednesday July 01, 2020 @04:56AM (#23699378)
For 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)

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

1: https://github.com/terryma/vim-multiple-cursors

2: https://github.com/paradigm/vim-multicursor

Re:How Did Vim Become So Popular? by Lio on Wednesday July 01, 2020 @04:22AM (#23699174)
There'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

Vim Golf is an excellent resource for seeing how to efficiently edit things in Vim: https://www.vimgolf.com/

Re:How Did Vim Become So Popular? by stewbrew on Wednesday July 01, 2020 @01:12AM (#23697969)
I 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.