News for hackers. Stuff that matters.

Ask HN: Is there an editor with insert mode and free cursor?

Looking for an editor (Linux) with insert/overwrite mode and free cursor movement, i.e. you can place cursor anywhere and start typing in any random column without having to pad lines with spaces first. This is kind of a nice feature from one of my Casio pocket organizers from the '90s. Thanks for any tips.
( 18 comments | 2 points | on HN )
Re:Ask HN: Is there an editor with insert mode and free cursor? by smoldesu on Tuesday November 22, 2022 @11:38PM (#33715253)
Give Micro a try: https://micro-editor.github.io/

It's insert-mode only but well-worth giving a whirl for faster edits.

Re:Ask HN: Is there an editor with insert mode and free cursor? by themodelplumber on Tuesday November 22, 2022 @11:44PM (#33715314)
I just tried it. You mean insert-mode only as in there's no free cursor movement without padding with spaces first, is that right? I can't seem to move the cursor around unless I'm in an already-typed-on position...
Re:Ask HN: Is there an editor with insert mode and free cursor? by pwg on Tuesday November 22, 2022 @11:37PM (#33715241)
The 'joe' editor in 'picture draw' mode does exactly what you describe.
Re:Ask HN: Is there an editor with insert mode and free cursor? by themodelplumber on Tuesday November 22, 2022 @11:43PM (#33715305)
Thanks, I just tried in 4.6 and it works with the arrow cursor keys, and ^T P is the shortcut. The mouse won't work for ad hoc cursor placement though, with -mouse on the command line. Do you know if there's a workaround?
Re:Ask HN: Is there an editor with insert mode and free cursor? by pwg on Tuesday November 22, 2022 @11:46PM (#33715327)
No, I don't, but 'mouse' support must also be supported by the terminal emulator you use. The joe manpage only mentions xterm, so try running it in an xterm to see if mouse support works.
Re:Ask HN: Is there an editor with insert mode and free cursor? by themodelplumber on Tuesday November 22, 2022 @11:49PM (#33715346)
Thanks, doesn't seem to work in xterm either unfortunately. I will have to look through the manual later.
Re:Ask HN: Is there an editor with insert mode and free cursor? by pwg on Wednesday November 23, 2022 @10:34AM (#33720444)
To get the mouse to move the cursor beyond line endings you also have to give the -floatmouse CLI option to joe.

It also seems that you do need to enter lines before the cursor will position below the end of the file (which for an empty file is at the top of the window).

Otherwise, for me, in an xterm, with -floatmouse and -mouse activated, cursor positioning via the mouse in an xterm works just fine.

If you already have text in the file, then just -mouse allows positioning on the existing text.

Re:Ask HN: Is there an editor with insert mode and free cursor? by johng on Tuesday November 22, 2022 @11:32PM (#33715197)
I believe the old DOS editor edit.com had this built in. If you went into insert mode.... actually.

I think even notepad has it actually, in insert mode. I can't imagine that Linux doesn't have something similar.

Re:Ask HN: Is there an editor with insert mode and free cursor? by themodelplumber on Tuesday November 22, 2022 @11:40PM (#33715278)
That's odd, I just tried Notepad.exe in Wine and couldn't get Insert/Overwrite mode to work at all. Notepad++ has that mode, and it worked, but I can't find a way to use free cursor placement with it. LMK if you know fixes/workarounds for these.

You reminded me, I think pedit or one of the old DOS editors I used earlier this year had that now that you mention it. But better desktop integration would be needed in this case anyway...

Re:Ask HN: Is there an editor with insert mode and free cursor? by johng on Tuesday November 22, 2022 @11:42PM (#33715292)
I haven't needed it in so long but I remember doing ANSI and ASCII artwork in many of the editors and believe they had it too :) Ahhh, memories. ACiDDraw for example.....
Re:Ask HN: Is there an editor with insert mode and free cursor? by antoineMoPa on Tuesday November 22, 2022 @11:46PM (#33715324)
Open a file in emacs and do M-x artist-mode.
Re:Ask HN: Is there an editor with insert mode and free cursor? by themodelplumber on Tuesday November 22, 2022 @11:52PM (#33715360)
It's putting periods/dots all over my text file wherever I click. xD Not looking to start off with artistry right out the gate, will have to look at the manual, thanks for the tip for sure.
Re:Ask HN: Is there an editor with insert mode and free cursor? by johnmc408 on Wednesday November 23, 2022 @01:29AM (#33715910)
There is a setting to use vi this way (sorry not at computer), but I think it is ‘virtualedit’. I use it myself! I wish vscode would add it…
Re:Ask HN: Is there an editor with insert mode and free cursor? by timonoko on Wednesday November 23, 2022 @02:01AM (#33716065)
Yes. It is called 'emacs', but you need to add (xterm-mouse-mode 1) to ~/.emacs.

Then it is almost amazing, because in a phone (and termux) your fingers are the mouse.

You can do scrolls with youres fingeries too, if you add

    (global-set-key (kbd "<mouse-5>") 'scroll-up-command) 
    (global-set-key (kbd "<mouse-4>") 'scroll-down-command)
Somebody should study howto turn long finger press into emacs cut/paste. Now it is regular Android cut/paste, which is little cumbersome.
Re:Ask HN: Is there an editor with insert mode and free cursor? by timonoko on Wednesday November 23, 2022 @02:36AM (#33716279)
Rapid two presses seems to do something, it is "set-mark" and "select-word" or "select-line" depending where your fat fingers happen to land.
Re:Ask HN: Is there an editor with insert mode and free cursor? by timonoko on Wednesday November 23, 2022 @03:04AM (#33716435)
Ach. It depends on mode. In C-mode if you two-tab the "{" it selects the whole block.
Re:Ask HN: Is there an editor with insert mode and free cursor? by 8bitsrule on Wednesday November 23, 2022 @02:25AM (#33716209)
If I understand what you mean, Kate might fit the bill.

https://apps.kde.org/kate/

Re:Ask HN: Is there an editor with insert mode and free cursor? by I_complete_me on Wednesday November 23, 2022 @07:50AM (#33718537)
If I understand you correctly this can be done in vim with:

    set virtualedit=all 
which allows cursor to be moved anywhere in normal mode