Raveen Kumar

How to use vim abbreviations to manage multiline abbreviations, snippets and skeleton files

Save the snippets in a directory in plain text file.

Next, write an abbreviation command like this.

iab text <ESC>:read /path/to/snippet/text_expansion.txt<CR>i

Explanation:

  • <ESC> - Go to normal mode
  • :read - Read from text file from /path/
  • The text_expansion.txt will contain a multiline or single line text that is used to expand text.
  • <CR> - To execute the read command
  • i - go back to insert mode

Press <space> after text to expand and place a space after. Or use C-] to expand without space.

This way, you can avoid using any other snippet manager plugins.

#Tech