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

Talespin_Kit
  • 20,830
  • 29
  • 89
  • 135

2 Answers2

2

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

choroba
  • 231,213
  • 25
  • 204
  • 289
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)))))
Ehvince
  • 17,274
  • 7
  • 58
  • 79