refesh directory tree
This commit is contained in:
54
.config/nvim/lua/config/autocmds.lua
Normal file
54
.config/nvim/lua/config/autocmds.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Docs: https://www.lazyvim.org/configuration/general
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
|
||||
local function find_python_executable()
|
||||
if vim.env.VIRTUAL_ENV then
|
||||
local paths = vim.fn.glob(vim.env.VIRTUAL_ENV .. "/**/bin/python", true, true)
|
||||
local executable_path = table.concat(paths, ", ")
|
||||
if executable_path ~= "" then
|
||||
vim.api.nvim_echo({ { "Using path for python: " .. executable_path, "None" } }, false, {})
|
||||
return executable_path
|
||||
end
|
||||
elseif vim.fn.filereadable(".venv/bin/python") == 1 then
|
||||
local executable_path = vim.fn.expand(".venv/bin/python")
|
||||
vim.api.nvim_echo({ { "Using path for python: " .. executable_path, "None" } }, false, {})
|
||||
return executable_path
|
||||
end
|
||||
vim.api.nvim_echo({ { "No python executable found (see autocmds.lua)", "WarningMsg" } }, false, {})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "python" },
|
||||
callback = function()
|
||||
vim.g.python3_host_prog = find_python_executable() -- python executable
|
||||
vim.opt_local.colorcolumn = "72,88" -- Ruler at column number
|
||||
vim.opt_local.tabstop = 4 -- Number of spaces tabs count for
|
||||
vim.opt_local.shiftwidth = 4 -- Size of an indent
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "rust" },
|
||||
callback = function()
|
||||
vim.opt_local.colorcolumn = "79" -- Ruler at column number
|
||||
vim.opt_local.tabstop = 4 -- Number of spaces tabs count for
|
||||
vim.opt_local.shiftwidth = 4 -- Size of an indent
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "typescript",
|
||||
callback = function()
|
||||
vim.opt_local.colorcolumn = "79" -- Ruler at column number
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
end,
|
||||
})
|
||||
-- see lint.lua
|
||||
-- vim.api.nvim_create_autocmd({ "InsertLeave", "BufWritePost" }, {
|
||||
-- callback = function()
|
||||
-- require("lint").try_lint()
|
||||
-- end,
|
||||
-- })
|
||||
22
.config/nvim/lua/config/keymaps.lua
Normal file
22
.config/nvim/lua/config/keymaps.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Docs: https://www.lazyvim.org/configuration/general
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local keys = require("lazy.core.handler").handlers.keys
|
||||
---@cast keys LazyKeysHandler
|
||||
-- do not create the keymap if a lazy keys handler exists
|
||||
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
if opts.remap and not vim.g.vscode then
|
||||
opts.remap = nil
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
|
||||
map("n", "<leader>bo", "<cmd>%bd|e#<cr>", { desc = "Close all buffers but the current one" })
|
||||
62
.config/nvim/lua/config/lazy.lua
Normal file
62
.config/nvim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
-- "git"
|
||||
vim.fn.system({"git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
|
||||
-- import any extras modules here
|
||||
-- { import = "lazyvim.plugins.extras.lang.docker" },
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
{ import = "lazyvim.plugins.extras.lang.rust" },
|
||||
-- { import = "lazyvim.plugins.extras.lang.tailwind" },
|
||||
{ import = "lazyvim.plugins.extras.lang.terraform" },
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
-- { import = "lazyvim.plugins.extras.formatting.prettier" },
|
||||
{ import = "lazyvim.plugins.extras.linting.eslint" },
|
||||
{ import = "lazyvim.plugins.extras.test.core" },
|
||||
{ import = "lazyvim.plugins.extras.dap.core" },
|
||||
{ import = "lazyvim.plugins.extras.dap.nlua" },
|
||||
-- { import = "lazyvim.plugins.extras.coding.copilot" }, -- see ai.lua instead
|
||||
{ import = "lazyvim.plugins.extras.coding.yanky" },
|
||||
{ import = "lazyvim.plugins.extras.util.mini-hipatterns" },
|
||||
{ import = "lazyvim.plugins.extras.vscode" },
|
||||
{ import = "lazyvim.plugins.extras.editor.mini-files" },
|
||||
{ import = "lazyvim.plugins.extras.coding.luasnip" },
|
||||
{ import = "lazyvim.plugins.extras.lsp.none-ls" },
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "catppuccin" } },
|
||||
checker = { enabled = true }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
8
.config/nvim/lua/config/options.lua
Normal file
8
.config/nvim/lua/config/options.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Docs: https://www.lazyvim.org/configuration/general
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
|
||||
vim.opt.listchars = "tab:▸ ,trail:·,nbsp:␣,extends:❯,precedes:❮" -- show symbols for whitespace
|
||||
vim.opt.relativenumber = false -- relative line numbers
|
||||
vim.opt.scrolloff = 10 -- keep 20 lines above and below the cursor
|
||||
180
.config/nvim/lua/plugins/ai.lua
Normal file
180
.config/nvim/lua/plugins/ai.lua
Normal file
@@ -0,0 +1,180 @@
|
||||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
optional = true,
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
local icons = require("lazyvim.config").icons
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
return {
|
||||
options = {
|
||||
theme = "catppuccin",
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
globalstatus = true,
|
||||
disabled_filetypes = { statusline = { "dashboard", "alpha" } },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch" },
|
||||
lualine_c = {
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warn = icons.diagnostics.Warn,
|
||||
info = icons.diagnostics.Info,
|
||||
hint = icons.diagnostics.Hint,
|
||||
},
|
||||
},
|
||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{ "filename", path = 1, symbols = { modified = " ", readonly = "", unnamed = "" } },
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("nvim-navic").get_location() end,
|
||||
cond = function() return package.loaded["nvim-navic"] and require("nvim-navic").is_available() end,
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("noice").api.status.command.get() end,
|
||||
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
|
||||
color = Util.ui.fg("Statement"),
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("noice").api.status.mode.get() end,
|
||||
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
|
||||
color = Util.ui.fg("Constant"),
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return " " .. require("dap").status() end,
|
||||
cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end,
|
||||
color = Util.ui.fg("Debug"),
|
||||
},
|
||||
{
|
||||
require("lazy.status").updates,
|
||||
cond = require("lazy.status").has_updates,
|
||||
color = Util.ui.fg("Special"),
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
added = icons.git.added,
|
||||
modified = icons.git.modified,
|
||||
removed = icons.git.removed,
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
|
||||
{ "location", padding = { left = 0, right = 1 } },
|
||||
},
|
||||
lualine_z = {
|
||||
function()
|
||||
return " " .. os.date("%R")
|
||||
end,
|
||||
},
|
||||
},
|
||||
extensions = { "neo-tree", "lazy" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- custom config which piggybacks on the copilot extras in lazy.lua.
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
enabled = false,
|
||||
cmd = "Copilot",
|
||||
build = ":Copilot auth",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("copilot").setup({
|
||||
panel = {
|
||||
enabled = true,
|
||||
auto_refresh = true,
|
||||
},
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
accept = false, -- disable built-in keymapping
|
||||
},
|
||||
})
|
||||
|
||||
-- hide copilot suggestions when cmp menu is open
|
||||
-- to prevent odd behavior/garbled up suggestions
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if cmp_status_ok then
|
||||
cmp.event:on("menu_opened", function()
|
||||
vim.b.copilot_suggestion_hidden = true
|
||||
end)
|
||||
|
||||
cmp.event:on("menu_closed", function()
|
||||
vim.b.copilot_suggestion_hidden = false
|
||||
end)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
{
|
||||
"jellydn/CopilotChat.nvim",
|
||||
enabled = false,
|
||||
dependencies = { "zbirenbaum/copilot.lua" }, -- Or { "github/copilot.vim" }
|
||||
opts = {
|
||||
mode = "split", -- newbuffer or split , default: newbuffer
|
||||
debug = false, -- Enable or disable debug mode, the log file will be in ~/.local/state/nvim/CopilotChat.nvim.log
|
||||
},
|
||||
build = function()
|
||||
vim.defer_fn(function()
|
||||
vim.cmd("UpdateRemotePlugins")
|
||||
vim.notify("CopilotChat - Updated remote plugins. Please restart Neovim.")
|
||||
end, 3000)
|
||||
end,
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{ "<leader>cce", "<cmd>CopilotChatExplain<cr>", desc = "CopilotChat - Explain code" },
|
||||
{ "<leader>cct", "<cmd>CopilotChatTests<cr>", desc = "CopilotChat - Generate tests" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- copilot status in lualine
|
||||
-- this is taken from the copilot lazyvim extras at:
|
||||
-- https://www.lazyvim.org/plugins/extras/coding.copilot
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
enabled = false,
|
||||
optional = true,
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
local Util = require("lazyvim.util").ui
|
||||
local colors = {
|
||||
[""] = Util.fg("Special"),
|
||||
["Normal"] = Util.fg("Special"),
|
||||
["Warning"] = Util.fg("DiagnosticError"),
|
||||
["InProgress"] = Util.fg("DiagnosticWarn"),
|
||||
}
|
||||
table.insert(opts.sections.lualine_x, 2, {
|
||||
function()
|
||||
local icon = require("lazyvim.config").icons.kinds.Copilot
|
||||
local status = require("copilot.api").status.data
|
||||
return icon .. (status.message or "")
|
||||
end,
|
||||
cond = function()
|
||||
local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 })
|
||||
return ok and #clients > 0
|
||||
end,
|
||||
color = function()
|
||||
if not package.loaded["copilot"] then
|
||||
return
|
||||
end
|
||||
local status = require("copilot.api").status.data
|
||||
return colors[status.status] or colors[""]
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
7
.config/nvim/lua/plugins/autopairs.lua
Normal file
7
.config/nvim/lua/plugins/autopairs.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
enable_check_bracket_line = true,
|
||||
},
|
||||
}
|
||||
52
.config/nvim/lua/plugins/cmp.lua
Normal file
52
.config/nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
return {
|
||||
|
||||
-- nvim-cmp configuration so to not preselect completion and require tab to select
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-emoji",
|
||||
opts = nil,
|
||||
},
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<CR>"] = vim.NIL,
|
||||
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })
|
||||
elseif require("copilot.suggestion").is_visible() then
|
||||
require("copilot.suggestion").accept()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
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.preselect = cmp.PreselectMode.None
|
||||
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
|
||||
end,
|
||||
},
|
||||
}
|
||||
17
.config/nvim/lua/plugins/code_runner.lua
Normal file
17
.config/nvim/lua/plugins/code_runner.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
{
|
||||
"CRAG666/code_runner.nvim",
|
||||
config = function()
|
||||
require("code_runner").setup({
|
||||
focus = false,
|
||||
|
||||
filetype = {
|
||||
go = {
|
||||
"go run",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = { { "<leader>rf", "<cmd>RunFile term<cr>", desc = "Run file" } },
|
||||
},
|
||||
}
|
||||
45
.config/nvim/lua/plugins/colorscheme.lua
Normal file
45
.config/nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
return {
|
||||
|
||||
-- NOTE: also see treesitter.lua for languages with improved syntax highlighting
|
||||
|
||||
-- NOTE: colorschemes already installed in LazyVim: https://www.lazyvim.org/plugins/colorscheme
|
||||
|
||||
-- set the colorscheme
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
-- lazy = false,
|
||||
opts = {
|
||||
-- colorscheme = "tokyonight-storm",
|
||||
-- colorscheme = "tokyonight-night",
|
||||
-- colorscheme = "tokyonight-moon",
|
||||
-- colorscheme = "tokyonight-day",
|
||||
colorscheme = "catppuccin",
|
||||
-- colorscheme = "catppuccin-macchiato",
|
||||
-- colorscheme = "catppuccin-mocha",
|
||||
-- colorscheme = "catppuccin-frappe",
|
||||
-- colorscheme = "catppuccin-latte",
|
||||
},
|
||||
},
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
-- lazy = false,
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
opts = {
|
||||
flavor = "mocha",
|
||||
transparent_background = true,
|
||||
integrations = {
|
||||
gitsigns = true,
|
||||
telescope = true,
|
||||
neogit = true,
|
||||
nvimtree = true,
|
||||
indent_blankline = true,
|
||||
dashboard = true,
|
||||
which_key = true,
|
||||
mini = true,
|
||||
harpoon = true,
|
||||
notify = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
4
.config/nvim/lua/plugins/dashboard.lua
Normal file
4
.config/nvim/lua/plugins/dashboard.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
|
||||
{ "goolord/alpha-nvim", enabled = true },
|
||||
}
|
||||
66
.config/nvim/lua/plugins/debug.lua
Normal file
66
.config/nvim/lua/plugins/debug.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
-- See https://www.lazyvim.org/plugins/extras/dap.core
|
||||
-- and test.lua for keymaps
|
||||
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
local ensure_installed = {
|
||||
-- python
|
||||
"debugpy",
|
||||
|
||||
-- see lazy.lua for LazyVim extras
|
||||
}
|
||||
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, ensure_installed)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"mfussenegger/nvim-dap-python",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
ft = { "python" },
|
||||
config = function()
|
||||
local dap_python = require("dap-python")
|
||||
|
||||
local function find_debugpy_python_path()
|
||||
-- Return the path to the debugpy python executable if it is
|
||||
-- installed in $VIRTUAL_ENV, otherwise get it from Mason
|
||||
if vim.env.VIRTUAL_ENV then
|
||||
local paths = vim.fn.glob(vim.env.VIRTUAL_ENV .. "/**/debugpy", true, true)
|
||||
if table.concat(paths, ", ") ~= "" then
|
||||
return vim.env.VIRTUAL_ENV .. "/bin/python"
|
||||
end
|
||||
end
|
||||
|
||||
local mason_registry = require("mason-registry")
|
||||
local path = mason_registry.get_package("debugpy"):get_install_path() .. "/venv/bin/python"
|
||||
return path
|
||||
end
|
||||
|
||||
local dap_python_path = find_debugpy_python_path()
|
||||
vim.api.nvim_echo({ { "Using path for dap-python: " .. dap_python_path, "None" } }, false, {})
|
||||
|
||||
dap_python.setup(dap_python_path)
|
||||
end,
|
||||
},
|
||||
|
||||
-- extend Go extras setup from lazy.lua, with DAP capability
|
||||
-- also see https://github.com/LazyVim/LazyVim/pull/1115
|
||||
{
|
||||
"leoluz/nvim-dap-go",
|
||||
dependencies = {
|
||||
{ "mfussenegger/nvim-dap" },
|
||||
},
|
||||
ft = { "go" },
|
||||
config = true,
|
||||
keys = {
|
||||
-- workaround, as nvim-dap-go does not have a DAP strategy set up for neotest
|
||||
-- see https://github.com/nvim-neotest/neotest-go/issues/12
|
||||
{ "<leader>tg", "<cmd>lua require('dap-go').debug_test()<CR>", desc = "Debug Nearest (Go)" },
|
||||
},
|
||||
},
|
||||
}
|
||||
267
.config/nvim/lua/plugins/example.lua
Normal file
267
.config/nvim/lua/plugins/example.lua
Normal file
@@ -0,0 +1,267 @@
|
||||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under config.plugins will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- add symbols-outline
|
||||
{
|
||||
"simrat39/symbols-outline.nvim",
|
||||
cmd = "SymbolsOutline",
|
||||
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add telescope-fzf-native
|
||||
{
|
||||
"telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
config = function()
|
||||
require("telescope").load_extension("fzf")
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"help",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, "😄")
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Use <tab> for completion and snippets (supertab)
|
||||
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
keys = function()
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
-- then: setup supertab in cmp
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-emoji",
|
||||
},
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
|
||||
-- they way you will only jump inside the snippet region
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
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" }),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
24
.config/nvim/lua/plugins/filetree.lua
Normal file
24
.config/nvim/lua/plugins/filetree.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
return {
|
||||
|
||||
-- change neo-tree confi
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = {
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = true, -- when true, they will just be displayed differently than normal items
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = true,
|
||||
},
|
||||
|
||||
-- This will use the OS level file watchers to detect changes
|
||||
-- instead of relying on nvim autocmd events.
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
window = {
|
||||
position = "right",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
59
.config/nvim/lua/plugins/format.lua
Normal file
59
.config/nvim/lua/plugins/format.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
return {
|
||||
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
|
||||
opts = function(_, opts)
|
||||
local ensure_installed = {
|
||||
-- python
|
||||
"black",
|
||||
|
||||
-- lua
|
||||
"stylua",
|
||||
|
||||
-- shell
|
||||
"shfmt",
|
||||
|
||||
-- yaml
|
||||
"yamlfix",
|
||||
"yamlfmt",
|
||||
|
||||
-- rust
|
||||
-- rustfmt via rustup
|
||||
|
||||
-- see lazy.lua for LazyVim extras
|
||||
}
|
||||
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, ensure_installed)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"mhartington/formatter.nvim",
|
||||
enabled = false, -- let's see what happens with null-ls and LazyVim
|
||||
config = function()
|
||||
local formatter = require("formatter")
|
||||
formatter.setup({
|
||||
filetype = {
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
},
|
||||
python = {
|
||||
require("formatter.filetypes.python").black,
|
||||
},
|
||||
sh = {
|
||||
require("formatter.filetypes.sh").shfmt,
|
||||
},
|
||||
yaml = {
|
||||
require("formatter.filetypes.yaml").yamlfix,
|
||||
require("formatter.filetypes.yaml").yamlfmt,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {}, -- this is equalent to setup({}) function
|
||||
}
|
||||
77
.config/nvim/lua/plugins/git.lua
Normal file
77
.config/nvim/lua/plugins/git.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
return {
|
||||
|
||||
{
|
||||
"sindrets/diffview.nvim",
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
},
|
||||
lazy = false,
|
||||
config = function()
|
||||
-- vim.opt.fillchars = "diff:╱"
|
||||
vim.opt.fillchars = "diff:░"
|
||||
|
||||
require("diffview").setup({
|
||||
enhanced_diff_hl = true, -- See ':h diffview-config-enhanced_diff_hl'
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
-- use [c and [c to navigate diffs (vim built in), see :h jumpto-diffs
|
||||
-- use ]x and [x to navigate conflicts
|
||||
{ "<leader>gdc", ":DiffviewOpen origin/main...HEAD", desc = "Compare commits" },
|
||||
{ "<leader>gdd", ":DiffviewClose<CR>", desc = "Close Diffview tab" },
|
||||
{ "<leader>gdh", ":DiffviewFileHistory %<CR>", desc = "File history" },
|
||||
{ "<leader>gdH", ":DiffviewFileHistory<CR>", desc = "Repo history" },
|
||||
{ "<leader>gdm", ":DiffviewOpen<CR>", desc = "Solve merge conflicts" },
|
||||
{ "<leader>gdo", ":DiffviewOpen main", desc = "DiffviewOpen" },
|
||||
{ "<leader>gdp", ":DiffviewOpen origin/main...HEAD --imply-local", desc = "Review current PR" },
|
||||
{
|
||||
"<leader>gdP",
|
||||
":DiffviewFileHistory --range=origin/main...HEAD --right-only --no-merges",
|
||||
desc = "Review current PR (per commit)",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"f-person/git-blame.nvim",
|
||||
keys = {
|
||||
-- toggle needs to be called twice; https://github.com/f-person/git-blame.nvim/issues/16
|
||||
{ "<leader>gbe", ":GitBlameEnable<CR>", desc = "Blame line (enable)" },
|
||||
{ "<leader>gbd", ":GitBlameDisable<CR>", desc = "Blame line (disable)" },
|
||||
{ "<leader>gbs", ":GitBlameCopySHA<CR>", desc = "Copy SHA" },
|
||||
{ "<leader>gbc", ":GitBlameCopyCommitURL<CR>", desc = "Copy commit URL" },
|
||||
{ "<leader>gbf", ":GitBlameCopyFileURL<CR>", desc = "Copy file URL" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"tpope/vim-fugitive",
|
||||
},
|
||||
|
||||
{
|
||||
"topaxi/gh-actions.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim" },
|
||||
build = "make",
|
||||
cmd = "GhActions",
|
||||
keys = {
|
||||
{ "<leader>ga", "<cmd>GhActions<cr>", desc = "Open Github Actions" },
|
||||
},
|
||||
-- optional, you can also install and use `yq` instead.
|
||||
config = function(_, opts)
|
||||
require("gh-actions").setup(opts)
|
||||
end,
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{
|
||||
"NeogitOrg/neogit",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim", -- required
|
||||
"nvim-telescope/telescope.nvim", -- optional
|
||||
"sindrets/diffview.nvim", -- optional
|
||||
"ibhagwan/fzf-lua", -- optional
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
}
|
||||
22
.config/nvim/lua/plugins/harpoon.lua
Normal file
22
.config/nvim/lua/plugins/harpoon.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
return {
|
||||
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-telescope/telescope.nvim" },
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>hh", ":lua require('harpoon.ui').toggle_quick_menu()<CR>", desc = "Harpoon menu" },
|
||||
-- { "<leader>ht", ":Telescope harpoon marks<CR>", desc = "Telescope menu" },
|
||||
|
||||
{ "<leader>ha", ":lua require('harpoon.mark').add_file()<CR>", desc = "Add file as marked" },
|
||||
{ "<leader>hn", ":lua require('harpoon.ui').nav_next()<CR>", desc = "Next file" },
|
||||
{ "<leader>hp", ":lua require('harpoon.ui').nav_prev()<CR>", desc = "Previous file" },
|
||||
{ "<leader>ht", ":lua require('harpoon.term').gotoTerminal(1)<CR>", desc = "Terminal" },
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("harpoon")
|
||||
end,
|
||||
},
|
||||
}
|
||||
50
.config/nvim/lua/plugins/lint.lua
Normal file
50
.config/nvim/lua/plugins/lint.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
return {
|
||||
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
|
||||
opts = function(_, opts)
|
||||
local ensure_installed = {
|
||||
-- python
|
||||
"mypy",
|
||||
|
||||
-- lua
|
||||
"luacheck",
|
||||
|
||||
-- shell
|
||||
"shellcheck",
|
||||
|
||||
-- yaml
|
||||
"yamllint",
|
||||
|
||||
-- sql
|
||||
"sqlfluff",
|
||||
|
||||
-- markdown
|
||||
"vale",
|
||||
|
||||
-- see lazy.lua for LazyVim extras
|
||||
}
|
||||
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, ensure_installed)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
-- NOTE: autocmd is required, see autocmds.lua
|
||||
"mfussenegger/nvim-lint",
|
||||
enabled = false, -- let's see what happens with null-ls and LazyVim
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
lint.linters_by_ft = {
|
||||
python = { "mypy" },
|
||||
lua = { "luacheck" },
|
||||
yaml = { "yamllint" },
|
||||
sh = { "shellcheck" },
|
||||
sql = { "sqlfluff" },
|
||||
markdown = { "vale" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
114
.config/nvim/lua/plugins/lsp.lua
Normal file
114
.config/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,114 @@
|
||||
-- https://www.lazyvim.org/plugins/lsp
|
||||
|
||||
return {
|
||||
|
||||
-- change mason config
|
||||
-- note: don't forget to update treesitter for languages
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
|
||||
opts = function(_, opts)
|
||||
local ensure_installed = {
|
||||
-- python
|
||||
"ruff-lsp",
|
||||
"pyright",
|
||||
|
||||
-- lua
|
||||
"lua-language-server",
|
||||
|
||||
-- shell
|
||||
"bash-language-server",
|
||||
|
||||
-- docker
|
||||
"dockerfile-language-server",
|
||||
|
||||
-- rust
|
||||
"rust-analyzer",
|
||||
|
||||
--svelte
|
||||
"svelte-language-server",
|
||||
|
||||
-- vue
|
||||
"vue-language-server",
|
||||
|
||||
-- php
|
||||
"intelephense",
|
||||
-- see lazy.lua for LazyVim extras
|
||||
}
|
||||
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, ensure_installed)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
dependencies = { "mason.nvim" },
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = function(_, opts)
|
||||
local null_ls = require("null-ls")
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local code_actions = null_ls.builtins.code_actions
|
||||
|
||||
-- null_ls.setup({
|
||||
-- debug = false, -- Turn on debug for :NullLsLog
|
||||
-- -- diagnostics_format = "#{m} #{s}[#{c}]",
|
||||
-- })
|
||||
|
||||
local function prefer_bin_from_venv(executable_name)
|
||||
-- Return the path to the executable if $VIRTUAL_ENV is set and the binary exists somewhere beneath the $VIRTUAL_ENV path, otherwise get it from Mason
|
||||
if vim.env.VIRTUAL_ENV then
|
||||
local paths = vim.fn.glob(vim.env.VIRTUAL_ENV .. "/**/bin/" .. executable_name, true, true)
|
||||
local executable_path = table.concat(paths, ", ")
|
||||
if executable_path ~= "" then
|
||||
-- vim.api.nvim_echo(
|
||||
-- { { "Using path for " .. executable_name .. ": " .. executable_path, "None" } },
|
||||
-- false,
|
||||
-- {}
|
||||
-- )
|
||||
return executable_path
|
||||
end
|
||||
end
|
||||
|
||||
local mason_registry = require("mason-registry")
|
||||
local mason_path = mason_registry.get_package(executable_name):get_install_path()
|
||||
.. "/venv/bin/"
|
||||
.. executable_name
|
||||
-- vim.api.nvim_echo({ { "Using Mason for " .. executable_name .. ": " .. mason_path, "None" } }, false, {})
|
||||
return mason_path
|
||||
end
|
||||
|
||||
local sources = {
|
||||
-- list of supported sources:
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
|
||||
|
||||
diagnostics.mypy.with({
|
||||
filetypes = { "python" },
|
||||
command = prefer_bin_from_venv("mypy"),
|
||||
}),
|
||||
formatting.black.with({
|
||||
filetypes = { "python" },
|
||||
command = prefer_bin_from_venv("black"),
|
||||
}),
|
||||
|
||||
-- installed via Mason
|
||||
formatting.stylua.with({
|
||||
extra_args = { "--indent-type", "Spaces", "--indent-width", "2" },
|
||||
}),
|
||||
formatting.shfmt,
|
||||
formatting.yamlfix, -- requires python
|
||||
formatting.prettierd,
|
||||
diagnostics.yamllint,
|
||||
diagnostics.sqlfluff.with({
|
||||
extra_args = { "--dialect", "postgres" },
|
||||
}),
|
||||
code_actions.gitsigns,
|
||||
}
|
||||
|
||||
-- extend opts.sources
|
||||
for _, source in ipairs(sources) do
|
||||
table.insert(opts.sources, source)
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
9
.config/nvim/lua/plugins/markdown.lua
Normal file
9
.config/nvim/lua/plugins/markdown.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
ft = "markdown",
|
||||
build = function()
|
||||
vim.fn["mkdp#util#install"]()
|
||||
end,
|
||||
},
|
||||
}
|
||||
10
.config/nvim/lua/plugins/neo-tree.lua
Normal file
10
.config/nvim/lua/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
opts = {
|
||||
filesystem = {
|
||||
bind_to_cwd = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
32
.config/nvim/lua/plugins/projects.lua
Normal file
32
.config/nvim/lua/plugins/projects.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
return {
|
||||
|
||||
{
|
||||
|
||||
"ahmedkhalf/project.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("project_nvim").setup({
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
--
|
||||
-- All the patterns used to detect root dir, when **"pattern"** is in
|
||||
-- detection_methods
|
||||
patterns = {
|
||||
".git",
|
||||
"_darcs",
|
||||
".hg",
|
||||
".bzr",
|
||||
".svn",
|
||||
"Makefile",
|
||||
"package.json",
|
||||
"pyproject.toml",
|
||||
"poetry.lock",
|
||||
},
|
||||
})
|
||||
require("telescope").load_extension("projects")
|
||||
end,
|
||||
},
|
||||
}
|
||||
19
.config/nvim/lua/plugins/refactoring.lua
Normal file
19
.config/nvim/lua/plugins/refactoring.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
},
|
||||
config = function()
|
||||
require("refactoring").setup()
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>cR",
|
||||
":lua require('refactoring').select_refactor()<CR>",
|
||||
mode = "v",
|
||||
desc = "Refactor",
|
||||
},
|
||||
},
|
||||
}
|
||||
5
.config/nvim/lua/plugins/tabs.lua
Normal file
5
.config/nvim/lua/plugins/tabs.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
|
||||
-- disable tabs
|
||||
{ "akinsho/bufferline.nvim", enabled = false },
|
||||
}
|
||||
5
.config/nvim/lua/plugins/tailwind.lua
Normal file
5
.config/nvim/lua/plugins/tailwind.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
-- tailwind-tools.lua
|
||||
return {
|
||||
"luckasRanarison/tailwind-tools.nvim",
|
||||
opts = {}, -- your configuration
|
||||
}
|
||||
63
.config/nvim/lua/plugins/telescope.lua
Normal file
63
.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
return {
|
||||
|
||||
-- change telescope config
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
|
||||
-- opts will be merged with the parent spec
|
||||
opts = {
|
||||
defaults = {
|
||||
file_ignore_patterns = { "^.git/", "^node_modules/", "^poetry.lock" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- https://github.com/nvim-telescope/telescope-live-grep-args.nvim
|
||||
{
|
||||
"nvim-telescope/telescope-live-grep-args.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- https://github.com/nvim-telescope/telescope-live-grep-args.nvim
|
||||
-- Uses ripgrep args (rg) for live_grep
|
||||
-- Command examples:
|
||||
-- -i "Data" # case insensitive
|
||||
-- -g "!*.md" # ignore md files
|
||||
-- -w # whole word
|
||||
-- -e # regex
|
||||
-- see 'man rg' for more
|
||||
require("telescope").load_extension("live_grep_args")
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>/",
|
||||
":lua require('telescope').extensions.live_grep_args.live_grep_args()<CR>",
|
||||
desc = "Live Grep (Args)",
|
||||
},
|
||||
},
|
||||
|
||||
-- opts will be merged with the parent spec
|
||||
opts = {
|
||||
pickers = {
|
||||
live_grep = {
|
||||
additional_args = function()
|
||||
return { "--hidden" }
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- https://www.lazyvim.org/configuration/recipes#add-telescope-fzf-native
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
build = "make",
|
||||
config = function()
|
||||
require("telescope").load_extension("fzf")
|
||||
end,
|
||||
},
|
||||
}
|
||||
64
.config/nvim/lua/plugins/test.lua
Normal file
64
.config/nvim/lua/plugins/test.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
return {
|
||||
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
{ "antoinemadec/FixCursorHold.nvim" },
|
||||
{ "folke/neodev.nvim" },
|
||||
|
||||
-- adapters
|
||||
{ "nvim-neotest/neotest-vim-test" },
|
||||
{ "nvim-neotest/neotest-python" },
|
||||
{ "rouge8/neotest-rust" },
|
||||
{ "nvim-neotest/neotest-go" },
|
||||
{ "adrigzr/neotest-mocha" },
|
||||
{ "vim-test/vim-test" },
|
||||
},
|
||||
|
||||
keys = {
|
||||
{
|
||||
"<leader>tS",
|
||||
":lua require('neotest').run.run({ suite = true })<CR>",
|
||||
desc = "Run all tests in suite",
|
||||
},
|
||||
},
|
||||
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-python"] = {
|
||||
-- https://github.com/nvim-neotest/neotest-python
|
||||
runner = "pytest",
|
||||
args = { "--log-level", "INFO", "--color", "yes", "-vv", "-s" },
|
||||
-- dap = { justMyCode = false },
|
||||
},
|
||||
["neotest-go"] = {
|
||||
-- see lazy.lua
|
||||
},
|
||||
-- ["neotest-rust"] = {
|
||||
-- -- see lazy.lua
|
||||
-- -- https://github.com/rouge8/neotest-rust
|
||||
-- --
|
||||
-- -- requires nextest, which can be installed via "cargo binstall":
|
||||
-- -- https://github.com/cargo-bins/cargo-binstall
|
||||
-- -- https://nexte.st/book/pre-built-binaries.html
|
||||
-- },
|
||||
["neotest-mocha"] = {
|
||||
-- https://github.com/adrigzr/neotest-mocha
|
||||
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" },
|
||||
command = "npm test --",
|
||||
env = { CI = true },
|
||||
cwd = function(_) -- skipped arg is path
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
},
|
||||
["neotest-vim-test"] = {
|
||||
-- https://github.com/nvim-neotest/neotest-vim-test
|
||||
ignore_file_types = { "python", "vim", "lua", "rust", "go" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
45
.config/nvim/lua/plugins/tmux.lua
Normal file
45
.config/nvim/lua/plugins/tmux.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
return {
|
||||
-- {
|
||||
-- "numToStr/Navigator.nvim",
|
||||
-- config = true,
|
||||
-- keys = {
|
||||
-- { "<C-h>", "<cmd>NavigatorLeft<cr>", desc = "Move left" },
|
||||
-- { "<C-l", "<cmd>NavigatorRight<cr>", desc = "Move right" },
|
||||
-- { "<C-j>", "<cmd>NavigatorDown<cr>", desc = "Move down" },
|
||||
-- { "<C-k>", "<cmd>NavigatorUp<cr>", desc = "Move up" },
|
||||
-- },
|
||||
-- },
|
||||
-- {
|
||||
-- "alexghergh/nvim-tmux-navigation",
|
||||
-- config = function()
|
||||
-- require("nvim-tmux-navigation").setup({
|
||||
-- disable_when_zoomed = true, -- defaults to false
|
||||
-- keybindings = {
|
||||
-- left = "<C-h>",
|
||||
-- down = "<C-j>",
|
||||
-- up = "<C-k>",
|
||||
-- right = "<C-l>",
|
||||
-- last_active = "<C-\\>",
|
||||
-- next = "<C-Space>",
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
{
|
||||
"christoomey/vim-tmux-navigator",
|
||||
cmd = {
|
||||
"TmuxNavigateLeft",
|
||||
"TmuxNavigateDown",
|
||||
"TmuxNavigateUp",
|
||||
"TmuxNavigateRight",
|
||||
"TmuxNavigatePrevious",
|
||||
},
|
||||
keys = {
|
||||
{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
|
||||
{ "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
|
||||
{ "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
|
||||
{ "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
|
||||
{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
|
||||
},
|
||||
},
|
||||
}
|
||||
59
.config/nvim/lua/plugins/treesitter.lua
Normal file
59
.config/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
return {
|
||||
|
||||
-- add more treesitter parsers, used for e.g. theming and other plugins
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter#supported-languages
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"comment",
|
||||
"css",
|
||||
"diff",
|
||||
"git_config",
|
||||
"git_rebase",
|
||||
"go",
|
||||
"gomod",
|
||||
"html",
|
||||
"http",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"make",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"proto",
|
||||
"python",
|
||||
"query",
|
||||
"graphql",
|
||||
"regex",
|
||||
"rst",
|
||||
"rust",
|
||||
"scss",
|
||||
"svelte",
|
||||
"swift",
|
||||
"sql",
|
||||
"terraform",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vue",
|
||||
"yaml",
|
||||
},
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
}
|
||||
9
.config/nvim/lua/plugins/undotree.lua
Normal file
9
.config/nvim/lua/plugins/undotree.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{
|
||||
"mbbill/undotree",
|
||||
cmd = "UndotreeToggle",
|
||||
keys = {
|
||||
{ "<leader>fu", "<cmd>UndotreeToggle<cr>", desc = "Undo tree" },
|
||||
},
|
||||
},
|
||||
}
|
||||
50
.config/nvim/lua/plugins/vue.lua
Normal file
50
.config/nvim/lua/plugins/vue.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
local lsp_conficts, _ = pcall(vim.api.nvim_get_autocmds, { group = "LspAttach_conflicts" })
|
||||
if not lsp_conficts then
|
||||
vim.api.nvim_create_augroup("LspAttach_conflicts", {})
|
||||
end
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = "LspAttach_conflicts",
|
||||
desc = "prevent tsserver and volar competing",
|
||||
callback = function(args)
|
||||
if not (args.data and args.data.client_id) then
|
||||
return
|
||||
end
|
||||
local active_clients = vim.lsp.get_active_clients()
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
-- prevent tsserver and volar competing
|
||||
-- if client.name == "volar" or require("lspconfig").util.root_pattern("nuxt.config.ts")(vim.fn.getcwd()) then
|
||||
-- OR
|
||||
if client.name == "volar" then
|
||||
for _, client_ in pairs(active_clients) do
|
||||
-- stop tsserver if volar is already active
|
||||
if client_.name == "tsserver" then
|
||||
client_.stop()
|
||||
end
|
||||
end
|
||||
elseif client.name == "tsserver" then
|
||||
for _, client_ in pairs(active_clients) do
|
||||
-- prevent tsserver from starting if volar is already active
|
||||
if client_.name == "volar" then
|
||||
client.stop()
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
volar = {
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
"vue",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{},
|
||||
}
|
||||
25
.config/nvim/lua/plugins/which-key.lua
Normal file
25
.config/nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
-- Modify which-key keys
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
opts = function()
|
||||
require("which-key").register({
|
||||
["<leader>t"] = {
|
||||
name = "+test",
|
||||
},
|
||||
["<leader>gb"] = {
|
||||
name = "+blame",
|
||||
},
|
||||
["<leader>gd"] = {
|
||||
name = "+diffview",
|
||||
},
|
||||
["<leader>h"] = {
|
||||
name = "+harpoon",
|
||||
},
|
||||
["<leader>r"] = {
|
||||
name = "+run",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
4
.config/nvim/lua/plugins/zen.lua
Normal file
4
.config/nvim/lua/plugins/zen.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
|
||||
{ "folke/zen-mode.nvim" },
|
||||
}
|
||||
Reference in New Issue
Block a user