Align Lazygit configuration
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
require("config.lazy")
|
||||
require("user.utils")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
|
||||
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"catppuccin": { "branch": "main", "commit": "76a8d0515024cc55d8bd26fc13f1af88faef3ebf" },
|
||||
"catppuccin": { "branch": "main", "commit": "3aaf3ab60221bca8edb1354e41bd514a22c89de2" },
|
||||
"clangd_extensions.nvim": { "branch": "main", "commit": "b67cc417d9020fb4b83d46662351b4d16894905e" },
|
||||
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
|
||||
"dial.nvim": { "branch": "master", "commit": "78bd73aaf2b9c8f80715a878feaf56f7ffa8b6ff" },
|
||||
@@ -54,5 +54,6 @@
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
|
||||
"venv-selector.nvim": { "branch": "regexp", "commit": "c2d888f416c3572c27ab9ef936443ce7cd98762b" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
|
||||
"yazi.nvim": { "branch": "main", "commit": "74460dc4533bde424983702f1257df420455eebe" }
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ autocmd({ "BufWinLeave", "BufWritePost", "WinLeave" }, {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd("BufWinEnter", {
|
||||
desc = "Try to load file view if available and enable view saving for real files",
|
||||
group = view_group,
|
||||
|
||||
@@ -17,3 +17,29 @@ map("n", "<leader>p", [["+p]], { noremap = true, silent = true, desc = "Paste fr
|
||||
|
||||
-- Markdown menu
|
||||
map("n", "<leader>M", [["+M]], { noremap = true, silent = true, desc = "Markdown" })
|
||||
|
||||
vim.keymap.set("n", "<leader>cc", function()
|
||||
local file1 = vim.fn.expand("%")
|
||||
|
||||
local project_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
if project_root == "" then
|
||||
project_root = vim.fn.getcwd()
|
||||
end
|
||||
|
||||
require("telescope.builtin").find_files({
|
||||
prompt_title = "Compare with...",
|
||||
cwd = project_root,
|
||||
hidden = true,
|
||||
follow = true,
|
||||
attach_mappings = function(_, map)
|
||||
map("i", "<CR>", function(prompt_bufnr)
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local file2 = action_state.get_selected_entry().path
|
||||
actions.close(prompt_bufnr)
|
||||
require("user.utils").meld_diff(file1, file2)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
end, { desc = "Compare with" })
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
-- Encoding
|
||||
opt.encoding = "utf-8"
|
||||
opt.fileencoding = "utf-8"
|
||||
|
||||
-- Line numbers
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"go",
|
||||
"gomod",
|
||||
@@ -9,6 +10,7 @@ require("nvim-treesitter.configs").setup({
|
||||
"lua",
|
||||
"markdown",
|
||||
"python",
|
||||
"org",
|
||||
"zig",
|
||||
},
|
||||
highlight = {
|
||||
|
||||
96
lazyvim/.config/nvim/lua/plugins/cmp.lua
Normal file
96
lazyvim/.config/nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
return {
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
ensure_installed = {
|
||||
-- LSP servers
|
||||
"clangd", -- C / C++
|
||||
"gopls", -- Go
|
||||
"python-lsp-server", -- Python
|
||||
"bash-language-server", -- Bash
|
||||
"zls", -- Zig
|
||||
"lua-language-server", -- Lua
|
||||
-- Formatters / Linters
|
||||
"stylua", -- Lua formatter
|
||||
"shfmt", -- Shell formatter
|
||||
"black", -- Python formatter
|
||||
"clang-format", -- C/C++ formatter
|
||||
"goimports", -- Go formatter
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"onsails/lspkind.nvim", -- icone carine nel completamento
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- Carica snippet
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
opts.snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
}
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
})
|
||||
|
||||
opts.sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
})
|
||||
|
||||
opts.formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
}
|
||||
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -16,7 +16,7 @@ return {
|
||||
null_ls.builtins.formatting.goimports,
|
||||
|
||||
-- Zig
|
||||
null_ls.builtins.formatting.zigfmt,
|
||||
-- null_ls.builtins.formatting.zigfmt,
|
||||
|
||||
-- Lua
|
||||
null_ls.builtins.formatting.stylua.with({
|
||||
@@ -24,9 +24,9 @@ return {
|
||||
"--indent-type",
|
||||
"Spaces",
|
||||
"--indent-width",
|
||||
"4",
|
||||
"2",
|
||||
"--column-width",
|
||||
"100",
|
||||
"120",
|
||||
},
|
||||
}),
|
||||
|
||||
|
||||
@@ -21,15 +21,12 @@ return {
|
||||
lspconfig.gopls.setup({})
|
||||
lspconfig.bashls.setup({})
|
||||
lspconfig.zls.setup({})
|
||||
-- src: https://docs.astral.sh/ruff/editors/setup/#neovim
|
||||
lspconfig.ruff.setup({})
|
||||
lspconfig.pylsp.setup({
|
||||
settings = {
|
||||
-- configure plugins in pylsp
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pyflakes = { enabled = false },
|
||||
pylint = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
},
|
||||
},
|
||||
@@ -1,17 +0,0 @@
|
||||
return {
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
dependencies = {
|
||||
"mason-org/mason.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash-language-server",
|
||||
"clangd",
|
||||
"gopls",
|
||||
"lua_ls",
|
||||
"pylsp",
|
||||
"zls",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
return {
|
||||
"mason-org/mason.nvim",
|
||||
opts = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
4
lazyvim/.config/nvim/lua/plugins/neo-tree.lua
Normal file
4
lazyvim/.config/nvim/lua/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
enabled = false,
|
||||
}
|
||||
8
lazyvim/.config/nvim/lua/plugins/yazi.lua
Normal file
8
lazyvim/.config/nvim/lua/plugins/yazi.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"mikavilpas/yazi.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>e", "<cmd>Yazi<cr>", desc = "Open Yazi" },
|
||||
},
|
||||
}
|
||||
15
lazyvim/.config/nvim/lua/user/utils.lua
Normal file
15
lazyvim/.config/nvim/lua/user/utils.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
-- This file contains all custom functions for integrate external tools.
|
||||
|
||||
-- Meld for comparing and merging files
|
||||
local M = {}
|
||||
|
||||
function M.meld_diff(file1, file2)
|
||||
if not file1 or not file2 then
|
||||
print("Usage: :lua require'user.utils'.meld_diff('file1', 'file2')")
|
||||
return
|
||||
end
|
||||
local cmd = string.format("meld '%s' '%s' &", file1, file2)
|
||||
os.execute(cmd)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user