Because `C-a C-SPC C-e M-w` just doesn't cut it, and I like playing piano, I decided to dig the web for a few helpers. I'm quite fond of the keybindings right now, let's see if they stick.
(defun duplicate-line ()
"copy the current line underneath"
(interactive)
(move-beginning-of-line 1)
(kill-line)
(yank)
(open-line 1)
(next-line 1)
(yank)
(move-beginning-of-line 1)
(message "TODO: restore caret position?, on original or new line?"))
(defun select-current-line ()
"Select the current line"
(interactive)
;; (end-of-line) ; move to end of line
;; (set-mark (line-beginning-position))
(beginning-of-line)
(set-mark (line-end-position))
(message "TODO: select from begin to end or end to begin ? (caret > [begin..end]/2 => beg to end. end to beg otherwise)"))
(global-set-key (kbd "C-S-d") 'duplicate-line)
(global-set-key (kbd "C-S-l") 'select-current-line)
Aucun commentaire:
Enregistrer un commentaire