Skip to content

Migrating From Another Plugin

kylechui edited this page Aug 12, 2022 · 3 revisions

Table of Contents


Feature Comparison

TODO: Add table comparing features

  • Dot-repeat
  • Smart quotes
  • Reverse jumping

Migrating From vim-surround

The default configuration matches many things in vim-surround; most features in nvim-surround are designed to be an extension of those found in vim-surround, as opposed to completely different behavior. Here's a configuration that gets reasonably close:

require("nvim-surround").setup({
    aliases = {
        ["<"] = "t",
    },
})

A few quirks to take note of:

  • In general, extraneous whitespace is ignored for all normal mode surrounds.
    • The command ysa"b for the buffer local str = "test string" would yield local str = ("test string").
    • The command ysibB for the buffer ( some text ) would yield ( {some text} ).
  • HTML-related:
    • When filling out the contents of an HTML tag, < and > are optional.
    • > does not end the user-input, <CR> does.
    • When changing the surrounding tag, the "HTML key" only needs to be pressed once, e.g. cst instead of cstt.
    • By default, cst will change just the tag type, while csT will change the whole tag contents.

Migrating from vim-sandwich

TODO: Include more detailed information about vim-sandwich

require("nvim-surround").setup({
    keymaps = {
        normal = "sa",
        delete = "sd",
        change = "sr",
    },
})

Migrating from mini.surround

TODO: Add mini.surround configuration, differences

Clone this wiki locally