custom vim to the git

This commit is contained in:
Itsigo
2024-04-12 16:19:46 +02:00
commit dbbf6c9dd8
18 changed files with 406 additions and 0 deletions

2
init.lua Normal file
View File

@@ -0,0 +1,2 @@
require("itsigo")

27
lazy-lock.json Normal file
View File

@@ -0,0 +1,27 @@
{
"LuaSnip": { "branch": "master", "commit": "825a61bad1d60d917a7962d73cf3c683f4e0407e" },
"catppuccin": { "branch": "main", "commit": "aebe43db9cb26e1c70fc5b2fd4158169c405e720" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
"lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" },
"lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" },
"none-ls.nvim": { "branch": "main", "commit": "dca7ddec321a102ec9e792b1b29193702aff5fbb" },
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
"nvim-lspconfig": { "branch": "master", "commit": "96e5711040df23583591391ce49e556b8cd248d8" },
"nvim-treesitter": { "branch": "master", "commit": "1b050206e490a4146cdf25c7b38969c1711b5620" },
"nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" },
"oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
"plenary": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
"telescope.nvim": { "branch": "master", "commit": "d26b666b45e5dde23332e4bde1227677f2d92e31" }
}

25
lua/itsigo/init.lua Normal file
View File

@@ -0,0 +1,25 @@
require("itsigo.remap")
require("itsigo.set")
require("itsigo.lazy")
local autocmd = vim.api.nvim_create_autocmd
function R(name)
require("plenary.reload").reload_module(name)
end
autocmd({"BufWritePre"}, {
pattern = "*",
command = [[%s/\s\+$//e]],
})
autocmd('LspAttach', {
callback = function (e)
local opts = { buffer = e.buf }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
end
})

14
lua/itsigo/lazy.lua Normal file
View File

@@ -0,0 +1,14 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("itsigo.plugins")

View File

@@ -0,0 +1,26 @@
return {
"lukas-reineke/indent-blankline.nvim",
opts = {
indent = {
char = "",
tab_char = "",
},
scope = { enabled = false },
exclude = {
filetypes = {
"help",
"alpha",
"dashboard",
-- "neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
},
},
main = "ibl",
}

View File

@@ -0,0 +1,8 @@
return {
"catppuccin/nvim",
name = "catppuccin",
priority = 999,
config = function()
vim.cmd.colorscheme "catppuccin-macchiato"
end,
}

View File

@@ -0,0 +1,25 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
harpoon:setup()
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)
vim.keymap.set("n", "<leader><C-h>", function() harpoon:list():replace_at(1) end)
vim.keymap.set("n", "<leader><C-j>", function() harpoon:list():replace_at(2) end)
vim.keymap.set("n", "<leader><C-k>", function() harpoon:list():replace_at(3) end)
vim.keymap.set("n", "<leader><C-l>", function() harpoon:list():replace_at(4) end)
end,
}

View File

@@ -0,0 +1,29 @@
return {
"echasnovski/mini.indentscope",
version = false, -- wait till new 0.7.0 release to put it back on semver
opts = {
-- symbol = "▏",
symbol = "",
options = { try_as_border = true },
},
init = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
callback = function()
vim.b.miniindentscope_disable = true
end,
})
end,
}

View File

@@ -0,0 +1,4 @@
return {
"nvim-lua/plenary.nvim",
name = "plenary"
}

130
lua/itsigo/plugins/lsp.lua Normal file
View File

@@ -0,0 +1,130 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/nvim-cmp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"j-hui/fidget.nvim",
"nvimtools/none-ls.nvim",
},
config = function()
local cmp = require('cmp')
local cmp_lsp = require("cmp_nvim_lsp")
local luasnip = require("luasnip")
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_lsp.default_capabilities())
require("fidget").setup({})
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
-- "rust_analyzer",
"gopls",
},
handlers = {
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {
capabilities = capabilities
}
end,
["lua_ls"] = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = "Lua 5.1" },
diagnostics = {
globals = { "vim", "it", "describe", "before_each", "after_each" },
}
}
}
}
end,
}
})
local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
["<Tab>"] = cmp.mapping(function(fallback)
--if cmp.visible() then
-- cmp.select_next_item()
if luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s"}),
}),
sources = cmp.config.sources({
{ name = 'luasnip' }, -- For luasnip users.
{ name = 'nvim_lsp' },
}, {
{ name = 'buffer' },
})
})
vim.diagnostic.config({
-- update_in_insert = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
})
local null_ls = require("null-ls")
local autogroup = vim.api.nvim_create_augroup("LspFormatting", {})
null_ls.setup({
sources = {
null_ls.builtins.formatting.gofumpt,
null_ls.builtins.formatting.goimports,
},
on_attach = function (client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = autogroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = autogroup,
buffer = bufnr,
callback = function ()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,
})
end
}

View File

@@ -0,0 +1,6 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
},
}

View File

@@ -0,0 +1,27 @@
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",
dependencies = { "rafamadriz/friendly-snippets" },
config = function()
local ls = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
ls.filetype_extend("javascript", { "jsdoc" })
--- TODO: What is expand?
vim.keymap.set({"i"}, "<C-s>e", function() ls.expand() end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-s>;", function() ls.jump(1) end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-s>,", function() ls.jump(-1) end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-E>", function()
if ls.choice_active() then
ls.change_choice(1)
end
end, {silent = true})
end,
}

View File

@@ -0,0 +1,11 @@
return {
'stevearc/oil.nvim',
opts = {},
-- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("oil").setup({
default_file_explorer = true,
})
end
}

View File

@@ -0,0 +1,13 @@
return {
'nvim-telescope/telescope.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
keys = {
{ "<leader>pf", function() require("telescope.builtin").find_files() end, desc="Find: Files" },
{ "<C-p>", function() require("telescope.builtin").git_files() end, desc="Find: Git Files" },
{ "<leader>ps", function()
require("telescope.builtin").grep_string({search = vim.fn.input("Grep > ")})
end, desc="Find: Files" },
},
}

View File

@@ -0,0 +1,11 @@
return {
"christoomey/vim-tmux-navigator",
keys = {
{ "<C-\\>", "<cmd>TmuxNavigatePrevious<cr>", desc = "Go to the previous pane" },
{ "<C-h>", "<cmd>TmuxNavigateLeft<cr>", desc = "Got to the left pane" },
{ "<C-j>", "<cmd>TmuxNavigateDown<cr>", desc = "Got to the down pane" },
{ "<C-k>", "<cmd>TmuxNavigateUp<cr>", desc = "Got to the up pane" },
{ "<C-l>", "<cmd>TmuxNavigateRight<cr>", desc = "Got to the right pane" },
},
}

View File

@@ -0,0 +1,15 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function ()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
sync_install = false,
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
})
end
}

7
lua/itsigo/remap.lua Normal file
View File

@@ -0,0 +1,7 @@
vim.g.mapleader = " "
-- open file explorer
-- vim.keymap.set("n", "<leader>e", vim.cmd.Ex)
-- oil
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })

26
lua/itsigo/set.lua Normal file
View File

@@ -0,0 +1,26 @@
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50