feat: <leader>q exit
parent
fd9b13e5e7
commit
6efcb93d3d
|
@ -19,6 +19,7 @@ This is a modern Neovim configuration built around the lazy.nvim plugin manager.
|
|||
- LSP servers are defined in `commons.servers` array
|
||||
- Server-specific settings live in `lua/lsp/{server}.lua` files
|
||||
- Uses blink.cmp for completion capabilities
|
||||
- LSP servers supported: lua_ls, gopls, clangd, bashls, pyright, yamlls, ts_ls, rust_analyzer
|
||||
- Mason.nvim auto-installs: stylua, lua-language-server, gopls, pyright
|
||||
|
||||
### Plugin Architecture
|
||||
|
@ -28,8 +29,9 @@ This is a modern Neovim configuration built around the lazy.nvim plugin manager.
|
|||
|
||||
### Formatting
|
||||
- Conform.nvim handles formatting with `<leader>ff` keybind
|
||||
- Format-on-save enabled with 500ms timeout
|
||||
- Format-on-save enabled with 500ms timeout, format command uses 3000ms timeout
|
||||
- Configured formatters: stylua (Lua), black (Python), rustfmt (Rust), prettier (JS), shfmt (shell)
|
||||
- Stylua configured with `--collapse-simple-statement Always`
|
||||
|
||||
## Common Development Tasks
|
||||
|
||||
|
@ -46,10 +48,11 @@ This is a modern Neovim configuration built around the lazy.nvim plugin manager.
|
|||
### Key Mappings
|
||||
- Leader key: `<Space>`
|
||||
- Save: `<leader>s`
|
||||
- Buffer delete: `<leader>q`
|
||||
- Smart buffer delete: `<leader>q` (switches to next buffer, or opens explorer if last buffer)
|
||||
- Quit: `<leader>qq` (force quit: `<leader>qqq`)
|
||||
- Format code: `<leader>ff`
|
||||
- Toggle comment: `mm` (normal/visual mode)
|
||||
- Show diagnostics: `<leader>d` (uses Snacks picker)
|
||||
|
||||
### File Structure Conventions
|
||||
- Plugin configs: `lua/plugins/{plugin-name}.lua`
|
||||
|
|
|
@ -1,9 +1,37 @@
|
|||
local map = vim.keymap.set
|
||||
map("n", "<leader>s", ":w<CR>", {})
|
||||
map("n", "<leader>q", ":bdelete<CR>", {})
|
||||
map("n", "<leader>q", function()
|
||||
local buffers = vim.fn.getbufinfo({ buflisted = 1 })
|
||||
if #buffers <= 1 then
|
||||
-- Check if explorer is already open
|
||||
local explorer_win = nil
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
local ft = vim.api.nvim_get_option_value("filetype", { buf = buf })
|
||||
if ft == "snacks_picker_list" then
|
||||
explorer_win = win
|
||||
break
|
||||
end
|
||||
end
|
||||
vim.cmd("bdelete")
|
||||
if explorer_win then
|
||||
-- Explorer is already open, just focus it
|
||||
vim.api.nvim_set_current_win(explorer_win)
|
||||
else
|
||||
-- Explorer not open, open it
|
||||
Snacks.explorer()
|
||||
end
|
||||
else
|
||||
vim.cmd("bnext")
|
||||
vim.cmd("bdelete #")
|
||||
end
|
||||
end, { desc = "Smart buffer delete" })
|
||||
map("n", "<leader>qq", ":q<CR>'", {})
|
||||
map("n", "<leader>qqq", ":qa!<CR>", {})
|
||||
map("n", "<leader>s", ":w<CR>", {})
|
||||
|
||||
map("n", "mm", "gcc", { desc = "Toggle comment", remap = true })
|
||||
map("v", "mm", "gc", { desc = "Toggle comment", remap = true })
|
||||
|
||||
-- Diagnostics
|
||||
map("n", "<leader>d", function() Snacks.picker.diagnostics() end, { desc = "Show Diagnostics" })
|
||||
|
|
Loading…
Reference in New Issue