2

To copy and paste a line i use the following method

C-a - beginning of line #save the line to kill-ring using kill-line(this is faster than marking, # move to end of line and C-w) C-k - kill-line C-/ - undo kill-line # move point to required line C-p or C-n or C-s (search for the nearest line where the paste must be done) C-y # paste the line 

Is there more efficent method than this. In vim just type yy, navigate and p does the job

3
  • This is more a SuperUser question. Commented Nov 25, 2014 at 14:23
  • With evil-mode, just use the default vim keybindings. wikemacs.org/index.php/Evil Commented Nov 25, 2014 at 15:04
  • @ceejayoz I would say it's more of an emacs.stackexchange question Commented Nov 25, 2014 at 15:12

2 Answers 2

2

Use kill-whole-line instead of C-aC-k. It's mapped to C-S-backspace by default.

Sign up to request clarification or add additional context in comments.

2 Comments

According to emacs -Q, kill-whole-line is defaultly bound to C-S-backspace
@MrBones: Thanks for confirmation.
0

With evil-mode, just use the default vim keybindings.http://wikemacs.org/index.php/Evil

Otherwise, M-w (kill-ring-save) saves the region. If we want to copy the current line if no region is selected:

(put 'kill-ring-save 'interactive-form '(interactive (if (use-region-p) (list (region-beginning) (region-end)) (list (line-beginning-position) (line-beginning-position 2))))) (put 'kill-region 'interactive-form '(interactive (if (use-region-p) (list (region-beginning) (region-end)) (list (line-beginning-position) (line-beginning-position 2))))) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.