Compare commits
2 Commits
fd9b13e5e7
...
3b11323f80
Author | SHA1 | Date |
---|---|---|
|
3b11323f80 | |
|
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`
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"gruvbox.nvim": { "branch": "main", "commit": "12c2624287dc827edb5d72b2bc4c9619e692a554" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" },
|
||||
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
|
|
|
@ -2,16 +2,6 @@ local M = {
|
|||
constants = {
|
||||
big_file_size_limit = 50 * 1024, -- 50KB
|
||||
},
|
||||
servers = {
|
||||
"lua_ls",
|
||||
"gopls",
|
||||
"clangd",
|
||||
"bashls",
|
||||
"pyright",
|
||||
"yamlls",
|
||||
"ts_ls",
|
||||
"rust_analyzer",
|
||||
},
|
||||
tools = {
|
||||
is_version_gte_0_11 = function()
|
||||
local version = vim.version()
|
||||
|
|
|
@ -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" })
|
||||
|
|
|
@ -2,9 +2,23 @@
|
|||
local function get_all_servers()
|
||||
local servers = {}
|
||||
|
||||
-- Use only servers from commons - single source of truth
|
||||
for _, server in pairs(require("commons").servers) do
|
||||
servers[server] = true
|
||||
-- Auto-detect LSP servers installed by Mason using mason-lspconfig
|
||||
local ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if ok then
|
||||
local installed_servers = mason_lspconfig.get_installed_servers()
|
||||
for _, server in ipairs(installed_servers) do
|
||||
servers[server] = true
|
||||
end
|
||||
end
|
||||
|
||||
-- If no servers detected, fall back to common servers that might be system-installed
|
||||
if vim.tbl_isempty(servers) then
|
||||
local fallback_servers = {
|
||||
"lua_ls",
|
||||
}
|
||||
for _, server in pairs(fallback_servers) do
|
||||
servers[server] = true
|
||||
end
|
||||
end
|
||||
|
||||
return servers
|
||||
|
|
|
@ -23,6 +23,7 @@ return {
|
|||
rust = { "rustfmt" },
|
||||
javascript = { "prettier", stop_after_first = true },
|
||||
sh = { "shfmt" },
|
||||
xml = { "xmlformat" },
|
||||
},
|
||||
format_on_save = { timeout_ms = 500, lsp_format = "fallback" },
|
||||
},
|
||||
|
|
|
@ -3,6 +3,10 @@ return {
|
|||
-- event = "InsertEnter",
|
||||
-- cond = not require("commons").tools.is_version_gte_0_11(),
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { { "saghen/blink.cmp" }, { "williamboman/mason.nvim" } },
|
||||
dependencies = {
|
||||
{ "saghen/blink.cmp" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" }
|
||||
},
|
||||
config = function() require("functions.lsp") end,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
dependencies = { "williamboman/mason.nvim" },
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
-- Automatically install LSP servers detected by mason-lspconfig
|
||||
automatic_installation = true,
|
||||
},
|
||||
}
|
|
@ -3,7 +3,16 @@ return {
|
|||
cmd = "Mason",
|
||||
build = ":MasonUpdate",
|
||||
opts_extend = { "ensure_installed" },
|
||||
opts = { ensure_installed = { "stylua", "lua-language-server", "gopls", "pyright" } },
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
-- Formatters and tools
|
||||
"stylua",
|
||||
-- LSP servers (will be auto-detected by mason-lspconfig)
|
||||
"lua-language-server",
|
||||
"gopls",
|
||||
"pyright"
|
||||
}
|
||||
},
|
||||
event = "VeryLazy",
|
||||
config = function(_, opts)
|
||||
require("mason").setup(opts)
|
||||
|
|
Loading…
Reference in New Issue