News for hackers. Stuff that matters.
Re:How I Switched to Plan 9 by xixixao on Wednesday December 04, 2019 @11:40PM (#21710037)
The sam editor is interesting. I use iterm and tmux over mosh, has anyone figured out a simple text editor that supports cursor based cut and paste? I really just want a notepad-like editor, for the rare cases I’m not using Sublime/Atom/VSCode for a remote. Come to think of it, I also want cursor based cut and paste on the command line, and don’t understand why that’s not the default in 2019, and we’re all pretending that we have a physical tele-typewriter.
Re:How I Switched to Plan 9 by dTal on Thursday December 05, 2019 @03:06AM (#21710697)
Because compatibility. All the existing text programs assume the physical tele-typewriter emulator. There have been many attempts to modernize the essential parts of the text console experience and do away with the inessential parts, but they always fail to catch on because people expect to be able to run programs like 'top' and 'ls -la' and 'pstree', which expect to format their output on a handy fixed width character grid. And you can't easily patch mouse selection into the existing system because there is too much seperation between the terminal and the content - the terminal is not aware of the intended text formatting, and the program is not aware of where you clicked. Fixing this would also require patching the world.

If you want to live in the future, you can't use programs written in the past. There are many fine GUI text editors: leafpad is your basic bare-bones notepad-alike, and for my money Kate is the best 'notepad++' mega-text-editor that's still light enough to start instantly.

Re:How I Switched to Plan 9 by shakna on Thursday December 05, 2019 @07:45AM (#21711837)
> And you can't easily patch mouse selection into the existing system because there is too much seperation between the terminal and the content - the terminal is not aware of the intended text formatting, and the program is not aware of where you clicked.

I'm sorry, but this is plain wrong.

gpm [0] supplies a mouse server for the console, and has been around for a very long time (the oldest release I could find was 1995). SSH, nano, vim and more all understand the events driven by it. This should even work under a raw tty, rather than a terminal emulator, in any shell, from ash to zsh.

The terminal absolutely understands the mouse, you just need to enable the bridge that lets it all work.

[0] https://linux.die.net/man/8/gpm

Re:How I Switched to Plan 9 by hollerith on Thursday December 05, 2019 @01:51PM (#21715074)
Does GPM let you move the insertion point in nano or vim? It didn't when I last used it 12 or 13 years ago. All it let me do was select a region of text from the screen plus the scrollback buffer of the linux console. Then I could choose to copy that region. And IIRC, the copy had a newline wherever the text being displayed had a newline and where one line of the linux console ended and the next line began, so if what I was copying had any lines that ran longer than the screen width, I'd have to manually remove the second type of newlines after pasting.

And when the user selected text using GPM, the program (e.g., nano) never learned of it: it was local to GPM and the linux console.

The man page you linked states, "The selection mechanism is disabled if the controlling virtual console is placed in graphics mode, for example when running X11, and is re-enabled when text mode is resumed," (then goes on the describe how sometimes it does not get re-enabled because of a bug).

Can a modern PC even be put into text mode anymore? (Honest question: I do not know.)

Have you ever gotten GPM to work with X11 or Wayland?

Re:How I Switched to Plan 9 by shakna on Thursday December 05, 2019 @05:32PM (#21717410)
> Does GPM let you move the insertion point in nano or vim?

If you enable mouse support. (set mouse for nano and set mouse=a in vim).

> Have you ever gotten GPM to work with X11 or Wayland?

That'd be rather... Pointless. X11 and Wayland already allow the mouse to work without GPM. Just enable the mouse in nano, vim or whatever, and it'll work.

Re:How I Switched to Plan 9 by hollerith on Thursday December 05, 2019 @05:49PM (#21717552)
Whatever terminal-emulation app (e.g., Gnome Terminal) you are using will allow you to select text in the app's window, but nano or vim will never know about it. I.e., the user's mouse gestures are never transmitted to the program (e.g., nano) on the other side of the pseudo-TTY (PTY).

So for example, the user cannot use the mouse to move the insertion point in nano.

Re:How I Switched to Plan 9 by shakna on Thursday December 05, 2019 @06:54PM (#21717988)
> So for example, the user cannot use the mouse to move the insertion point in nano.

That is not the case if you enable mouse support, as I've said.

Try it. Add:

    set mouse
To ~/.nanorc

Open a file, and click. The insertion point will move.

Re:How I Switched to Plan 9 by hollerith on Thursday December 05, 2019 @07:16PM (#21718152)
Oh, OK. Good to know. Thanks for your reply. vim, too?
Re:How I Switched to Plan 9 by shakna on Thursday December 05, 2019 @07:19PM (#21718172)
The vim command needed to enable support is:

    set mouse=a
But yes, it works basically the same.
Re:How I Switched to Plan 9 by bmn__ on Thursday December 05, 2019 @05:04AM (#21711179)
> the program is not aware of where you clicked. Fixing this would also require patching the world.

No, that exists for a long time and is widely implemented among terminal software. Demo: https://github.com/tinmarino/mouse_xterm

Re:How I Switched to Plan 9 by andrewshadura on Thursday December 05, 2019 @10:45AM (#21713251)
Leafpad hasn't been maintained in the last decade or so, is buggy and based on GTK 2. Please don't recommend it to anyone. Gedit is much more sensible as a replacement.
Re:How I Switched to Plan 9 by jleahy on Thursday December 05, 2019 @12:22PM (#21714141)
Mousepad is also pretty good and is actively maintained.
Re:How I Switched to Plan 9 by shakna on Thursday December 05, 2019 @01:27AM (#21710372)
Nano, the simple editor every one loves to rag on for being overly simple, does actually support cursor cut n paste. (Hold shift and move the cursor. Then cut or paste.)

    set mouse
    set nowrap
    set softwrap
With those three lines in ~/.nanorc, it now allows you to click n drag the mouse, and may work over ssh, depending on your terminal support, and wraps lines without inserting actual breaks.

It effectively is Notepad, as far as I'm concerned.

Re:How I Switched to Plan 9 by iteratorloopmap on Thursday December 05, 2019 @09:02AM (#21712302)
nano isn't very weak, I have modified nanorc substantially and also have binded many keys. It works better than, say, notepad++ on windows.

For those who aren't touch typists, or occasional users, nano is just more comfort than vim or emacs.

And there is a editor named `micro`, which is similar to nano but has more features including bracket completion etc.. I am delaying switch because it is written in go (being unavailable in repos) and anyway I haven't found time to configure it. But it is scriptable in lua..

Re:How I Switched to Plan 9 by npmn2 on Wednesday December 04, 2019 @11:53PM (#21710081)
Try using vscode remote over ssh, it connects to the machine over ssh and the experience is mostly seamless. Highly recommended.
Re:How I Switched to Plan 9 by bityard on Thursday December 05, 2019 @12:02AM (#21710115)
Last I checked, it does far more than just connect to the machine over SSH. It pushes up a nodejs executable and then also pulls down other stuff from the web. And it will also leave an agent running on the host you ssh into, even after you exit vscode.

I can see this being okayish when logging into a dev EC2 instance or something ephemeral but it's not something I would ever want to do on something important.

Re:How I Switched to Plan 9 by dexen on Thursday December 05, 2019 @12:02AM (#21710116)
Plan 9's Acme (a GUI editor similar to sam) is just fine when ran over LAN - no felt lag at all. Not sure how well it handles modern-day internet, but quite possibly would be practical.

And yes, it uses mouse-based select/cut/copy/paste, with line- and block- level operations.

Re:How I Switched to Plan 9 by pjmlp on Thursday December 05, 2019 @03:15AM (#21710735)
It is based on how the whole Oberon OS UI works, which took its idea from Xerox PARC Workstations OSes.

Basically on those systems you can expose code as UI callable operations, select code and give it to them.

Re:How I Switched to Plan 9 by tyingq on Thursday December 05, 2019 @12:00AM (#21710107)
There's a clone of notepad++ that works on Linux, called notepadqq.

https://notepadqq.com/wp/

Re:How I Switched to Plan 9 by skykooler on Thursday December 05, 2019 @12:16AM (#21710165)
While it may or may not be a "simple" text editor, Vim supports cursor based cut and paste with the appropriate settings in .vimrc (I forget off the top of my head, it's something along the lines of "set mouse=a" to enable the mouse and then "set clipboard=unnamedplus" to make it interface with the system clipboard.)
Re:How I Switched to Plan 9 by Reelin on Thursday December 05, 2019 @02:31AM (#21710593)
Assuming a mainstream terminal emulator, [CTRL] + [SHIFT] + [C/V] works well enough most of the time. Copying that way does break if you tile though.
Re:How I Switched to Plan 9 by dmead on Thursday December 05, 2019 @03:12AM (#21710722)
why do you think its a good idea to keep touching the mouse? it's not about emulating a teletype machine. it's about not picking up your (probably right) hand and moving it to the mouse constantly. this is something the teletypewriters of the past never had to deal with. I guess you don't yet have RSI?
Re:How I Switched to Plan 9 by xixixao on Thursday December 05, 2019 @12:14PM (#21714072)
For example pasting a piece of code in the middle of a typed line is more convenient with a “mouse” driven cursor.

I use a Macbook as my keyboard/trackpad combo, so my “mouse” is actually extremely close to the keyboard, and I don’t have to move my hand much.

Re:How I Switched to Plan 9 by that_jojo on Thursday December 05, 2019 @12:43PM (#21714367)
It's about familiarity.

Learn those cursor movement keys combos and you'll find it ends up being way faster to get to the middle of your line to drop your ctrl-v that way once you're used to it.

Not that I mean to rag on you in a superior way like so many keyboard-only primadonnas like to. You do you, and I understand that for a lot of people the investment in learning this non-critical stuff just isn't worth the time.

Re:How I Switched to Plan 9 by mixmastamyk on Thursday December 05, 2019 @02:04AM (#21710513)
Micro and geany are good CUA options.
Re:How I Switched to Plan 9 by iteratorloopmap on Thursday December 05, 2019 @09:04AM (#21712316)
I think `micro` will do.. not sure about cursor based cut-paste though..