Neovim plugin to save time removing indentation written in lua. Inspired by the JetBrains IDE IntelliJ's backspace functionality.
smart-backspace-showcase.mp4
- 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"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
})Other Plugin Manager Instructions
Using lazy.nvim:
{
"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",
}
})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
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!
- 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!)