xahlee / xah-fly-keys

the most efficient keybinding for emacs
http://xahlee.info/emacs/misc/xah-fly-keys.html
472 stars 80 forks source link

Missing newline at xah-copy-line-or-region #52

Closed nlw0 closed 5 years ago

nlw0 commented 5 years ago

Commands such as xah-copy-line-or-region do not include de the newline in the copied text. Is this an intentional feature, or would you take a patch for a different version?

I suppose I'm used to the e.g. vim behavior, where you can just 'y' 'y' and 'p' the line around. Otherwise, what do you do, 'c' 's' every time you want to paste your line?

xahlee commented 5 years ago

it used to include newline for a few years while in ergoemacs mode. but then people complained. i guess there's no optimal choice.

e.g. one problem with including newline is when pasting to terminal.

but anyway, if you c twice, it'll copy line below. Not exactly answering the issue, but perhaps related.

nlw0 commented 5 years ago

How could I get this old behavior back for myself? I suppose I can find the old code in the ergomacs git?... Then I can just define it in my config and (define-key xah-fly-key-map (kbd "x") cut-with-newline)? Sorry for the basic questions, I'm still an emacslisp newbie!

xahlee commented 5 years ago

most simple solution is just to modify xah-copy-line-or-region. or, copy the modified code, and put in your init, after loading xah-fly-keys.

the last 3 lines should look like this

(kill-append "\n" nil) (end-of-line) (forward-char)

i haven't tried, but should work.

nlw0 commented 5 years ago

Great, thanks a lot for the info! I think I'll give a try to the way it currently works, but it's great to know how to change.