Share your feedback via email, using Mastodon or
[Plugin] You're surrounded and that's good: nvim-surround
Streamline manipulation of surrounding characters
Edits: - on DATE: Moved to mini.surround [1]
[1] I’ve now moved to
mini.surround
[1] Writing in a text editor would be cumbersome if it was just about typing one letter after the other, then removing one letter after the other to correct your text, and start over again and again. We are lucky to have smart people in our community who build tools to make the writing process more enjoyable and help us improve our productivity. This is the case of the
kylechui/nvim-surround neovim plugin
. Taking advantage of brackets, parentheses, and quotes, this plugin simplifies text manipulation. Here are some quick examples on how to use this plugin. Pairs of delimiters usually refer to <, >; {, }; [, ]; <, >; ‘, ‘; “, “. That means if you type one of them in your keybinding, its matching pair will automatically be used in your selection surrounding. Note that the following aliases can be used in your keybinding: Add surroundings For example, There’s also a selection mode which will let you add delimiters to a selected text. Simply select your text and use the keybinding Remove surroundings For example, Change surroundings For example, Work with html tags For example: Define your own delimiters For example You never get enough, do you? So there’s even more keybindings to work on functions, add delimiters on new lines… All is detailed in By now, you should get an idea of how this plugin can speed up your text editing/coding workflow. Give it a try today and watch your productivity soar as you effortlessly balance your brackets and wrap your text! +++
title = “[Plugin] You’re surrounded and that’s good: nvim-surround”
description = “Streamline manipulation of surrounding characters”
date = “2024-09-07T07:49:56-04:00”
lastmod = “2024-09-07T07:49:56-04:00”
edit1 = “- on DATE: [1]”
edit2 = “- on DATE: [2]”
tags = ["(Neo)vim”,"(Neo)vim-plugins”]
[comments]
host = “social.linux.pizza”
username = “wwwgem”
id = “113096397994454718”
+++
Writing in a text editor would be cumbersome if it was just about typing one letter after the other, then removing one letter after the other to correct your text, and start over again and again. We are lucky to have smart people in our community who build tools to make the writing process more enjoyable and help us improve our productivity. This is the case of the
kylechui/nvim-surround neovim plugin
. Taking advantage of brackets, parentheses, and quotes, this plugin simplifies text manipulation. Here are some quick examples on how to use this plugin. Pairs of delimiters usually refer to <, >; {, }; [, ]; <, >; ‘, ‘; “, “. That means if you type one of them in your keybinding, its matching pair will automatically be used in your selection surrounding. Note that the following aliases can be used in your keybinding: Add surroundings For example, There’s also a selection mode which will let you add delimiters to a selected text. Simply select your text and use the keybinding Remove surroundings For example, Change surroundings For example, Work with html tags For example: Define your own delimiters For example You never get enough, do you? So there’s even more keybindings to work on functions, add delimiters on new lines… All is detailed in By now, you should get an idea of how this plugin can speed up your text editing/coding workflow. Give it a try today and watch your productivity soar as you effortlessly balance your brackets and wrap your text!
It provides a set of commands for quickly adding, removing, and changing pairs of characters around a selected piece of text. It’s particularly useful for tasks like wrapping text in HTML tags, creating function calls, or even just balancing your parentheses.How To Use It
a = >
b = )
B = }
r = ]
q = “, ‘, `
Any other character will be used as is. For example, using “e” in the keybinding to add surrounding characters will append and prepend the selected text with “e”. The only exception being “t” which will be detailed below.
Quickly add pairs of delimiters around a selection with ysysiw{ or ysiw}to wrap a word in curly bracesys3wr to wrap 3 words in square bracesS followed by a delimiter.ds( or ds)to remove bracesdsq to remove quotescs([, cs(], cs)[, or cs)] to swap braces to square bracescsBr to swap curly braces to sqaure braces
Using “t” at the final argument in any of the above keybindings will deal with html tags.ysiwt will ask for the tag delimiter. Entering “p” will surround the selection with <p> and </p>dst will delete the first occurrence of surrounding html tagscst will ask for the new html tag
This option only support adding delimiters for now. Typing the ys keybinding followed by “i” will ask for your left and right delimiter respectively.ysiwi will ask for the left delimiter, let’s enter */
then it’ll ask for the right delimiter, let’s enter /*
the end result will be */YOUR_SELECTION/*That’S All?
:h nvim-surround.usage
It provides a set of commands for quickly adding, removing, and changing pairs of characters around a selected piece of text. It’s particularly useful for tasks like wrapping text in HTML tags, creating function calls, or even just balancing your parentheses.How To Use It
a = >
b = )
B = }
r = ]
q = “, ‘, `
Any other character will be used as is. For example, using “e” in the keybinding to add surrounding characters will append and prepend the selected text with “e”. The only exception being “t” which will be detailed below.
Quickly add pairs of delimiters around a selection with ysysiw{ or ysiw}to wrap a word in curly bracesys3wr to wrap 3 words in square bracesS followed by a delimiter.ds( or ds)to remove bracesdsq to remove quotescs([, cs(], cs)[, or cs)] to swap braces to square bracescsBr to swap curly braces to sqaure braces
Using “t” at the final argument in any of the above keybindings will deal with html tags.ysiwt will ask for the tag delimiter. Entering “p” will surround the selection with <p> and </p>dst will delete the first occurrence of surrounding html tagscst will ask for the new html tag
This option only support adding delimiters for now. Typing the ys keybinding followed by “i” will ask for your left and right delimiter respectively.ysiwi will ask for the left delimiter, let’s enter */
then it’ll ask for the right delimiter, let’s enter /*
the end result will be */YOUR_SELECTION/*That’S All?
:h nvim-surround.usage