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": [
"vim",
"numbers"
],
"diagnostics.disable": [
"missing-fields"
]
}

View file

@ -4,11 +4,17 @@ return {
lazy = false,
dependencies = {
'rafamadriz/friendly-snippets',
{ 'echasnovski/mini.icons', version = '*' },
},
version = "*",
version = '*',
opts = {
enabled = function()
return not (string.find(vim.bo.filetype, "himalaya") or string.find(vim.bo.filetype, "mail"))
end,
keymap = {
preset = 'default',
['<Up>'] = {},
['<Down>'] = {},
['<C-u>'] = { 'scroll_documentation_up', 'fallback' },
['<C-d>'] = { 'scroll_documentation_down', 'fallback' },
},
@ -44,6 +50,19 @@ return {
draw = {
treesitter = { 'lsp' },
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 = {

View file

@ -1,54 +1,37 @@
return {
{
"tpope/vim-surround",
event = "VeryLazy",
},
{
"mbbill/undotree",
event = "VeryLazy",
},
{
"windwp/nvim-autopairs",
event = "VeryLazy",
config = function()
local npairs = require('nvim-autopairs')
npairs.setup({
map_cr = true,
map_bs = true,
check_ts = true,
enable_check_bracket_line = true,
ignored_next_char = "[%w]"
})
end,
'echasnovski/mini.surround',
version = '*',
opts = {}
},
{
"epwalsh/obsidian.nvim",
version = "v3.9.0",
lazy = true,
ft = "markdown",
dependencies = {
"nvim-lua/plenary.nvim",
},
opts = {
workspaces = {
{
name = "tese",
path = "~/vaults/uni/tese/",
'echasnovski/mini.pairs',
version = '*',
config = function()
vim.api.nvim_set_keymap('n', 'S', 'saiw', { silent = true })
require("mini.pairs").setup({
mappings = {
-- Prevents the action if the cursor is just before any character or next to a "\".
["("] = { action = "open", pair = "()", neigh_pattern = "[^\\][%s%)%]%}]" },
["["] = { action = "open", pair = "[]", neigh_pattern = "[^\\][%s%)%]%}]" },
["{"] = { action = "open", pair = "{}", neigh_pattern = "[^\\][%s%)%]%}]" },
-- 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 } },
},
{
name = "chronolens",
path = "~/vaults/uni/chronolens/",
},
},
completion = {
nvim_cmp = false,
min_chars = 2,
},
picker = {
name = "fzf-lua",
},
},
})
end
},
-- 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", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
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 conform = require("conform")
@ -109,9 +106,10 @@ return {
settings = {
ltex = {
language = "en-GB",
},
additionalRules = {
enablePickyRules = true,
additionalRules = {
enablePickyRules = true,
languageModel = '~/Downloads/ngrams/',
},
},
},
})
@ -122,6 +120,9 @@ return {
lspconfig["clangd"].setup({
capabilities = capabilities,
})
lspconfig["texlab"].setup({
capabilities = capabilities,
})
end,
},
{
@ -175,14 +176,22 @@ return {
filetypes = { "tex" },
config = function()
if vim.loop.os_uname().sysname == "Darwin" then
vim.g.vimtex_view_method = 'skim'
vim.g.vimtex_view_skim_sync = 1
vim.g.vimtex_view_skim_activate = 1
vim.g.vimtex_view_method = 'sioyek'
else
vim.g.vimtex_view_method = 'zathura'
end
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,
},
{

View file

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