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

9 points by themodelplumber 3 years ago

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.

timonoko 3 years ago

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.

  • timonoko 3 years ago

    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.

    • timonoko 3 years ago

      Ach. It depends on mode. In C-mode if you two-tab the "{" it selects the whole block.

pwg 3 years ago

The 'joe' editor in 'picture draw' mode does exactly what you describe.

https://joe-editor.sourceforge.io/

  • themodelplumber 3 years ago

    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?

    • pwg 3 years ago

      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.

      • themodelplumber 3 years ago

        Thanks, doesn't seem to work in xterm either unfortunately. I will have to look through the manual later.

        • pwg 3 years ago

          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.

smoldesu 3 years ago

Give Micro a try: https://micro-editor.github.io/

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

  • themodelplumber 3 years ago

    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...

johnmc408 3 years ago

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…

johng 3 years ago

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.

  • themodelplumber 3 years ago

    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, breeze (both really good) or one of the other MS-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...

    • johng 3 years ago

      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.....

I_complete_me 3 years ago

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

antoineMoPa 3 years ago

Open a file in emacs and do M-x artist-mode.

  • themodelplumber 3 years ago

    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.