neovim bumps

This commit is contained in:
Ben Kyd
2025-06-10 14:08:57 +01:00
parent cdbffbf1be
commit 6aa6efd1c9
5 changed files with 140 additions and 138 deletions

View File

@@ -1,18 +1,9 @@
local lsp = require('lsp-zero')
local lsp = require('lsp-zero');
local cmp = require('cmp')
local luasnip = require('luasnip')
local dap = require('dap')
local dapui = require('dapui')
require('mason').setup({})
require('mason-nvim-dap').setup({
ensure_installed = {
'cpptools',
'cppdbg',
},
})
require('mason-lspconfig').setup({})
dap.configurations = {
cpp = {
{
@@ -107,52 +98,22 @@ end)
vim.fn.sign_define('DapBreakpoint',{ text ='🔴', texthl ='', linehl ='', numhl =''})
vim.fn.sign_define('DapStopped',{ text ='▶️', texthl ='', linehl ='', numhl =''})
lsp.preset({
name = 'recommended',
})
lsp.ensure_installed({
'tsserver',
'clangd',
})
lsp.configure('clangd', {
capabilities = {
offsetEncoding = { "utf-16" }
}
})
local cmp_mode = { behavior = cmp.SelectBehavior.Replace }
local cmp_mappings = lsp.defaults.cmp_mappings({
["<Tab>"] = cmp.mapping(function(fallback)
if (cmp.visible()) then
cmp.select_next_item(cmp_mode)
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
cmp.mapping.select_next_item(cmp_mode)
end, { 'i', 's' }),
["<S-Tab>"] = cmp.mapping.select_prev_item(cmp_mode),
})
-- lsp.setup_nvim_cmp({
-- preselect = require('cmp').PreselectMode.None,
-- completion = {
-- completeopt = 'menu,menuone,noinsert,noselect'
-- },
-- mapping = cmp_mappings,
-- })
-- unmap arrow keys
cmp_mappings["<Up>"] = nil
cmp_mappings["<Down>"] = nil
lsp.setup_nvim_cmp({
preselect = require('cmp').PreselectMode.None,
completion = {
completeopt = 'menu,menuone,noinsert,noselect'
},
mapping = cmp_mappings,
})
lsp.on_attach(function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap = true, silent = true, buffer = bufnr }
lsp.on_attach(function(client, bufnr)
local opts = { buffer = bufnr }
vim.keymap.set('n', 'gD', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.keymap.set('n', 'gT', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
vim.keymap.set('n', 'gR', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
@@ -184,49 +145,9 @@ lsp.on_attach(function(_, bufnr)
vim.keymap.set('n', 'gw', '<Cmd>StripWhitespace<CR>', opts)
end)
local rust_lsp = lsp.build_options('rust_analyzer', {
--cmd = { "/home/benk/programming/rust-analyzer/target/release/rust-analyzer" },
})
require('rust-tools').setup({
server = rust_lsp,
tools = {
inlay_hints = {
auto = true,
show_parameter_hints = true,
parameter_hints_prefix = "",
other_hints_prefix = "",
}
},
})
lsp.setup()
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
lsp.set_preferences({
suggest_lsp_servers = false,
sign_icons = {
error = '',
warn = '',
hint = '',
info = ''
}
})
local cmp_kinds = {
Text = "",
Method = "",
@@ -255,7 +176,21 @@ local cmp_kinds = {
TypeParameter = ""
}
local cmp_config = {
require('mason').setup({})
require('mason-lspconfig').setup({
handlers = {
lsp.default_setup,
},
})
cmp.setup({
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
{ name = 'path' },
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered()
@@ -295,11 +230,45 @@ local cmp_config = {
performance = {
max_view_entries = 20,
},
}
mapping = {
["<Tab>"] = cmp.mapping(function(fallback)
if (cmp.visible()) then
cmp.select_next_item(cmp_mode)
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
cmp.mapping.select_next_item(cmp_mode)
end, { 'i', 's' }),
["<S-Tab>"] = cmp.mapping.select_prev_item(cmp_mode),
["<Up>"] = nil,
["<Down>"] = nil
},
})
cmp.setup(cmp_config)
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
vim.api.nvim_set_hl(0, "CmpItemMenu", { italic = true })
vim.diagnostic.config({
virtual_text = true
virtual_text = true,
signs = {
[vim.diagnostic.severity.ERROR] = '',
[vim.diagnostic.severity.WARN] = '',
[vim.diagnostic.severity.HINT] = '',
[vim.diagnostic.severity.INFO] = ''
}
})

View File

@@ -1,10 +1,15 @@
require('gitsigns').setup {
keymaps = {
-- Default keymap options
noremap = true,
buffer = true,
['n <leader>gb'] = '<cmd>lua require"gitsigns".blame_line()<CR>',
},
on_attach = function(bufnr)
local gitsigns = require('gitsigns')
local function localmap(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
localmap('n', '<leader>gb', gitsigns.toggle_current_line_blame)
end,
signs = {
add = { text = '' },
change = { text = '' },
@@ -42,8 +47,5 @@ require('gitsigns').setup {
row = 0,
col = 1
},
yadm = {
enable = false
},
}

View File

@@ -1,8 +1,19 @@
require'nvim-treesitter.configs'.setup {
-- will install treesitter for all available languages
ensure_installed = 'all',
ignore_install = {'haskell'}, -- broken
highlight = {
enable = true
}
ensure_installed = {
"c",
"cpp",
"lua",
"python",
"javascript",
"typescript",
"html",
"css",
"bash",
"json",
"yaml",
"markdown",
},
highlight = {
enable = true
}
}

View File

@@ -5,6 +5,22 @@ return {
priority = 1000,
config = function()
vim.cmd('colorscheme kanagawa')
require('kanagawa').setup({
transparent = true,
undercurl = true,
commentStyle = { italic = true },
keywordsStyle = { italic = true },
statementStyle = { bold = true },
overrides = function(colors)
return {
Normal = { bg = 'none' },
NormalFloat = { bg = 'none' },
FloatBorder = { fg = colors.palette.sumiInk4, bg = 'none' },
CursorLine = { bg = colors.palette.sumiInk1 },
CursorLineNr = { fg = colors.palette.sumiInk6, bold = true },
}
end
})
end
},
-- QUALITY OF LIFE INTEGRATIONS
@@ -12,31 +28,38 @@ return {
'tpope/vim-fugitive',
},
{
'tzachar/local-highlight.nvim',
config = function()
require('local-highlight').setup({
hlgroup = 'Search',
cw_hlgroup = nil,
-- Whether to display highlights in INSERT mode or not
insert_mode = true,
min_match_len = 1,
max_match_len = math.huge,
highlight_single_match = true,
'hat0uma/csvview.nvim',
lazy = true,
},
{
'folke/snacks.nvim'
},
{
'tzachar/local-highlight.nvim',
config = function()
require('local-highlight').setup({
hlgroup = 'Search',
cw_hlgroup = nil,
-- Whether to display highlights in INSERT mode or not
insert_mode = true,
min_match_len = 1,
max_match_len = math.huge,
highlight_single_match = true,
})
vim.api.nvim_create_autocmd('BufRead', {
pattern = {'*.*'},
callback = function(data)
require('local-highlight').attach(data.buf)
end
})
end
},
vim.api.nvim_create_autocmd('BufRead', {
pattern = {'*.*'},
callback = function(data)
require('local-highlight').attach(data.buf)
end
})
end
},
{
'miversen33/sunglasses.nvim',
config = function()
require('sunglasses').setup({
filter_type = "SHADE",
filter_percent = .20
filter_type = "SHADE",
filter_percent = .20
})
end
},
@@ -49,11 +72,11 @@ return {
},
{
-- Window picker
"yorickpeterse/nvim-window",
keys = {
{ "<C-w>e", "<cmd>lua require('nvim-window').pick()<cr>", desc = "nvim-window: Jump to window" },
},
config = true,
"yorickpeterse/nvim-window",
keys = {
{ "<C-w>e", "<cmd>lua require('nvim-window').pick()<cr>", desc = "nvim-window: Jump to window" },
},
config = true,
},
{
-- colourise colour codes
@@ -265,14 +288,10 @@ return {
},
{
"L3MON4D3/LuaSnip",
-- follow latest release.
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
build = "make install_jsregexp"
},
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v1.x',
dependencies = {
-- LSP Support
{ 'nvim-neotest/nvim-nio' },

View File

@@ -1,3 +1,4 @@
"testg
"augroup vimrc
"autocmd!
"autocmd BufWritePost plugins.lua PackerCompile