vimtricks.wiki Concise Vim tricks, one at a time.

How do I change the content inside backticks?

Answer

ci`

Explanation

The ci` command changes the text inside backtick delimiters. This is useful when editing markdown inline code or template literals.

How it works

  • c is the change operator
  • i` is the "inner backticks" text object
  • Deletes content between backticks and enters insert mode
  • Backticks are preserved

Example

Use the `oldCommand` to do things.

With cursor inside the backticks, ci` deletes oldCommand and enters insert mode. Type newCommand.

Tips

  • ca` changes around backticks (deletes them too)
  • di` deletes without entering insert mode
  • vi` selects inside backticks
  • Works in markdown files for editing inline code
  • Also useful for JavaScript template literals

Next

How do you yank a single word into a named register?