README.md
July 17, 2026 · View on GitHub
✨ Smart Backspace for Neovim ✨
Neovim plugin to save time removing indentation written in lua. Inspired by the JetBrains IDE IntelliJ's backspace functionality.
🚀 Demo
https://github.com/user-attachments/assets/395f18ee-1346-4ac2-8b5c-79597cffe995
📦 Installation
📋 Requirements
- Neovim
0.8.0+
Warning
If using with nvim-autopairs, in require("nvim-autopairs").setup({}), ensure that map_bs = false.
Using 📦 vim.pack:
vim.pack.add({"https://github.com/qwavies/smart-backspace.nvim"})
require("smart-backspace").setup()
Other Plugin Manager Instructions
For 💤 lazy.nvim users:
{
"qwavies/smart-backspace.nvim"
}
For 📦 packer.nvim users:
use {
"qwavies/smart-backspace.nvim"
}
For 🔌 vim-plug users:
Plug "qwavies/smart-backspace.nvim"
⚙ Configuration
💤 Lazy Loading
If you want to lazy-load Smart Backspace, you can create an autocmd with an event condition. For example, using 📦 vim.pack:
vim.pack.add({"https://github.com/qwavies/smart-backspace.nvim"})
vim.api.nvim_create_autocmd({ "InsertEnter", "CmdlineEnter" }, {
once = true,
callback = function()
require("smart-backspace").setup()
end
})
Other Plugin Manager Instructions
Using lazy.nvim:
{
"qwavies/smart-backspace.nvim",
event = {"InsertEnter", "CmdlineEnter"}
}
🧩 Default configuration
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
auto_keymap = true, -- determines if keymaps are assigned for you
disabled_filetypes = { -- filetypes to automatically disable smart-backspace
"", -- no extension
"py",
"hs",
"md",
"txt",
}
})
Other Plugin Manager Instructions
Using lazy.nvim:
{
"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
auto_keymap = true, -- determines if keymaps are assigned for you
disabled_filetypes = { -- filetypes to automatically disable smart-backspace
"", -- no extension
"py",
"hs",
"md",
"txt",
}
}
}
⚡ Toggling smart-backspace
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" })
🎯 Setting your own keybinds
Keymaps are by default assigned to your <BS> and <C-BS> keys.
If you want more fine-grain control by opting out of the default keybinds, you can set turn auto_keymap off such as seen below:
require("smart-backspace").setup({
auto_keymap = false,
})
Below are the following recommended keymaps that you can change to your own discretion:
vim.keymap.set("i", "<BS>", require("smart-backspace.backspace").smart_backspace, { desc = "Smart backspace" })
vim.keymap.set("i", "<C-BS>", require("smart-backspace.backspace").regular_backspace, { desc = "Simple backspace" })
🥇 Load times
Smart-Backspace prides itself in its almost instant load times.
Compare load times against some other plugins!
👨💻 Planned Changes/Additions
- A
:SmartBackspaceTogglecommand - True compatibility with nvim-autopairs, or act as an alternative
- Delete pairs of brackets like nvim-autopairs
- Send warning when smart-backspace has been overriden by another file/plugin
- Using
<C-BS>to use as a regular backspace - User configuration for more flexibility (feel free to recommend me more configuration changes!)