News for hackers. Stuff that matters.
Re:TKE: Modern Tcl/Tk-based text editor by rijoja on Wednesday November 21, 2018 @02:44AM (#18500864)
I never really got how Multi-Cursor / Multi selection became such a big deal. It really never happens to me that I have to write the same thing on N-lines, and when that happens VIM ninja works just as well.
Re:TKE: Modern Tcl/Tk-based text editor by vertex-four on Wednesday November 21, 2018 @05:09AM (#18501459)
Visual editing and selection-before-action allow for users to be much more confident that they’re doing the right thing, and to build up commands step by step with feedback along the way. The problem that multiple selection solves is then the same thing that repetition of a bunch of commands solves in vim.

A bunch of longstanding vim users I know now use kakoune because of the visual feedback they can get when doing something new with their editor.

Re:TKE: Modern Tcl/Tk-based text editor by JNRowe on Wednesday November 21, 2018 @03:03AM (#18500954)
It doesn’t have to be an either/or choice, having both can work.

For example, I’ve just used vim-multiple-cursors¹ to rename a parameter to a function, and I could have done that with “straight” vim too. However, for quick operations a simple `C-n`… to select the name, followed by `c` to change all at once just /felt/ nice.

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

Re:TKE: Modern Tcl/Tk-based text editor by michaelcampbell on Wednesday November 21, 2018 @09:37AM (#18502935)
Sounds like the editor version of blub, <shrug>

I use multiple-cursors a fair bit; maybe 6-10 times a week on a full week of editing.

Sometimes it's not code, but data files I get from elsewhere that need some minor rearranging.

People have different needs.

Re:TKE: Modern Tcl/Tk-based text editor by rijoja on Wednesday November 21, 2018 @11:04AM (#18503622)
mm been a while since I handled massive amounts of data, but now I start to see how it's useful. Thanks a lot!
Re:TKE: Modern Tcl/Tk-based text editor by tpaschalis on Wednesday November 21, 2018 @02:54AM (#18500905)
Ehm, I agree with the Vim point, but think of those who won't/can't spend time getting past that Vim learning curve.

Especially for people dealing with csv files, tabular data or digging through logfiles, Multi-Cursor and Multi-selection are concepts that are easy to grasp, and can help productivity immensely, with things that are not that easy using Nano or Notepad.

Simple cases in point : Use a regular expression to find and copy all lines with a particular pattern, or copy-paste a few csv lines with a couple of fields modified.

Re:TKE: Modern Tcl/Tk-based text editor by akashakya on Wednesday November 21, 2018 @03:52AM (#18501151)
Multiple-cursor is useful when you want to edit lines which have non-trivial edits or doesn't have a common string to use find-replace. simple example

   foo_bar -> fooBar
   bar_baz -> barBaz
Sometimes even this doesn't cut it and have to use mighty Emacs macros. (I'm sure something similar exits for VIM)
Re:TKE: Modern Tcl/Tk-based text editor by laumars on Wednesday November 21, 2018 @06:13AM (#18501791)
Vim has macros[1] and other replay tools for occasions like that.

I think the issue with Vim isn't so much that things can't be done in it but more that the discoverability of Vim features is pretty poor. eg by the time you've searched the web for a quick way to do a multiline edit, you could have just done it manually. GUI IDEs tend to be better for discoverability (generally speaking).

[1]https://www.tutorialspoint.com/vim/vim_macros.htm

Re:TKE: Modern Tcl/Tk-based text editor by akashakya on Wednesday November 21, 2018 @07:49AM (#18502262)
Agreed, I think of macro as a superset of multiple-cursors. Heck, with macro you can even run arbitrary code to generate text dynamically. I had the pleasure of doing this multiple times.

In Emacs, you can use multiple registers for storing code and data for this purpose

Re:TKE: Modern Tcl/Tk-based text editor by rijoja on Wednesday November 21, 2018 @08:29AM (#18502491)
Sure but does it really happen that often, whenever there are regularities usually there's some variation that makes it useless.

Don't get me wrong, I don't mind the feature, thing is I run in it so rarely so I don't get why it would be a major sellingpoint. For example this project and perhaps more notably sublime (an editor that I do enjoy quite a bit!)

Re:TKE: Modern Tcl/Tk-based text editor by leni536 on Wednesday November 21, 2018 @08:07AM (#18502364)
Assuming the '_' characters are on the same column for all lines then vim's block visual is quite adequate for the task. If it's not the case then I don't know how multiple-cursor will help, you still need some kind of regex to put the cursors at the right places, don't you?
Re:TKE: Modern Tcl/Tk-based text editor by akashakya on Wednesday November 21, 2018 @09:01AM (#18502691)
ah, that was a bad example for so many reasons. slightly better example

  foo_bar -> fooBar()
  baz_car -> bazCar()
  some_thing -> someThing()
An even better example is doing the reverse

  fooBar() -> foo_bar
  bazCar() -> baz_car
  someThing() -> some_thing
You can put cursors at every line and then use subword movement to find the word boundary.

> you still need some kind of regex to put the cursors at the right places, don't you?

I didn't say it replaces regex. You need regex just to place the cursors. you don't have to write complex regexp edit text (as shown in this example)

Re:TKE: Modern Tcl/Tk-based text editor by deviantfero on Wednesday November 21, 2018 @04:04AM (#18501206)
please correct me if I'm wrong, but wouldn't

:'<,'>s/_b/B/

work in this case?

Re:TKE: Modern Tcl/Tk-based text editor by fredsted on Wednesday November 21, 2018 @04:19AM (#18501271)
It might work if you want to fiddle with a regex for several minutes, so I'd prefer to just select a bunch of lines do the change directly
Re:TKE: Modern Tcl/Tk-based text editor by akashakya on Wednesday November 21, 2018 @05:22AM (#18501515)
With multiple cursors you are seeing the changes as you are editing. and you have all of the normal editing shortcuts at your disposal. Example, if you made a mistake while typing just hit undo.
Re:TKE: Modern Tcl/Tk-based text editor by bhaak on Wednesday November 21, 2018 @06:51AM (#18501982)
I would rather add the c option in cases where I'm not 100% sure what I'm doing.

So in this case :'<,'>s/_b/B/c

That let's you step through every change and if something's wrong you can press ESC and u to undo only the last change.

It depends on the actual problem of course, but multicursor edits also get unwieldy if you're editing more than 2 or 3 lines.

What about if the lines are beyond the visible screen?

Re:TKE: Modern Tcl/Tk-based text editor by akashakya on Wednesday November 21, 2018 @07:41AM (#18502221)
Yes, no silver bullet. But most of my use case I find a generic pattern so I don't check the individual edits. Anything more complex I'll switch to macros.

Btw, I meant undo like global undo which will let you undo the last keypress for all of the cursors. In your case, you meant undo for a particular instance of change I guess.

Also, let's say there is different character after _

  foo_bar -> fooBar
  baz_car -> bazCar
  some_thing -> someThing 
Maybe you can do this with regex. but for a new user, he has to look it up. With multiple-cursors, you don't even have to think about it.

However, you can use a macro.

Re:TKE: Modern Tcl/Tk-based text editor by jcelerier on Wednesday November 21, 2018 @04:47AM (#18501376)
it's more keystrokes (and more complicated ones) than just doing cursor editing, and you have to think of every replacements in advance while with the multi cursor if you have five others replacements to make in the same line you can just make them easily one after the other
Re:TKE: Modern Tcl/Tk-based text editor by DanGarthwaite on Wednesday November 21, 2018 @08:37AM (#18502533)
qqf_x~q Now you can @q to your heart's content.
Re:TKE: Modern Tcl/Tk-based text editor by Derbasti on Wednesday November 21, 2018 @06:47AM (#18501963)
Think of it as visual/poor man's macros.