Search code examples
vimvi

copy partial lines in VI


There are a lot of different ways in which one can yank complete single/multiple lines. Is there a way in which we can copy partial lines in vi, like just 10 characters of the line.


Solution

  • I would guess the most common partial yanks are:

    yaw: yank the word the cursor is currently in
    2yaw: yank the word the cursor in currently in and the next (2 words total)
    ya(: yank the matched parentheses containing the cursor
    yf.: yank from the cursor to the next .
    y$: yank from the cursor to the end of the line

    Any movement keys can be used.