Compare commits

..

2 commits

Author SHA1 Message Date
Casper V. Kristensen 0a4c9f2048 vim: better completions 2024-08-22 22:36:03 +02:00
Casper V. Kristensen f121ca1a61 vim: nicer floating windows 2024-08-22 22:34:37 +02:00

View file

@ -60,7 +60,7 @@
-- gitsigns or LSP diagnostics. -- gitsigns or LSP diagnostics.
vim.opt.signcolumn = "yes" vim.opt.signcolumn = "yes"
-- Send CursorHold autocommend event after 100ms (instead of 4000ms -- Send CursorHold autocommand event after 100ms (instead of 4000ms
-- by default). Used, among other things, to highlight definitions -- by default). Used, among other things, to highlight definitions
-- with treesitter faster. -- with treesitter faster.
vim.opt.updatetime = 100 vim.opt.updatetime = 100
@ -180,6 +180,10 @@
overrides = function(colors) overrides = function(colors)
local theme = colors.theme local theme = colors.theme
return { return {
-- Transparent Floating Windows
NormalFloat = { bg = "none" },
FloatBorder = { bg = "none" },
FloatTitle = { bg = "none" },
-- Less pronounced cursorline -- Less pronounced cursorline
CursorLine = { bg = theme.ui.bg_p1 }, CursorLine = { bg = theme.ui.bg_p1 },
-- More pronounced window borders -- More pronounced window borders
@ -317,12 +321,8 @@
'' ''
local cmp = require("cmp") local cmp = require("cmp")
cmp.setup({ cmp.setup({
snippet = { experimental = {
-- Configuring a snippet engine is required. Configure ghost_text = true,
-- neovom's native one.
expand = function(args)
vim.snippet.expand(args.body)
end,
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
-- Use CTRL-{JK} to navigate and CTRL-L to confirm like -- Use CTRL-{JK} to navigate and CTRL-L to confirm like
@ -330,7 +330,9 @@
["<C-j>"] = cmp.mapping.select_next_item(), ["<C-j>"] = cmp.mapping.select_next_item(),
["<C-k>"] = cmp.mapping.select_prev_item(), ["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-l>"] = cmp.mapping.confirm({ select = true }), ["<C-l>"] = cmp.mapping.confirm({ select = true }),
-- Scroll documentatiion -- Also confirm with <Tab>
["<Tab>"] = cmp.mapping.confirm({ select = true }),
-- Scroll documentation
["<C-u>"] = cmp.mapping.scroll_docs(-4), ["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4), ["<C-d>"] = cmp.mapping.scroll_docs(4),
-- Close completion menu -- Close completion menu
@ -342,7 +344,11 @@
}), }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
}) }),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
}) })
-- Add parentheses after selecting function or method item (nvim-autopairs). -- Add parentheses after selecting function or method item (nvim-autopairs).