{"id":14981723,"url":"https://github.com/cz875/multichar-surround.nvim","last_synced_at":"2026-02-28T13:11:39.054Z","repository":{"id":322935670,"uuid":"1035524954","full_name":"cz875/multichar-surround.nvim","owner":"cz875","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-10T15:47:03.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-07T07:07:53.324Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"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/cz875.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-10T15:30:15.000Z","updated_at":"2025-08-10T15:47:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cz875/multichar-surround.nvim","commit_stats":null,"previous_names":["cz875/multichar-surround.nvim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cz875/multichar-surround.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cz875%2Fmultichar-surround.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cz875%2Fmultichar-surround.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cz875%2Fmultichar-surround.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cz875%2Fmultichar-surround.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cz875","download_url":"https://codeload.github.com/cz875/multichar-surround.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cz875%2Fmultichar-surround.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29935081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T13:00:17.143Z","status":"ssl_error","status_checked_at":"2026-02-28T12:59:13.669Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","neovim","neovim-plugin","nvim","nvim-plugin"],"created_at":"2024-09-24T14:04:06.966Z","updated_at":"2026-02-28T13:11:39.011Z","avatar_url":"https://github.com/cz875.png","language":"Lua","readme":"### multichar-surround.nvim\n\nA simple Neovim surround plugin for editing multiple characters at once\n\n### Concept\n\nThere are already so many [great plugins](#other-surround-plugins) for surrounding text in vim/neovim, so why write another? Other plugins are mature, fully featured, and work great for single-character edits, but I've always a convenient way to edit multiple surrounding characters at a time. So, I wrote a helper function for my own convenience, which I've decided to repackage as its own plugin in case anyone else finds it useful.\n\n**I recommend using one of the [existing plugins](#other-surround-plugins) for single character edits** I use [mini.surround](https://github.com/echasnovski/mini.surround).\n\n### Usage\n\nThis is a very simple plugin which provides just one lua function intended to\nbe called by a keymap in visual mode. For example:\n\n```lua\nvim.keymap.set(\"x\", \"S\", function()\n    require(\"multichar-surround\").do_surround()\nend)\n```\n\nWith this keymap, upon typing \"S\" in visual mode, you should be prompted on the\ncommand line:\n\n```\nEnter right pair:\n```\n\nIf the function detects matching pairs of characters at both ends of your\nvisual selection, then they will be automatically filled into the prompt for\nediting.\n\nThat is, if you select the text:\n\n```lua\n({ \"Hello World!\" })\n```\n\nthen you should see the following after triggering `do_surround`:\n\n```\nEnter right pair:\" })\n```\n\nwhich you can edit as necessary:\n\n```\nEnter right pair:']\n```\n\nand hit enter (\u003cCR\u003e) to apply the changes to the buffer:\n\n```lua\n['Hello world']\n```\n\n### Installation / Setup\n\n1. Install the plugin with your favorite plugin manager.\n\n2. All it does is expose one function, which you can map to whatever key you'd like. In this example, I use \u003ckbd\u003eshift+s\u003c/kbd\u003e (\u003ckbd\u003eS\u003c/kbd\u003e):\n\n```lua\nvim.keymap.set(\"x\", \"S\", function() require(\"multichar-surround\").do_surround() end)\n```\n\nThe following does both of the above steps if you're using [lazy.nvim](https://github.com/folke/lazy.nvim):\n\n```lua\n{\n    \"cz875/multichar-surround.nvim\",\n    keys = {\n        { mode = { \"x\" }, \"S\", function() require(\"multichar-surround\").do_surround() end }\n    }\n}\n```\n\nOnce you've completed the above setup, you should be able to select some text in visual mode and edit its surrounding characters by pressing \u003ckbd\u003eS\u003c/kbd\u003e.\n\n### Configuration\n\nYou can configure the plugin by passing a table to the `setup()` function.\nThe default config is as follows:\n\n```lua\nrequire(\"multichar-surround\").setup({\n    -- the text to show when prompting the user for input\n    prompt_text = \"Edit right pair:\",\n\n    -- the highlight group to use for detected balanced pairs\n    hl_group = \"MatchParen\",\n\n    -- a list of pairs of mirrored characters to be used in\n    -- detection/insertion of balanced pairs\n    matching_pairs = {\n        { \"(\", \")\" }, { \"[\", \"]\" }, { \"{\", \"}\" }, { \"\u003c\", \"\u003e\" }\n    },\n} --[[@as MulticharSurroundOpts]])\n```\n\nIn `lazy.nvim`, you can (and should) use the `opts` field:\n\n```lua\n{\n    \"cz875/multichar-surround.nvim\",\n    keys = {\n        { mode = { \"x\" }, \"S\", function() require(\"multichar-surround\").do_surround() end }\n    },\n    ---@type MulticharSurroundOpts\n    opts = {\n        -- the text to show when prompting the user for input\n        prompt_text = \"Edit right pair:\",\n\n        -- the highlight group to use for detected balanced pairs\n        hl_group = \"MatchParen\",\n\n        -- a list of pairs of mirrored characters to be used in\n        -- detection/insertion of balanced pairs\n        matching_pairs = {\n            { \"(\", \")\" }, { \"[\", \"]\" }, { \"{\", \"}\" }, { \"\u003c\", \"\u003e\" }\n        },\n    }\n}\n```\n\nThat opts table is then automatically passed into the `setup()` function.\n\n### Contributing\n\nContributions are always welcome. Feel free to open an issue or submit a PR if you have problems/suggestions.\n\n### Other surround plugins\n\n- [tpope/vim-surround](https://github.com/tpope/vim-surround)\n- [machakann/vim-sandwich](https://github.com/machakann/vim-sandwich)\n- [kylechui/nvim-surround](https://github.com/kylechui/nvim-surround)\n- [echasnovski/mini.surround](https://github.com/echasnovski/mini.surround/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcz875%2Fmultichar-surround.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcz875%2Fmultichar-surround.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcz875%2Fmultichar-surround.nvim/lists"}