Skip to content

Commit 2c3edae

Browse files
committed
fix: Allow disabling aliases.
1 parent caf6f63 commit 2c3edae

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lua/nvim-surround/config.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,10 @@ end
541541

542542
-- Translates `alias` into the internal form.
543543
---@param user_alias false|string|string[] The user-provided `alias`.
544-
---@return string|string[]|nil @The translated `alias`.
544+
---@return false|string|string[] @The translated `alias`.
545545
M.translate_alias = function(user_alias)
546546
if not user_alias then
547-
return nil
547+
return user_alias
548548
end
549549
return user_alias
550550
end

tests/configuration_spec.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,18 @@ describe("configuration", function()
557557
check_lines({ "wbHello, world!" })
558558
end)
559559

560+
it("can disable aliases", function()
561+
require("nvim-surround").buffer_setup({
562+
aliases = {
563+
s = false,
564+
},
565+
})
566+
567+
set_lines({ "([{<>}])" })
568+
vim.cmd("normal dss")
569+
check_lines({ "([{<>}])" })
570+
end)
571+
560572
it("can cancel surrounds, without moving the cursor", function()
561573
require("nvim-surround").buffer_setup({
562574
move_cursor = false,

0 commit comments

Comments
 (0)