Is there an easy vim keyboard shortcut to yank a word, including its surrounding quotes? For instance I would like to yank 'my_word' from the statement below:

tmp = my_func(arg1, 'my_word')

How can I do that? I have surround plugin installed.

yi' only yanks my_word, but not 'my_word'.

  • 3
    Welcome to Vi and Vim! Are you aware of :help text-objects? It seems like you want ya'
    – D. Ben Knoble
    Commented Jan 20, 2023 at 15:47

1 Answer 1


Here are the keybindings you wanted..

  • va' selects the word(s) inside the quote
  • va) selects the word(s) inside brackets
  • va} selects the word(s) inside curly braces

And then press y to yank.

Bonus : replace v with d to delete accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.