chore(nvim): some better cmp stuff

This commit is contained in:
Afonso Franco 2025-02-05 17:00:42 +00:00
parent e0b9a10150
commit 1c88268a12
Signed by: afonso
SSH key fingerprint: SHA256:gkVPzsQQJzqi21ntQBV6pXTx4bYI53rFGI4XtvCpwd4
5 changed files with 69 additions and 54 deletions

View file

@ -4,5 +4,8 @@
"diagnostics.globals": [ "diagnostics.globals": [
"vim", "vim",
"numbers" "numbers"
],
"diagnostics.disable": [
"missing-fields"
] ]
} }

View file

@ -4,11 +4,17 @@ return {
lazy = false, lazy = false,
dependencies = { dependencies = {
'rafamadriz/friendly-snippets', 'rafamadriz/friendly-snippets',
{ 'echasnovski/mini.icons', version = '*' },
}, },
version = "*", version = '*',
opts = { opts = {
enabled = function()
return not (string.find(vim.bo.filetype, "himalaya") or string.find(vim.bo.filetype, "mail"))
end,
keymap = { keymap = {
preset = 'default', preset = 'default',
['<Up>'] = {},
['<Down>'] = {},
['<C-u>'] = { 'scroll_documentation_up', 'fallback' }, ['<C-u>'] = { 'scroll_documentation_up', 'fallback' },
['<C-d>'] = { 'scroll_documentation_down', 'fallback' }, ['<C-d>'] = { 'scroll_documentation_down', 'fallback' },
}, },
@ -44,6 +50,19 @@ return {
draw = { draw = {
treesitter = { 'lsp' }, treesitter = { 'lsp' },
columns = { { 'kind_icon' }, { 'label' } }, columns = { { 'kind_icon' }, { 'label' } },
components = {
kind_icon = {
ellipsis = false,
text = function(ctx)
local kind_icon, _, _ = require('mini.icons').get('lsp', ctx.kind)
return kind_icon
end,
highlight = function(ctx)
local _, hl, _ = require('mini.icons').get('lsp', ctx.kind)
return hl
end,
}
}
} }
}, },
documentation = { documentation = {

View file

@ -1,54 +1,37 @@
return { return {
{
"tpope/vim-surround",
event = "VeryLazy",
},
{ {
"mbbill/undotree", "mbbill/undotree",
event = "VeryLazy", event = "VeryLazy",
}, },
{ {
"windwp/nvim-autopairs", 'echasnovski/mini.surround',
event = "VeryLazy", version = '*',
opts = {}
},
{
'echasnovski/mini.pairs',
version = '*',
config = function() config = function()
local npairs = require('nvim-autopairs') vim.api.nvim_set_keymap('n', 'S', 'saiw', { silent = true })
require("mini.pairs").setup({
npairs.setup({ mappings = {
map_cr = true, -- Prevents the action if the cursor is just before any character or next to a "\".
map_bs = true, ["("] = { action = "open", pair = "()", neigh_pattern = "[^\\][%s%)%]%}]" },
check_ts = true, ["["] = { action = "open", pair = "[]", neigh_pattern = "[^\\][%s%)%]%}]" },
enable_check_bracket_line = true, ["{"] = { action = "open", pair = "{}", neigh_pattern = "[^\\][%s%)%]%}]" },
ignored_next_char = "[%w]" -- This is default (prevents the action if the cursor is just next to a "\").
[")"] = { action = "close", pair = "()", neigh_pattern = "[^\\]." },
["]"] = { action = "close", pair = "[]", neigh_pattern = "[^\\]." },
["}"] = { action = "close", pair = "{}", neigh_pattern = "[^\\]." },
-- Prevents the action if the cursor is just before or next to any character.
['"'] = { action = "closeopen", pair = '""', neigh_pattern = "[^%w][^%w]", register = { cr = false } },
["'"] = { action = "closeopen", pair = "''", neigh_pattern = "[^%w][^%w]", register = { cr = false } },
["`"] = { action = "closeopen", pair = "``", neigh_pattern = "[^%w][^%w]", register = { cr = false } },
},
}) })
end, end
},
{
"epwalsh/obsidian.nvim",
version = "v3.9.0",
lazy = true,
ft = "markdown",
dependencies = {
"nvim-lua/plenary.nvim",
},
opts = {
workspaces = {
{
name = "tese",
path = "~/vaults/uni/tese/",
},
{
name = "chronolens",
path = "~/vaults/uni/chronolens/",
},
},
completion = {
nvim_cmp = false,
min_chars = 2,
},
picker = {
name = "fzf-lua",
}, },
}, -- Adds S in regex replace and change camelCase to snake_case, etc
}, "tpope/vim-abolish"
} }

View file

@ -46,9 +46,6 @@ return {
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}), group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev) callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
local fzflua = require("fzf-lua") local fzflua = require("fzf-lua")
local conform = require("conform") local conform = require("conform")
@ -109,9 +106,10 @@ return {
settings = { settings = {
ltex = { ltex = {
language = "en-GB", language = "en-GB",
},
additionalRules = { additionalRules = {
enablePickyRules = true, enablePickyRules = true,
languageModel = '~/Downloads/ngrams/',
},
}, },
}, },
}) })
@ -122,6 +120,9 @@ return {
lspconfig["clangd"].setup({ lspconfig["clangd"].setup({
capabilities = capabilities, capabilities = capabilities,
}) })
lspconfig["texlab"].setup({
capabilities = capabilities,
})
end, end,
}, },
{ {
@ -175,14 +176,22 @@ return {
filetypes = { "tex" }, filetypes = { "tex" },
config = function() config = function()
if vim.loop.os_uname().sysname == "Darwin" then if vim.loop.os_uname().sysname == "Darwin" then
vim.g.vimtex_view_method = 'skim' vim.g.vimtex_view_method = 'sioyek'
vim.g.vimtex_view_skim_sync = 1
vim.g.vimtex_view_skim_activate = 1
else else
vim.g.vimtex_view_method = 'zathura' vim.g.vimtex_view_method = 'zathura'
end end
vim.g.vimtex_compiler_method = 'latexmk' vim.g.vimtex_compiler_method = 'latexmk'
vim.g.vimtex_view_automatic = 0 vim.g.vimtex_compiler_latexmk = {
out_dir = 'build',
options = {
"-verbose",
"-shell-escape",
"-file-line-error",
"-synctex=1",
"-interaction=nonstopmode",
}
}
vim.g.vimtex_view_automatic = 1
end, end,
}, },
{ {

View file

@ -46,4 +46,5 @@ return {
end end
}, },
"tpope/vim-fugitive", "tpope/vim-fugitive",
"pimalaya/himalaya-vim"
} }