nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with in Lua.

MIT License

Stars
3.1K
Committers
33

Bot releases are visible (Hide)

nvim-surround - v2.2.0 Latest Release

Published by github-actions[bot] 4 months ago

2.2.0 (2024-06-08)

Features

nvim-surround - v2.1.11

Published by github-actions[bot] 5 months ago

2.1.11 (2024-06-06)

Bug Fixes

nvim-surround - v2.1.10

Published by github-actions[bot] 5 months ago

2.1.10 (2024-05-30)

Bug Fixes

  • Default delete should work if find key is sane. (#331) (6d2be37)
  • Don't translate termcodes twice on input (#326) (de828d6)
  • Typo in help docs. (fa5b365)
nvim-surround - v2.1.9

Published by github-actions[bot] 5 months ago

2.1.9 (2024-05-29)

Bug Fixes

  • Properly determine if $ is used in a block surround. (#328) (23f4966)
nvim-surround - v2.1.8

Published by github-actions[bot] 5 months ago

2.1.8 (2024-05-16)

Bug Fixes

  • replace deprecated vim.tbl_islist by native Lua function (#323) (38973ca)
nvim-surround - v2.1.7

Published by github-actions[bot] 6 months ago

2.1.7 (2024-04-30)

Bug Fixes

  • Handle multi-byte characters for change/delete. (#318) (f929665)
nvim-surround - v2.1.6

Published by github-actions[bot] 6 months ago

2.1.6 (2024-04-11)

Bug Fixes

  • Mark fields in user_option and user_surround as optional (#308) (f7bb9fc)
nvim-surround - v2.1.5

Published by github-actions[bot] 8 months ago

2.1.5 (2024-02-27)

Bug Fixes

  • Add bang to the g@ normal command. (#297) (0c02c52)
  • dot-repeat: Clear dot-repeat after indentation (#306) (8f2af76)
  • Visual selection highlight disappearing. (#312) (a72a97c)
nvim-surround - v2.1.4

Published by github-actions[bot] 11 months ago

2.1.4 (2023-12-04)

Bug Fixes

nvim-surround - v2.1.3

Published by github-actions[bot] 11 months ago

2.1.3 (2023-11-13)

Bug Fixes

nvim-surround - v2.1.2

Published by github-actions[bot] 12 months ago

2.1.2 (2023-10-22)

Bug Fixes

nvim-surround - v2.1.1

Published by github-actions[bot] about 1 year ago

2.1.1 (2023-08-05)

Bug Fixes

  • Respect move_cursor = false when dot-repeating. (#254) (ec6a721)
nvim-surround - v2.1.0

Published by github-actions[bot] over 1 year ago

2.1.0 (2023-05-28)

Features

  • Implement change_line mapping. (ff9c981)

Bug Fixes

  • buffer: set_mark should check for validity of input. (841f83f)
nvim-surround - v2.0.5

Published by github-actions[bot] over 1 year ago

2.0.5 (2023-04-02)

Bug Fixes

  • Don't re-indent single-line surrounds. (2fca63c)
nvim-surround - v2.0.4

Published by github-actions[bot] over 1 year ago

2.0.4 (2023-03-28)

Bug Fixes

  • Whitespace handling when delimiters are on own line. (#226) (808fc7d)
nvim-surround - v2.0.3

Published by github-actions[bot] over 1 year ago

2.0.3 (2023-03-27)

Bug Fixes

  • Restore window view after finding nearest selections. (#227) (97f7309)
nvim-surround - v2.0.2

Published by github-actions[bot] over 1 year ago

2.0.2 (2023-03-27)

Bug Fixes

nvim-surround - v2.0.1

Published by github-actions[bot] over 1 year ago

2.0.1 (2023-03-21)

Bug Fixes

  • config: User-defined surrounds fallback on defaults. (29929a5)
nvim-surround - v2.0.0

Published by github-actions[bot] over 1 year ago

2.0.0 (2023-03-11)

⚠ BREAKING CHANGES

Note: The majority of this document is auto-generated, and I don't fully remember if anything else has changed in the diff since v1.0.0. If you notice anything missing, please open an issue and I can add it here!

  • The function get_char has been moved from utils to input.
  • The function get_delimiters has been moved from utils to config.
  • The textobject field for config.get_selection has been deprecated; please use motion instead. See this comment.
    • To update your functions, prepend 'a' to the textobject key, i.e. (a(
  • The highlight group used has been renamed from NvimSurroundHighlightTextObject to NvimSurroundHighlight. See this comment.
  • User defined invalid_key_behavior handlers will be activated for control characters that don't have defined surrounds. In other words, <C-a> is now a valid input that can be passed to invalid_key_behavior. See this comment.
    • Note: <C-c> is still invalid, and terminates the input.
  • Smart quotes have been removed. Modifying quotes will now always operate on the immediately surrounding pair of quotes. See this comment.

Features

  • Add node field to config.get_selection, allowing users to retrieve selections based on treesitter nodes.
  • Add indent_lines field to setup, allowing users to configure what indentation program should be used for certain line-wise surrounds (if any).
  • Add <Plug> mappings; decouple mappings. (af10059)
  • Add exclude key to config.get_selections. (e2c22a6)
  • Implement basic query-matching. (a634889)

Bug Fixes

  • <Plug>(nvim-surround-insert) mapping. (#176) (6b45fbf)
  • Add indentation when using line mode. (#185) (9da7ced)
  • Add protected call around Tree-sitter module. (d91787d)
  • Change reset_cursor semantics. (a207e3b)
  • Change type annotations to |nil from ?. (1ac5abf)
  • Correctly restore visual selection marks. (#155) (c6a1993)
  • Failing test cases due to Tree-sitter dependency. (c057fb8)
  • Fix catastrophic error that broke everything. (c323fa5)
  • Fix quote bug, closes #172. (58b0a55)
  • Handle special characters for getchar. (#170) (1f79449)
  • Improper look-behind for quotes. (1d83fec)
  • Improper table handling for add, resolves #191. (d51d554)
  • Minor bugs. (7f7ca04)
  • Properly handle linewise normal surrounds. (90821ad)
  • Remove remap = true from keymaps. (#219) (89c82e7)
  • Revert some changes. (ce01942)
  • Revert to pattern-based function calls by default. (ba19320)
  • Support Lua 5.1 instead of only LuaJIT. (#169) (fa7648e)
  • Tweak pattern for function calls. (3accef6)
  • Update function pattern. (c0835d2)
  • Use line_mode parameter when possible. (#194) (ad56e62)
  • utils: Ensure chars is a table in ipairs. (#192) (64e2106)
  • Error when vim.o.selection='exclusive'. (#158) (81f672a)

Additional Notes

Sorry for the long time in between releases everybody, I thought I could implement queries support in a sensible way in a short amount of time, but it quickly became much more to handle than I had thought. Moving forwards, I aim to make the plugin "more stable" and to improve the user experience:

  • Be more consistent with SemVer releases (i.e. version more frequently)
  • Improve the automated testing suite
  • Improve the documentation (considering automated documentation)
  • Improve the customizability of the plugin (it should do what you think it does)
    • This is somewhat accomplished in the current release, as more fields can be set to false, but could still use some work

Thanks again to everyone for using this!

nvim-surround - v1.0.0

Published by kylechui about 2 years ago

This marks the first official release of nvim-surround! 🎉

Features

  • Add/delete/change surrounding delimiter pairs
    • Function calls and HTML tags have built-in support
  • Use functions to define what pairs to add to the buffer
  • Use functions to define what selections to modify
    • Vim text-objects and Lua patterns have first-class support
  • Dot-repeat previous surround actions
  • Jump to the "nearest" surrounding pair for modification
  • Alias characters to represent other keys
  • Highlight selections to be surrounded or modified

Future Goals

As of right now, nvim-surround uses built-in Vim text-objects or Lua patterns to find the "parent selection" that contains a surrounding pair. I intend on expanding this ideology to Tree-sitter nodes as well, so things can be run properly, even if nvim-treesitter-textobjects is not installed.

Thanks

Massive thanks goes out to everybody that's helped me out with feedback and ideas on how to design this plugin, especially those that have submitted PRs. Also thanks to everybody that's filed a feature request or bug report.

Thanks for using nvim-surround, I hope it's as much of a joy to use as it is for me to write 💖