1

We can copy line with yy and paste it using p commands. I have seen that it is possible to move cursor to empty line, press some button and it pastes content of above line until button is released. Who can share that key combination?

I don't want to paste one line multiple times. I need to paste part of it once. It should start pasting the beginning of line while button is pressed. Alternative solution will be to copy part of it and paste in next line.

Example:

First lineeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Move cursor under first line. It is empty. Press and keep some key. It starts to slowly paste content of first line until you release that button. I have seen it many times and was thinking that is quite known tip.

Ashot
  • 10,807
  • 14
  • 66
  • 117

2 Answers2

2

Use <C-Y> in insert mode. For more info :h i_Ctrl-Y. <C-E> is for copying from the line below.

Alexey Shmalko
  • 3,678
  • 1
  • 19
  • 35
  • 1
    In case you want a `` to behave on words instead of characters put this in your `~/.vimrc` file: `inoremap pumvisible() ? "\" : matchstr(getline(line('.')-1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)')` – Peter Rincker Sep 05 '14 at 16:57
0

inoremap <expr> <c-l> pumvisible() ? "\<c-l>" : getline(line('.')-1)[col('.')-1]

or

inoremap <c-l> <c-r>=getline(line('.')-1)[col('.')-1]<CR>

in insert mode , just press<C-L>

frank.lin
  • 1,614
  • 17
  • 26