Skip to content

Commit 7e7b5ae

Browse files
committed
Restructure nvim config for 0.11
1 parent b824e62 commit 7e7b5ae

File tree

3 files changed

+109
-85
lines changed

3 files changed

+109
-85
lines changed

nvim/.config/nvim/after/plugin/lsp.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ vim.api.nvim_create_autocmd("LspAttach", {
1313
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = desc })
1414
end
1515

16+
-- Future-proof for removing cmp-nvim-lsp by enabling lsp features
17+
vim.lsp.completion.enable(true, event.data.client_id, event.buf, { autotrigger = false })
18+
1619
local telescope = require("telescope.builtin")
1720

1821
map("gd", telescope.lsp_definitions, "[G]oto [D]efinitions")
@@ -28,6 +31,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
2831

2932
map("K", vim.lsp.buf.hover, "Quick documentation")
3033

34+
-- Common in other editors
3135
map("<F2>", vim.lsp.buf.rename, "Rename")
3236
map("<F3>", function()
3337
vim.lsp.buf.format({ async = true })
@@ -67,15 +71,10 @@ cmp.setup({
6771
}),
6872
preselect = "item",
6973
completion = {
70-
completeopt = "menu,menuone,noinsert",
74+
completeopt = "menu,menuone,noinsert,fuzzy",
7175
},
7276
})
7377

74-
-- Borders for help windows
75-
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
76-
77-
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
78-
7978
-- Vim scripting
8079
require("lspconfig").lua_ls.setup({})
8180

nvim/.config/nvim/init.lua

Lines changed: 93 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,12 @@
1-
-- Install lazy.nvim automatically if not present
2-
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
3-
if not vim.uv.fs_stat(lazypath) then
4-
vim.fn.system({
5-
"git",
6-
"clone",
7-
"--filter=blob:none",
8-
"--branch=stable",
9-
"https://github.com/folke/lazy.nvim.git",
10-
lazypath,
11-
})
12-
end
13-
vim.opt.rtp:prepend(lazypath)
1+
-------------------
2+
-- Configuration --
3+
-------------------
144

155
-- Set leader before loading lazy.nvim to ensure correct mappings
166
vim.g.mapleader = " "
177
-- Prevent leader being overriden by a keybind
188
vim.keymap.set("n", "<Space>", "<Nop>", { noremap = true, silent = true })
199

20-
-------------
21-
-- Plugins --
22-
-------------
23-
24-
require("lazy").setup({
25-
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
26-
{ "hrsh7th/nvim-cmp", dependencies = { "hrsh7th/cmp-nvim-lsp" } },
27-
{ "neovim/nvim-lspconfig", dependencies = { "hrsh7th/cmp-nvim-lsp" } },
28-
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
29-
{ "stevearc/conform.nvim" },
30-
{ "nvim-tree/nvim-web-devicons", lazy = true },
31-
{
32-
"nvim-lualine/lualine.nvim",
33-
dependencies = { "nvim-tree/nvim-web-devicons" },
34-
opts = {
35-
options = {
36-
theme = "catppuccin",
37-
},
38-
},
39-
},
40-
{
41-
"nvim-telescope/telescope.nvim",
42-
tag = "0.1.8",
43-
dependencies = { "nvim-lua/plenary.nvim" },
44-
opts = {
45-
extensions = {
46-
file_browser = {
47-
collapse_dirs = true,
48-
grouped = true,
49-
hijack_netrw = true,
50-
display_stat = false,
51-
},
52-
},
53-
},
54-
},
55-
{
56-
"nvim-telescope/telescope-file-browser.nvim",
57-
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
58-
},
59-
{
60-
"folke/which-key.nvim",
61-
event = "VeryLazy",
62-
keys = {
63-
{
64-
"<leader>?",
65-
function()
66-
require("which-key").show({ global = false })
67-
end,
68-
desc = "Buffer Local Keymaps (which-key)",
69-
},
70-
},
71-
},
72-
})
73-
74-
-------------------
75-
-- Configuration --
76-
-------------------
77-
7810
-- General
7911
vim.opt.undofile = true -- Enable persistent undo
8012

@@ -85,8 +17,11 @@ end)
8517

8618
-- Completion
8719
vim.opt.complete:append("kspell") -- Complete with dictionary
20+
vim.opt.completeopt:append("menuone") -- Show popup with single item to show more info
21+
vim.opt.completeopt:append("fuzzy") -- Enable fuzzy completion
8822
vim.opt.matchpairs:append("<:>") -- Match XML
8923
vim.opt.updatetime = 250 -- Decreases delay before showing plugin completions
24+
vim.opt.winborder = "rounded" -- Borders for help windows
9025

