Insert word from the line above

6 Points

Yuxin Wu Yuxin Wu

7 years ago

Useful when typing something which shares prefix with the line above!

" insert word of the line above
inoremap <C-Y> <C-C>:let @z = @"<CR>mz
			\:exec 'normal!' (col('.')==1 && col('$')==1 ? 'k' : 'kl')<CR>
			\:exec (col('.')==col('$') - 1 ? 'let @" = @_' : 'normal! yw')<CR>
			\`zp:let @" = @z<CR>a

mwgkgk

mwgkgk 7 years ago

Clever!