paste behaviour, cursor position

21 views
Skip to first unread message

John Gabriele

unread,
Jul 1, 2022, 2:09:29 PM7/1/22
to niceeditor

Hi all,

I see that ne has a rather unique behaviour when pasting text. When I paste, the cursor stays in the same location I started, rather than moving to the end of what I just pasted.

In what situations do you find ne's paste behaviour superior to the alternative (that is, moving the cursor to the end of the pasted content)?

I'd like paste to leave my cursor after the pasted content. Is there a configuration option, or preference, to get ne to do that? Incidentally, this would make paste similar to how autocomplete works (leaving my cursor after the autocompletion).

Thanks!
-- John

Aleksa Petrovic

unread,
Jul 2, 2022, 6:49:41 AM7/2/22
to niceeditor
Hi. Maybe it is useful if you want to paste something in front of multiple lines, so you just paste and then move down and paste again, but this is rare. I usually first make a space, then paste, then jump words to the right. I tested and saw that we could not make a macro that does sbm -, then pastes then does gbm -, so I am not sure what to do to set a bm and jump to it after paste, probably not possible.

John Gabriele

unread,
Jul 2, 2022, 12:08:43 PM7/2/22
to niceeditor
Aleksa, interesting idea. Thanks.

John Gabriele

unread,
Jul 2, 2022, 12:30:25 PM7/2/22
to niceeditor
Created a github issue for this.

Aleksa Petrovic

unread,
Sep 26, 2022, 3:16:23 PM9/26/22
to niceeditor
I have this macro to place the cursor after the pasted text, but it only works for when you have only one line to paste, not more:
au +
ai 0
il
ml
t DISPLAY=:0 xclip -o
eol
mr
is " "
ml
bs
mr
ai 1
au -
sys tmux send c-l
it would be very good if we could save the position of the cursor somehow, the position at which it is after pasting, the end of paste, not the beginning.

todd_...@unc.edu

unread,
Sep 26, 2022, 4:02:02 PM9/26/22
to niceeditor
We are in the process of putting together a new release, so this feature is not yet available in distribution packages (probably). However, the current master branch of the repo on github - https://github.com/vigna/ne/ - has new parameters for the GotoBookMark command: "GotoBookMark <" and "GotoBookMark >" respectively will move the cursor to the beginning and end of the most recent Paste. Like other bookmarks, "<" and ">" persist after other edits, even if you Undo, delete the text containing them, or just about anything else besides another Paste, PasteVert, or an explicit UnsetBookMark. That should make it much easier to do what you're trying to accomplish above.

By the way, while I encourage the use of command abbreviations at the command line, for macros – especially when sharing – I'd recommend using long names. The docs say long command names slow down command parsing, and technically that's correct, but unless you're playing a macro a zillion times you'd be hard pressed to notice a difference. Humans reading macros are slowed down much more by the short names. I had to scratch my head a bit on a few of those in your post, and I wrote some of those commands!

Aleksa Petrovic

unread,
Sep 26, 2022, 5:35:42 PM9/26/22
to niceeditor
Thank you for explaining, I will write full command names in the future and now I will clone the master branch to test this and what else is new.

John Gabriele

unread,
Sep 26, 2022, 10:34:04 PM9/26/22
to niceeditor
Looking forward to this! Thanks so much!
Reply all
Reply to author
Forward
0 new messages