News for hackers. Stuff that matters.
Re:Slap – A Sublime-like terminal-based text editor by techwizrd on Sunday May 28, 2017 @10:40AM (#14434515)
Every one of the listed features is also available in Vim. I fail to see how this is either Sublime-like besides the keybindings (since a file pane is available on both Emacs and Vim) or will cause me to leave Vim or Emacs behind. That said, I can definitely see this replacing Nano for some folks.
Re:Slap – A Sublime-like terminal-based text editor by captainmuon on Sunday May 28, 2017 @12:47PM (#14435109)
I think the benefit is exactly the keybindings. And the fact that it is non-modal. It works like a text field in a desktop GUI, there is almost no state. You can't mess the state up. Contrast it to vim, where I got into the habbit of bashing ESC three times to be sure I'm not in a mode. Or emacs, which is nice until it's abstractions leak, and you accidentially start editing a configurations pane or something.

I am a part time vim user, and generally like it, but sometimes I find the mental load of the key bindings too high. Anything more complex than d<End>, and I have to stop a moment and think about it. In that time, I can just hit the cursor keys (and Home, PgDn, ...) a couple of times.

It's a trade-off: Do I use a bit of mental power, and save some finger movement? Then I go for the vi way. Or do I use less mental power, and delegate tasks to my fingers and eyes to do autonomically? Then I go for the sublime / notepad / VS way. I might press the arrow key a couple of times, overshoot, go back, ... it may look inefficient, but it's not slower, just a different use of resources.

I've been looking for a Sublime style editor for the terminal for ages. Actually, way before sublime, I've been looking for an edit.com style editor - Nano is one thing, but I want one that respects CUI-like conventions. Shift for selecting, CTRL+C for copy, .... I will definitely check this out.

Re:Slap – A Sublime-like terminal-based text editor by dozzie on Sunday May 28, 2017 @01:22PM (#14435258)
> It's a trade-off: Do I use a bit of mental power, and save some finger movement?

hammerandtongs already suggested this: it's not a trade-off, you just didn't get to learn Vim appropriately (you say yourself that you're "part time vim user"). Vim is so convenient for its regular users not because it saves them keystrokes, but because it saves them this mental power you talk about. I don't think what commands I want to execute. I think where I want to get in the file or what should the text look like, and then the logic behind the structure of vi/Vim commands takes me there.

It's very similar to proficiency in any other editor, except Vim has so much more to offer with regard to editing (both in first-order commands and in composing the commands). So much more that watching how a proficient Vim user edits a file is akin to observing a stage magician. Most of the people cannot keep up with the changes to the text.

Re:Slap – A Sublime-like terminal-based text editor by hashhar on Sunday May 28, 2017 @05:14PM (#14436112)
Macros are the best part of vim for me. They allow me to transform large quantities of text which would be difficult to do using a regular expression even. Also, after enough use (I'd say 4 weeks in my case) a lot of the commands become muscle memory and I don't have to think about what I'm hitting. I think about a goal and know what to do to get there.
Re:Slap – A Sublime-like terminal-based text editor by ice109 on Sunday May 28, 2017 @01:33PM (#14435297)
>I don't think what commands I want to execute. I think where I want to get in the file or what should the text look like, and then the logic behind the structure of vi/Vim commands takes me there.

this is gibberish unless vim comes with some sort of spinal cord dongle. either it's muscle memory or thinking but you still have to have practiced the keystrokes.

Re:Slap – A Sublime-like terminal-based text editor by antoinealb on Sunday May 28, 2017 @01:45PM (#14435342)
Muscle memory is not using some brain power as the GP says. Once you are used to it (2-3 weeks), it feels very natural, I think "Oh I need to change the end of this sentence" and my fingers will take me there. It really is an extension of touch typing.
Re:Slap – A Sublime-like terminal-based text editor by pweissbrod on Sunday May 28, 2017 @03:59PM (#14435845)
Gee I got to the point of feeling natural after 2-3 months...
Re:Slap – A Sublime-like terminal-based text editor by savanaly on Sunday May 28, 2017 @08:04PM (#14436663)
He's describing how it feels to be a good vim user, not how it works in reality. A great tennis player might say "I don't think about how to hit the ball, I just think about where I want it to go and it goes there", and that would be reasonable. Then you come in and say no that's gibberish, unless he has a spinal cord dongle hooked up to a robot that hits it for him, he has to be thinking about doing the actions, they're not automatic after all!
Re:Slap – A Sublime-like terminal-based text editor by type0 on Monday May 29, 2017 @03:04AM (#14437823)
> unless vim comes with some sort of spinal cord dongle

cerebellum is largely responsible for your muscle memory but premotor cortex stll needs to initialize those commands (what keys to press) then the cerebellum adjusts the precision i.e touch-typing part of it guess...

Re:Slap – A Sublime-like terminal-based text editor by OJFord on Sunday May 28, 2017 @08:06PM (#14436676)
Do you think about each key you want to press to type a sentence?

I expect not. Vim, for those that use it, is merely an extension of that.

Re:Slap – A Sublime-like terminal-based text editor by atomi on Sunday May 28, 2017 @02:03PM (#14435408)
Saves mental power? These regular vim users must be some kind of super humans to autopilot some of these incantations.

http://deliberate-software.com/vim-refactoring-patterns/

Re:Slap – A Sublime-like terminal-based text editor by dozzie on Sunday May 28, 2017 @02:10PM (#14435437)
Which ones? All I see is just a handful of distinct commands. Those commands take arguments, and they are called with those arguments over and over again, but there's very little magic in the article. And, in fact, very little of the commands available to and regularly used by Vim user were shown. (And I think this was the point of the article.)

It's like you were arguing that printf("foo\n") and printf("bar\n") were some fundamentally different magic incantations in C that you need to remember separately.

Re:Slap – A Sublime-like terminal-based text editor by atomi on Monday May 29, 2017 @03:37PM (#14440980)
That's right. You've made a great point. Learning vim is like learning a new language. Which isn't trivial for most people as exemplified by software like nano and the new micro.
Re:Slap – A Sublime-like terminal-based text editor by metaobject on Sunday May 28, 2017 @02:10PM (#14435442)
"Or emacs, which is nice until it's abstractions leak, and you accidentially start editing a configurations pane or something."

I've been using emacs for decades and I don't think I've never done this. I've written my own elisp functions, packages etc (nothing too fancy, mostly text-oriented transformations) I guess I'm curious what you mean by 'editing a configuration panel'.

Re:Slap – A Sublime-like terminal-based text editor by yamaneko on Sunday May 28, 2017 @07:36PM (#14436577)
About vim and the mental load, even though one of its great features is its precision, sometimes we should pour a bit of sloppiness into it. And as vim users, we shouldn't feel ashamed. This user puts it in a great way: https://news.ycombinator.com/item?id=12645523
Re:Slap – A Sublime-like terminal-based text editor by hammerandtongs on Sunday May 28, 2017 @12:57PM (#14435164)
Why would you leave yourself in this low practiced state?

Ie you don't spend the time to become fluent, so it's always "thinking" instead of being able to just do.

Incidentally you should always always leave the insert mode when you are done typing.

You are never confused about state because your default is "normal mode".

Re:Slap – A Sublime-like terminal-based text editor by horsawlarway on Sunday May 28, 2017 @01:08PM (#14435207)
Because becoming fluent has a cost value trade off, and I think there are a lot of people who simply don't think time invested in that is worth it.

I touch a terminal a lot, and I don't value vim enough to become fluent. I certainly know how to use it, and I know a fair bit of the commands, but it's nowhere close to my preferred workflow.

Plus, there's a huge array of tools out there to allow me to work with files in the editor of my choice, even when working on remote machines.

Finally, I grew up playing video games and using a computer, complete with modern input. The mouse is a first class input device, and I know how to use it effectively, quickly, and precisely to perform a wide variety of actions. I prefer an editor that treats the mouse like it's useful, rather than an add on that you can enable with extensions if desired.

Re:Slap – A Sublime-like terminal-based text editor by btschaegg on Sunday May 28, 2017 @04:21PM (#14435932)
> Finally, I grew up playing video games and using a computer, complete with modern input.

Funny you bring this up, since this reminds me of another discussion: I played a lot of videogames using keyboard and mouse, whereas some of my friends still own consoles and play (more or less) precision-based shooters using gamepads. Every now and then we used to have a couple of multiplayer matches locally on someone's PS. I still tend to skip my turns and just watch the others as gamepad based aiming in shooters tends to get me really frustrated. I'm used to the mouse and forcefully having removed the additional speed and precision it gives you while aiming feels terrible. I get the same feeling if I have to use an editor without Vim-style bindings, although I'm by no means an expert Vim user.

The interesting thing there is that you won't ever find a precision-based first person shooter with crossplay between PC and consoles, because the mouse gives PC players that much of an advantage.

> The mouse is a first class input device, and I know how to use it effectively, quickly, and precisely to perform a wide variety of actions.

I agree with you there, but so far I've come to the conclusion that it's strengths don't really show if you mainly edit text. The mouse is amazing for precision-based positioning, much like an analog stick can be superior to WASD because it's not limited to 8 axes and has more than just an on/off nature.

I find your other point far more important, though:

> I don't value vim enough to become fluent.

If you're not paid for the speed with which you edit text (and those jobs have become really rare nowadays), that's perfectly valid. Not everyone is interested in investing so much in a fringe activity, and we certainly would get far less done collectively if every tool would force a Vim-style learning curve on people.

Re:Slap – A Sublime-like terminal-based text editor by flukus on Sunday May 28, 2017 @11:07PM (#14437161)
> I still tend to skip my turns and just watch the others as gamepad based aiming in shooters tends to get me really frustrated.

This is why I liked the controls in goldeneye, perfect dark and timesplitters. They had consoles in mind from the ground up so the embraced the lack of precision controls with things like auto aiming and level design (mostly flat). Every other console shooter (including all since Halo) has tried to use controllers as though they're a keyboard/mouse.

The control scheme was also modal, where you'd have to hold down a button and not move if you wanted precision aiming.

Re:Slap – A Sublime-like terminal-based text editor by serf on Sunday May 28, 2017 @02:16PM (#14435457)
>Finally, I grew up playing video games and using a computer, complete with modern input. The mouse is a first class input device, and I know how to use it effectively, quickly, and precisely to perform a wide variety of actions. I prefer an editor that treats the mouse like it's useful, rather than an add on that you can enable with extensions if desired.

Go figure.

Roguelikes, UT, Doom, Quake , and the like from my past pushed me more than anything into learning and loving emacs keyboard bindings.

No other way to experience that sort of speed-of-thought and precision in a UI/UX for me, and certain actions within emacs very much remind me of muscle-twitch maneuvers like rocket-jumping, bunnyhopping, or reload-canceling.

Re:Slap – A Sublime-like terminal-based text editor by lelandbatey on Sunday May 28, 2017 @01:19PM (#14435246)
I can see where you're coming from when it comes to comfort with the mouse, though I don't think you should emphasize it too much if you've never experienced some kind of "never leave the keyboard" system that you're fluent in. It may or may not be faster than a mouse, but it's faaaaar more precise and for me feels very satisfying in a tactile sense.

Though in my experience, once you go all in, you start trying to get it to work on everything; in my case that means vim keybindings for everything, including web browser, and it can be a bit jarring to give it up when you use someone else's computer.

Re:Slap – A Sublime-like terminal-based text editor by simondedalus on Sunday May 28, 2017 @01:36PM (#14435313)
yeah, i recently downloaded intellij idea for the first time (i generally eschew IDEs) to try my hand at kotlin, and when the "use vim keybindings? " option popped up during setup i was like "(very satisfied and refreshed) ahhhh..." works well too for a slim .vimrc user like myself.
Re:Slap – A Sublime-like terminal-based text editor by xrisk on Sunday May 28, 2017 @03:21PM (#14435695)
Growing up playing RTSes, I always found the keyboard to be indispensable ;)
Re:Slap – A Sublime-like terminal-based text editor by ams6110 on Sunday May 28, 2017 @05:59PM (#14436257)
I'm always confused as a 30 year emacs user, in which "Normal mode" is insert mode as it is in every other text editor/word processor. Vi[m] is backwards in comparison and while clearly it's possible to learn it to the point it makes sense, I think for people who use it only occasionally it's very awkward.
Re:Slap – A Sublime-like terminal-based text editor by Asooka on Sunday May 28, 2017 @04:00PM (#14435850)
I had a rather long argument with someone who can't stand vim and his points were mostly salient. Vim comes with a lot of baggage (or features, depending on how you look at it) from having been designed before Windows and the assorted userland became the dominant platform. Because of that, its shortcuts aren't CUA-compliant [1]. And that is just scratching the surface. Vim and Emacs are written by people who expect them to behave like Vim and Emacs, not like Sublime or any other "standard" application with a "standard" interface and shortcuts. You can definitely fight their design and rebind your keys to work as you expect, but through it all you're fighting decades of entrenched design. Those editors aren't maintained by people who think like you, so you'll always be a second citizen. Micro isn't for people who like Vim, micro is for people who want their editor to work in the expected mainstream fashion.

I think GNU nano should probably also have a commandline switch to behave like a normal CUA-compliant editor and distros should have that enabled by default. It isn't compatible with anything but pico and someone who grew up with today's machines would have never seen pico.

[1] https://en.wikipedia.org/wiki/IBM_Common_User_Access

Re:Slap – A Sublime-like terminal-based text editor by btschaegg on Sunday May 28, 2017 @04:38PM (#14435989)
On the other hand, I would guess it's not just the maintainers being entrenched: If you were to redefine something like C-v to perform "+p by default, you would upset every guy that has been using Vim for some time. Not only that, but you would also really ruin the day for everyone that regularly uses it through SSH and counts on Vim's default behavior. I would guess the reactions would be orders of magnitude more vile than those to, say, systemd.

So, leaving such rebindings as opt-in possibilities to newcomers seems like a much more sane decision to me.

Re:Slap – A Sublime-like terminal-based text editor by RBerenguel on Sunday May 28, 2017 @11:22AM (#14434708)
Whenever I need nano I'm on a machine where installing stuff is cumbersome, so installing npm on top of it would be overkill. Better learn to use vim (I'm personally an emacs person, but with vim keybindings) and use it when needed.
Re:Slap – A Sublime-like terminal-based text editor by gbersac on Sunday May 28, 2017 @11:55AM (#14434842)
> copying/pasting with OS clipboard support

It is supposed to be in vim, but I always forget how to use it and the few time I tried it just didn't work.

Re:Slap – A Sublime-like terminal-based text editor by e12e on Sunday May 28, 2017 @12:09PM (#14434895)
"+y / "+p

Is generally what you want (named buffer +).

http://vim.wikia.com/wiki/Accessing_the_system_clipboard

I used to keep forgetting too, and then I started using it a bit (on Windows, where selecting text and shift-insert doesn't work).

Re:Slap – A Sublime-like terminal-based text editor by dmd on Sunday May 28, 2017 @12:18PM (#14434943)
Or just make it the default:

set clipboard=unnamedplus

Re:Slap – A Sublime-like terminal-based text editor by hashhar on Sunday May 28, 2017 @05:18PM (#14436126)
Wow, in all my 5 months on Vim usage I didn't learn about this. Gonna go :help clipboard now. Thanks.
Re:Slap – A Sublime-like terminal-based text editor by dmd on Sunday May 28, 2017 @10:00PM (#14436992)
Don't feel bad... 25 years vi usage here!
Re:Slap – A Sublime-like terminal-based text editor by hk__2 on Sunday May 28, 2017 @12:18PM (#14434940)
In insert mode you can paste with cmd+V on macOS or ctrl+shift+v on other systems, just like anywhere else in the shell.
Re:Slap – A Sublime-like terminal-based text editor by iaml on Sunday May 28, 2017 @11:15AM (#14434682)
You can control vim with mouse? Huh, TIL.
Re:Slap – A Sublime-like terminal-based text editor by hjek on Sunday May 28, 2017 @11:23AM (#14434713)
If you enable it in .vimrc:

    set mouse=a
Re:Slap – A Sublime-like terminal-based text editor by coldtea on Sunday May 28, 2017 @11:58AM (#14434849)
Parent means "control", not "select text".
Re:Slap – A Sublime-like terminal-based text editor by fredoliveira on Sunday May 28, 2017 @04:56PM (#14436052)
And that's exactly what `set mouse=a` allows. You can switch tabs, resize panes, etc.
Re:Slap – A Sublime-like terminal-based text editor by rayiner on Sunday May 28, 2017 @12:07PM (#14434888)
You can even control vim with a mouse when its running on a headless machine you're accessing over ssh.
Re:Slap – A Sublime-like terminal-based text editor by equalunique on Sunday May 28, 2017 @11:21AM (#14434706)
Yes. In vim:

set mouse=a

Re:Slap – A Sublime-like terminal-based text editor by gatlinnewhouse on Sunday May 28, 2017 @11:20AM (#14434699)
What plugins are these?
Re:Slap – A Sublime-like terminal-based text editor by Tenobrus on Sunday May 28, 2017 @11:24AM (#14434719)
Both Vim and Emacs have had mouse support built in for decades.
Re:Slap – A Sublime-like terminal-based text editor by amiga-workbench on Sunday May 28, 2017 @03:12PM (#14435657)
The difference is its all there out of the box without mincing with a config file or numerous extensions.