I wonder if there is a command to copy a character or word above the cursor and paste it at the current position?
Example:
sig1 : in std_logic; sig2 : in std_logic; sig3 : ^
Consider the situation above, and my cursor is in position ^ , I would like to duplicate in std_logic; and paste it in the current position. The way I know may work:
1. Move cursor up 2. Go into visual mode and highlight 3. Yank 4. Move cursor down 5. Paste
Is there an easier way to do this? Or am I left with the only option of writing a mapping in vimrc that does the whole sequence for me?
Edit: I found a mapping on the web:
imap <F1> @<Esc>kyWjPA<BS> nmap <F1> @<Esc>kyWjPA<BS> imap <F2> @<Esc>kvyjPA<BS> nmap <F2> @<Esc>kvyjPA<BS>
but it seems that the Greg solution is easier!
source share