Custom borders for hovering and diagnostics

This commit is contained in:
2025-08-31 16:42:42 +02:00
parent 48d9ee83af
commit 949eb06300
7 changed files with 86 additions and 23 deletions

View File

@@ -1,32 +1,33 @@
{
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
"aerial.nvim": { "branch": "master", "commit": "c7cbbad40c2065fccfd1f1863bb2c08180c0533d" },
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
"barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"fzf-lua": { "branch": "main", "commit": "bebc84e7ffc8fd86103f6ed6c590df72d524d342" },
"fzf-lua": { "branch": "main", "commit": "96dede0bca5cc24868df7c8b46b5a32b89c2f19d" },
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
"gruvbox.nvim": { "branch": "main", "commit": "12c2624287dc827edb5d72b2bc4c9619e692a554" },
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" },
"hover.nvim": { "branch": "main", "commit": "24a43e0eda924f1f32361c76ee9a1f0e8cc25650" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
"lazygit.nvim": { "branch": "main", "commit": "3c524ebec6072568064235c407195e9f9fd0cb8a" },
"lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "5e085efe67fccb13372d54331d849219662a7e93" },
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-lspconfig": { "branch": "master", "commit": "408cf07b97535825cca6f1afa908d98348712ba6" },
"nvim-lspconfig": { "branch": "master", "commit": "f8474abbe3f0cf7cf2476331313b583207787148" },
"nvim-tree.lua": { "branch": "master", "commit": "fefa335f1c8f690eb668a1efd18ee4fc6d64cd3e" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "f66cdfef5e84112045b9ebc3119fee9bddb3c687" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telekasten.nvim": { "branch": "main", "commit": "b3ac2b07f2df504bb80112fec349714086a80037" },
"telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
"typstar": { "branch": "main", "commit": "67a76bec16af7c726a77b9c3a15ef37b34967a9c" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

View File

@@ -75,6 +75,7 @@ vim.keymap.set('n', '<leader>oho', ':e ~/nixos/hosts<CR>')
vim.keymap.set('n', '<leader>ll', ':Lazy<CR>')
vim.keymap.set('n', '<leader>sw', function()
local word = vim.fn.expand("<cword>")
local replacement = vim.fn.input("Replace '" .. word .. "' with: ")
if replacement ~= "" then

View File

@@ -34,3 +34,5 @@ require("lazy").setup({
enabled = false,
},
})
require("utils.after")

View File

@@ -74,6 +74,17 @@ return {
end,
},
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
{
"hrsh7th/nvim-cmp",
dependencies = {
@@ -84,15 +95,17 @@ return {
},
config = function()
local cmp = require("cmp")
local border = "single"
local max_entries = 7
cmp.setup({
window = {
completion = cmp.config.window.bordered({
border = "rounded",
border = border,
scrollbar = false,
}),
documentation = cmp.config.window.bordered({
border = "rounded",
border = border,
scrollbar = false,
}),
},
@@ -112,8 +125,7 @@ return {
{ name = "buffer" },
{ name = "path" },
}),
performance = { max_view_entries = 25 },
performance = { max_view_entries = max_entries },
})
end
},
@@ -127,15 +139,7 @@ return {
local lspconfig = require("lspconfig")
-- Custom overwrites for servers
local server_settings = {
lua_ls = {
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
},
},
},
}
local server_settings = {}
local capabilities = require("cmp_nvim_lsp").default_capabilities()
@@ -153,10 +157,12 @@ return {
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
--vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
-- vim.keymap.set("n", "<leader>lq", vim.diagnostic.setloclist, opts)
vim.keymap.set("n", "]d", function()
vim.diagnostic.jump({count=1, float=true})
end, opts)
vim.keymap.set("n", "[d", function()
vim.diagnostic.jump({count=-1, float=true})
end, opts)
vim.keymap.set("n", "<leader>lwa", vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set("n", "<leader>lwr", vim.lsp.buf.remove_workspace_folder, opts)

View File

@@ -70,4 +70,35 @@ return {
},
config = true,
},
{
"debugloop/telescope-undo.nvim",
dependencies = {
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
},
keys = {
{
"<leader>u",
"<cmd>Telescope undo<cr>",
desc = "undo history",
},
},
opts = {
extensions = {
undo = {
side_by_side = true,
layout_strategy = "vertical",
layout_config = {
preview_height = 0.7,
},
},
},
},
config = function(_, opts)
require("telescope").setup(opts)
require("telescope").load_extension("undo")
end,
}
}

21
lua/utils/after.lua Normal file
View File

@@ -0,0 +1,21 @@
local function rounded_border()
return { '', '', '', '', '', '', '', '' }
end
-- Buffer the original fuction
local nvim_open_win = vim.api.nvim_open_win
-- Set color to a slight gray
vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'None', fg = '#a0a0a0' })
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'None' })
-- Border overwrite
vim.api.nvim_open_win = function(buf, enter, opts)
opts = opts or {}
if opts.border == nil then
opts.border = rounded_border()
end
return nvim_open_win(buf, enter, opts)
end

View File

@@ -71,9 +71,10 @@ function M.get_lsp_servers()
end
if vim.fn.executable("deno") == 1 then
table.insert(servers, "denols")
--table.insert(servers, "denols")
table.insert(servers, "ts_ls")
else
warn_once("deno", "[mason] Skipping denols (deno not found)")
warn_once("deno", "[mason] Skipping denols and tsserver (deno not found)")
end
-- Only configure zig when in local environment