https://github.com/user-attachments/assets/395f18ee-1346-4ac2-8b5c-79597cffe995
0.8.0+[!WARNING] If using with nvim-autopairs, in
require("nvim-autopairs").setup({}), ensure thatmap_bs = false.
vim.pack.add({"https://github.com/qwavies/smart-backspace.nvim"})
require("smart-backspace").setup()
{
"qwavies/smart-backspace.nvim"
}
use {
"qwavies/smart-backspace.nvim"
}
Plug "qwavies/smart-backspace.nvim"
If you want to lazy load Smart Backspace, you can create an autocmd with an event condition. For example, using 📦 vim.pack:
vim.api.nvim_create_autocmd({ "InsertEnter", "CmdlineEnter" }, {
once = true,
callback = function()
vim.pack.add({"https://github.com/qwavies/smart-backspace.nvim"})
require("smart-backspace").setup()
end
})
{
"qwavies/smart-backspace.nvim",
event = {"InsertEnter", "CmdlineEnter"}
}
Using 📦 vim.pack:
vim.pack.add({"https://github.com/qwavies/smart-backspace.nvim"})
require("smart-backspace").setup({
enabled = true, -- enables/disables smart-backspace
silent = true, -- if set to false, it will send a notification if smart-backspace is toggled
disabled_filetypes = { -- filetypes to automatically disable smart-backspace
"", -- no extension
"py",
"hs",
"md",
"txt",
}
})
{
"qwavies/smart-backspace.nvim",
opts = {
enabled = true, -- enables/disables smart-backspace
silent = true, -- if set to false, it will send a notification if smart-backspace is toggled
disabled_filetypes = { -- filetypes to automatically disable smart-backspace
"", -- no extension
"py",
"hs",
"md",
"txt",
}
}
}
Using the :SmartBackspaceToggle command, smart-backspace can be toggled on/off.
You can force a certain state with either :SmartBackspaceToggle on or :SmartBackspaceToggle off
If you want to set a keybind to toggle smart-backspace, you can implement the following into your neovim config:
vim.keymap.set("n", "<leader>bs", "<cmd>SmartBackspaceToggle<CR>", { desc = "Toggle Smart Backspace" })
Smart-Backspace prides itself in its almost instant load times.
Compare load times against some other plugins!
:SmartBackspaceToggle command<C-BS> to use as a regular backspace