sponsor Vim development Vim logo Vim Book Ad

vim-surround-funk : Delete/Change/Yank/Paste surrounding function calls (based on tpope's surround)

 script karma  Rating 38/11, Downloaded by 202  Comments, bugs, improvements  Vim wiki

created by
Matthew Bennett
script type
This plugin was inspired by tpope's surround.vim and allows you to delete, change and yank a surrounding function along with its additional arguments.

It defines a couple of text objects for targeting an entire function or just its name and also defines a new command to 'grip' any text object (include another function, since now there's a text object for that). 'Gripping' will wrap/encompass text object or motion with the function that you previously deleted/yanked (For full details and demos, see https://github.com/Matt-A-Bennett/vim-surround-funk).
install details
Use your favourite plugin manager. See Installation instructions at https://github.com/Matt-A-Bennett/vim-surround-funk

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-surround-funk.tar.gz 2.2.1 2022-02-14 7.0 Matthew Bennett Wrap all operation functions in try except statement to print a single clean error instead of stack of them
vim-surround-funk.tar.gz 2.2.0 2022-01-31 7.0 Matthew Bennett Add a normal mode command to specify which `(`, `{`, `[` to use to define functions.

Add a vimrc option to specify:
- which `(`, `{`, `[` to use by default.
- whether the above normal mode command should be persistent, or a be one-off effect.

Allow user to override any global settings for different filetypes.
vim-surround-funk.tar.gz 2.1.3 2022-01-31 7.0 Matthew Bennett Bug Fix:
When a function call was multiline, and had no inner function call as an argument, then using 'dsf' would paste the new results (i.e. the surrounding function call removed) to the first and second lines (instead of the first and last lines).
vim-surround-funk.tar.gz 2.1.2 2022-01-30 7.0 Matthew Bennett Bug fix: gS command worked incorrectly when wrapping a function call around a text object that went to the end of the line (unless virtualedit was set)
vim-surround-funk.tar.gz 2.1.1 2022-01-25 7.0 Matthew Bennett Bug Fix:
Fail gracefully when the gs operator is used, but a function call has not been previously deleted/yanked in the first place (hence the gs operator is not valid).
vim-surround-funk.tar.gz 2.1.0 2022-01-25 7.0 Matthew Bennett Add the gS operator, which allows you to grip a text object or motion with a function specified on the command line. The cursor is left in insert mode just before the last parenthesis in case you want to start adding trailing arguments.
vim-surround-funk.tar.gz 2.0.0 2022-01-21 7.0 Matthew Bennett No code changes here: Just renaming the plugin to be consistent with tpope's vim-surround (which was the plugin directly inspiring this one)
surround-funk.tar.gz 2.0.0 2022-01-19 7.0 Matthew Bennett Add full text object support:

Two new text objects for entire functions and just their names (accessible from anywhere on the function).

New operator pending command for gripping any text object (including function text objects, see above) with a previously deleted/yanked function.
surround-funk.tar.gz 1.1.1 2022-01-17 7.0 Matthew Bennett Fix bug: I misspelled the global variable name in the plugin compared to the README and doc files. This would have prevented users from disabling the default mappings as per the instructions in the README and doc files.
surround-funk.tar.gz 1.1.0 2022-01-16 7.0 Matthew Bennett Add support for multi-line functions
surround-funk.vim 1.0.0 2022-01-09 7.0 Matthew Bennett Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.