Simple utility for managing snippets of text within vim.
Originnaly created by Jeremy Cantrell as snippets.vim : Simple snippet storage and retrieval separated by filetype.
utility
Simple utility for managing snippets of text within vim. Users can add, edit, and delete snippets within vim. Command completion is supported in all places that make sense. A menu is also added at "Plugin/Snippets".
Place the script in ~/.vim/plugin & place the text doc in ~/.vim/doc. :helptags ALL
. Restart vim.
OR
With vim-plug:
Plug 'https://github.com/Pinaki82/vim-jsnippets.git'
:PlugInstall
Help:
:h jsnippets
AddSnippet -- adds new snippet that contain a range of lines
EditSnippet -- edits a snippet in a new tab
DeleteSnippet -- deletes a snippet (with confirmation)
InsertSnippet -- inserts a snippet before the current line
AppendSnippet -- inserts a snippet after the current line
ListSnippets -- lists snippets
<leader>jsa
-- AddSnippet with current buffer (normal mode)
<leader>jsa
-- AddSnippet with range of lines (visual mode)
<leader>jse
-- EditSnippet
<leader>jsd
-- DeleteSnippet
<leader>jsp
-- AppendSnippet
<leader>jsP
-- InsertSnippet
<leader>jsl
-- ListSnippets
Create a directory $HOME/vimfiles/snippets. Create separate sub-directories for different file types (c, cpp etc.).
For example:
%USERPROFILE%\PortableApps\gVimPortable\Data\settings\vimfiles\snippets
%USERPROFILE%\vimfiles\snippets
~/vimfiles/snippets
You'll find a few snippets and templates here: Tulu-C-IDE
Licence: https://www.vim.org/scripts/script.php?script_id=2152