Replace a word with any text
vim-scripts/snippet.vim
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a mirror of http://www.vim.org/scripts/script.php?script_id=361 Snippets are fragments of code, usually related to keywords . For example the C language defines "for" and "do" as keywords, among others. Since "for" is usually written as : for (...;...;...) { //code here } Most users will create an abbreviation for the keyword "for" to add the parenthesis and curly-braces such as : iabb xFor for<space>(<space>;<space>;<space>)<space>{<cr><cr>} To accomplish this using snippets, create a file with these lines : for ( <#cursor#>; ; ) { } Now when editing a 'c' file, when you type 'for<C-S>' ,for is replaced by the snippet of code you placed in the file. Additionally the cursor is placed between the opening ( and the first ; ... ready for you to begin typing.