9126
-- Formatting
9227
vim.opt.expandtab = true -- Always use spaces
@@ -113,6 +48,9 @@ vim.opt.inccommand = "split" -- Preview substitutions
11348
vim.opt.cursorline = true -- Highlight current line (increases redraw time)
11449
vim.opt.signcolumn = "yes" -- Reserve sign space (Git, LSP) in gutter to avoid layout shift
11550

51+
-- Diagnostic
52+
vim.diagnostic.config({ virtual_text = true })
53+
11654
-- netrw
11755
vim.g.netrw_banner = 0 -- Disable netrw banner
11856
vim.g.netrw_winsize = 25 -- Set netrw window size to 25%
@@ -164,3 +102,87 @@ vim.keymap.set("n", "<F8>", ":setlocal spell! spelllang=de_at spell?<CR>", {
164102

165103
-- Command to save file with sudo
166104
vim.api.nvim_create_user_command("W", "w !sudo tee > /dev/null %", {})
105+
106+
-------------
107+
-- Plugins --
108+
-------------
109+
110+
-- Install lazy.nvim automatically if not present
111+
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
112+
if not vim.uv.fs_stat(lazypath) then
113+
vim.fn.system({
114+
"git",
115+
"clone",
116+
"--filter=blob:none",
117+
"--branch=stable",
118+
"https://github.com/folke/lazy.nvim.git",
119+
lazypath,
120+
})
121+
end
122+
vim.opt.rtp:prepend(lazypath)
123+
124+
require("lazy").setup({
125+
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
126+
{ "neovim/nvim-lspconfig", dependencies = { "hrsh7th/cmp-nvim-lsp" } },
127+
{
128+
"hrsh7th/nvim-cmp",
129+
dependencies = {
130+
"hrsh7th/cmp-nvim-lsp",
131+
"hrsh7th/cmp-nvim-lsp-signature-help",
132+
"hrsh7th/cmp-path",
133+
},
134+
},
135+
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
136+
{ "stevearc/conform.nvim" },
137+
{ "nvim-tree/nvim-web-devicons", lazy = true },
138+
{
139+
"nvim-lualine/lualine.nvim",
140+
dependencies = { "nvim-tree/nvim-web-devicons" },
141+
opts = {
142+
options = {
143+
theme = "catppuccin",
144+
},
145+
},
146+
},
147+
{
148+
"nvim-telescope/telescope.nvim",
149+
tag = "0.1.8",
150+
dependencies = { "nvim-lua/plenary.nvim" },
151+
opts = {
152+
extensions = {
153+
file_browser = {
154+
collapse_dirs = true,
155+
grouped = true,
156+
hidden = { file_browser = true, folder_browser = true },
157+
hijack_netrw = true,
158+
display_stat = false,
159+
},
160+
},
161+
},
162+
},
163+
{
164+
"nvim-telescope/telescope-file-browser.nvim",
165+
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
166+
},
167+
{
168+
"folke/todo-comments.nvim",
169+
dependencies = { "nvim-lua/plenary.nvim" },
170+
keys = {
171+
{ "fc", "<cmd>TodoTelescope<cr>", desc = "[F]ind [C]omments" },
172+
},
173+
opts = {},
174+
},
175+
{
176+
"folke/which-key.nvim",
177+
event = "VeryLazy",
178+
keys = {
179+
{
180+
"<leader>?",
181+
function()
182+
require("which-key").show({ global = false })
183+
end,
184+
desc = "Buffer Local Keymaps (which-key)",
185+
},
186+
},
187+
},
188+
})

nvim/.config/nvim/lazy-lock.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{
2-
"catppuccin": { "branch": "main", "commit": "4bb938bbba41d306db18bf0eb0633a5f28fd7ba0" },
2+
"catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
33
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
4-
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
5-
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
6-
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
7-
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
8-
"nvim-lspconfig": { "branch": "master", "commit": "6b63bdf2399b9bedf93297d98419550523a9ad68" },
9-
"nvim-treesitter": { "branch": "master", "commit": "f2bd62c6568de54ca1b8fb0a8de04a41442934cb" },
10-
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
4+
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
5+
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
6+
"conform.nvim": { "branch": "master", "commit": "f9ef25a7ef00267b7d13bfc00b0dea22d78702d5" },
7+
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
8+
"lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" },
9+
"nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" },
10+
"nvim-lspconfig": { "branch": "master", "commit": "85e0dd26b710e834a105d679200d01e326a3d2b0" },
11+
"nvim-treesitter": { "branch": "master", "commit": "a3315b8c7f0f1ddaa30b24bcc0af0d31024dfb6a" },
12+
"nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" },
1113
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
1214
"telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" },
1315
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
16+
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
1417
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
1518
}

0 commit comments

Comments
 (0)