{"id":13895626,"url":"https://github.com/echasnovski/mini.surround","last_synced_at":"2025-05-16T00:08:45.278Z","repository":{"id":108889534,"uuid":"556852669","full_name":"echasnovski/mini.surround","owner":"echasnovski","description":"Neovim Lua plugin with fast and feature-rich surround actions. Part of 'mini.nvim' library.","archived":false,"fork":false,"pushed_at":"2025-05-14T11:14:53.000Z","size":120,"stargazers_count":477,"open_issues_count":0,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-14T12:35:57.101Z","etag":null,"topics":["lua","mini-nvim","neovim","neovim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/echasnovski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-24T16:30:02.000Z","updated_at":"2025-05-14T00:41:27.000Z","dependencies_parsed_at":"2023-06-28T05:20:09.446Z","dependency_job_id":"eb2894f9-9c14-4887-91c2-cb6de3b7f760","html_url":"https://github.com/echasnovski/mini.surround","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echasnovski%2Fmini.surround","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echasnovski%2Fmini.surround/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echasnovski%2Fmini.surround/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echasnovski%2Fmini.surround/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/echasnovski","download_url":"https://codeload.github.com/echasnovski/mini.surround/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442855,"owners_count":22071878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","mini-nvim","neovim","neovim-plugin"],"created_at":"2024-08-06T18:02:21.039Z","updated_at":"2025-05-16T00:08:40.251Z","avatar_url":"https://github.com/echasnovski.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/echasnovski/media/blob/main/mini.nvim/logo/logo_surround.png\" style=\"width: 100%\"/\u003e\n\n\u003c!-- badges: start --\u003e\n[![GitHub license](https://badgen.net/github/license/echasnovski/mini.nvim)](https://github.com/echasnovski/mini.nvim/blob/main/LICENSE)\n\u003c!-- badges: end --\u003e\n\n### Fast and feature-rich surround actions\n\n- Add, delete, replace, find, highlight surrounding (like pair of parenthesis, quotes, etc.).\n- Supports dot-repeat for text edits, `v:count`, different search methods, \"last\"/\"next\" extended mappings, customization via Lua patterns or functions, and more.\n- Has builtins for brackets, function call, tag, user prompt, and any alphanumeric/punctuation/whitespace character.\n- Has maintained configuration of setup similar to 'tpope/vim-surround'.\n\nSee more details in [Features](#features) and [help file](doc/mini-surround.txt).\n\n---\n\n⦿ This is a part of [mini.nvim](https://github.com/echasnovski/mini.nvim) library. Please use [this link](https://github.com/echasnovski/mini.nvim/blob/main/README.md) if you want to mention this module.\n\n⦿ All contributions (issues, pull requests, discussions, etc.) are done inside of 'mini.nvim'.\n\n⦿ See the repository page to learn about common design principles and configuration recipes.\n\n---\n\nIf you want to help this project grow but don't know where to start, check out [contributing guides of 'mini.nvim'](https://github.com/echasnovski/mini.nvim/blob/main/CONTRIBUTING.md) or leave a Github star for 'mini.nvim' project and/or any its standalone Git repositories.\n\n## Demo\n\nhttps://github.com/user-attachments/assets/e91b6e16-7a9c-44aa-afb4-7e07efc3e811\n\n## Features\n\n- Actions (text editing actions are dot-repeatable out of the box and respect `[count]`) with configurable mappings:\n    - Add surrounding with `sa` (in visual mode or on motion).\n    - Delete surrounding with `sd`.\n    - Replace surrounding with `sr`.\n    - Find surrounding with `sf` or `sF` (move cursor right or left).\n    - Highlight surrounding with `sh`.\n    - Change number of neighbor lines with `sn` (see `:h MiniSurround-algorithm`).\n- Surrounding is identified by a single character as both \"input\" (in `delete` and `replace` start, `find`, and `highlight`) and \"output\" (in `add` and `replace` end):\n    - 'f' - function call (string of alphanumeric symbols or '_' or '.' followed by balanced '()'). In \"input\" finds function call, in \"output\" prompts user to enter function name.\n    - 't' - tag. In \"input\" finds tag with same identifier, in \"output\" prompts user to enter tag name.\n    - All symbols in brackets '()', '[]', '{}', '\u003c\u003e\". In \"input' represents balanced brackets (open - with whitespace pad, close - without), in \"output\" - left and right parts of brackets.\n    - '?' - interactive. Prompts user to enter left and right parts.\n    - All other single character identifiers (supported by `getcharstr()`) represent surrounding with identical left and right parts.\n- Configurable search methods to find not only covering but possibly next, previous, or nearest surrounding. See more in help for `MiniSurround.config`.\n- All actions involving finding surrounding (delete, replace, find, highlight) can be used with suffix that changes search method to find previous/last. See more in help for `MiniSurround.config`.\n\n## Installation\n\nThis plugin can be installed as part of 'mini.nvim' library (**recommended**) or as a standalone Git repository.\n\nThere are two branches to install from:\n\n- `main` (default, **recommended**) will have latest development version of plugin. All changes since last stable release should be perceived as being in beta testing phase (meaning they already passed alpha-testing and are moderately settled).\n- `stable` will be updated only upon releases with code tested during public beta-testing phase in `main` branch.\n\nHere are code snippets for some common installation methods (use only one):\n\n\u003cdetails\u003e\n\u003csummary\u003eWith \u003ca href=\"https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-deps.md\"\u003emini.deps\u003c/a\u003e\u003c/summary\u003e\n\u003ctable\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003eGithub repo\u003c/th\u003e\n            \u003cth\u003eBranch\u003c/th\u003e \u003cth\u003eCode snippet\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd rowspan=2\u003e'mini.nvim' library\u003c/td\u003e \u003ctd\u003eMain\u003c/td\u003e \u003ctd rowspan=2\u003e\u003ci\u003eFollow recommended 'mini.deps' installation\u003c/i\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eStable\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd rowspan=2\u003eStandalone plugin\u003c/td\u003e \u003ctd\u003eMain\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eadd('echasnovski/mini.surround')\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eStable\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eadd({ source = 'echasnovski/mini.surround', checkout = 'stable' })\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eWith \u003ca href=\"https://github.com/folke/lazy.nvim\"\u003efolke/lazy.nvim\u003c/a\u003e\u003c/summary\u003e\n\u003ctable\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003eGithub repo\u003c/th\u003e\n            \u003cth\u003eBranch\u003c/th\u003e \u003cth\u003eCode snippet\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd rowspan=2\u003e'mini.nvim' library\u003c/td\u003e\n            \u003ctd\u003eMain\u003c/td\u003e \u003ctd\u003e\u003ccode\u003e{ 'echasnovski/mini.nvim', version = false },\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eStable\u003c/td\u003e \u003ctd\u003e\u003ccode\u003e{ 'echasnovski/mini.nvim', version = '*' },\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd rowspan=2\u003eStandalone plugin\u003c/td\u003e\n            \u003ctd\u003eMain\u003c/td\u003e \u003ctd\u003e\u003ccode\u003e{ 'echasnovski/mini.surround', version = false },\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eStable\u003c/td\u003e \u003ctd\u003e\u003ccode\u003e{ 'echasnovski/mini.surround', version = '*' },\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eWith \u003ca href=\"https://github.com/junegunn/vim-plug\"\u003ejunegunn/vim-plug\u003c/a\u003e\u003c/summary\u003e\n\u003ctable\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003eGithub repo\u003c/th\u003e\n            \u003cth\u003eBranch\u003c/th\u003e \u003cth\u003eCode snippet\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd rowspan=2\u003e'mini.nvim' library\u003c/td\u003e\n            \u003ctd\u003eMain\u003c/td\u003e \u003ctd\u003e\u003ccode\u003ePlug 'echasnovski/mini.nvim'\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eStable\u003c/td\u003e \u003ctd\u003e\u003ccode\u003ePlug 'echasnovski/mini.nvim', { 'branch': 'stable' }\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd rowspan=2\u003eStandalone plugin\u003c/td\u003e \u003ctd\u003eMain\u003c/td\u003e \u003ctd\u003e\u003ccode\u003ePlug 'echasnovski/mini.surround'\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eStable\u003c/td\u003e \u003ctd\u003e\u003ccode\u003ePlug 'echasnovski/mini.surround', { 'branch': 'stable' }\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n**Important**: don't forget to call `require('mini.surround').setup()` to enable its functionality.\n\n**Note**: if you are on Windows, there might be problems with too long file paths (like `error: unable to create file \u003csome file name\u003e: Filename too long`). Try doing one of the following:\n- Enable corresponding git global config value: `git config --system core.longpaths true`. Then try to reinstall.\n- Install plugin in other place with shorter path.\n\n## Default config\n\n```lua\n-- No need to copy this inside `setup()`. Will be used automatically.\n{\n  -- Add custom surroundings to be used on top of builtin ones. For more\n  -- information with examples, see `:h MiniSurround.config`.\n  custom_surroundings = nil,\n\n  -- Duration (in ms) of highlight when calling `MiniSurround.highlight()`\n  highlight_duration = 500,\n\n  -- Module mappings. Use `''` (empty string) to disable one.\n  mappings = {\n    add = 'sa', -- Add surrounding in Normal and Visual modes\n    delete = 'sd', -- Delete surrounding\n    find = 'sf', -- Find surrounding (to the right)\n    find_left = 'sF', -- Find surrounding (to the left)\n    highlight = 'sh', -- Highlight surrounding\n    replace = 'sr', -- Replace surrounding\n    update_n_lines = 'sn', -- Update `n_lines`\n\n    suffix_last = 'l', -- Suffix to search with \"prev\" method\n    suffix_next = 'n', -- Suffix to search with \"next\" method\n  },\n\n  -- Number of lines within which surrounding is searched\n  n_lines = 20,\n\n  -- Whether to respect selection type:\n  -- - Place surroundings on separate lines in linewise mode.\n  -- - Place surroundings on each line in blockwise mode.\n  respect_selection_type = false,\n\n  -- How to search for surrounding (first inside current line, then inside\n  -- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev',\n  -- 'cover_or_nearest', 'next', 'prev', 'nearest'. For more details,\n  -- see `:h MiniSurround.config`.\n  search_method = 'cover',\n\n  -- Whether to disable showing non-error feedback\n  -- This also affects (purely informational) helper messages shown after\n  -- idle time if user input is required.\n  silent = false,\n}\n```\n\n## Similar plugins\n\n- [tpope/vim-surround](https://github.com/tpope/vim-surround)\n- [kylechui/nvim-surround](https://github.com/kylechui/nvim-surround)\n- [machakann/vim-sandwich](https://github.com/machakann/vim-sandwich)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fechasnovski%2Fmini.surround","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fechasnovski%2Fmini.surround","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fechasnovski%2Fmini.surround/lists"}