Update something
This commit is contained in:
parent
e3c94cce54
commit
147ca5ddbc
81 changed files with 3055 additions and 326 deletions
42
nvim.bak/lua/config/lazy.lua
Normal file
42
nvim.bak/lua/config/lazy.lua
Normal file
|
@ -0,0 +1,42 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
ui = {
|
||||
-- a number <1 is a percentage., >1 is a fixed size
|
||||
size = { width = 0.6, height = 0.6 },
|
||||
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
||||
border = "rounded",
|
||||
},
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "config.plugins.auto-completion" },
|
||||
{ import = "config.plugins.core" },
|
||||
{ import = "config.plugins.git" },
|
||||
{ import = "config.plugins.lsp" },
|
||||
{ import = "config.plugins.qol" },
|
||||
{ import = "config.plugins.ui" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "catppuccin" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>l", "<cmd>Lazy<CR>", { desc = "Lazy" })
|
3
nvim.bak/lua/config/plugins/auto-completion/copilot.lua
Normal file
3
nvim.bak/lua/config/plugins/auto-completion/copilot.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"github/copilot.vim",
|
||||
}
|
68
nvim.bak/lua/config/plugins/auto-completion/nvim-cmp.lua
Normal file
68
nvim.bak/lua/config/plugins/auto-completion/nvim-cmp.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
{
|
||||
"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",
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||
"rafamadriz/friendly-snippets", -- useful snippets
|
||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
},
|
||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-s>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-a>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
|
||||
-- configure lspkind for vs-code like pictograms in completion menu
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
29
nvim.bak/lua/config/plugins/core/debugging.lua
Normal file
29
nvim.bak/lua/config/plugins/core/debugging.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"nvim-neotest/nvim-nio",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
|
||||
dapui.setup()
|
||||
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>db", dap.toggle_breakpoint, { desc = "Toggle debugger breakpoint" })
|
||||
vim.keymap.set("n", "<leader>dc", dap.continue, { desc = "Start debugging" })
|
||||
end,
|
||||
}
|
5
nvim.bak/lua/config/plugins/core/image.lua
Normal file
5
nvim.bak/lua/config/plugins/core/image.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"3rd/image.nvim",
|
||||
build = false, -- so that it doesn't build the rock https://github.com/3rd/image.nvim/issues/91#issuecomment-2453430239
|
||||
opts = {}
|
||||
}
|
190
nvim.bak/lua/config/plugins/core/neo-tree.lua
Normal file
190
nvim.bak/lua/config/plugins/core/neo-tree.lua
Normal file
|
@ -0,0 +1,190 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
"3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||
},
|
||||
config = function()
|
||||
require("neo-tree").setup({
|
||||
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
|
||||
popup_border_style = "rounded",
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
|
||||
sort_case_insensitive = false, -- used when sorting files and directories in the tree
|
||||
sort_function = nil, -- use a custom function for sorting files and directories in the tree
|
||||
-- sort_function = function (a,b)
|
||||
-- if a.type == b.type then
|
||||
-- return a.path > b.path
|
||||
-- else
|
||||
-- return a.type > b.type
|
||||
-- end
|
||||
-- end , -- this sorts files and directories descendantly
|
||||
default_component_configs = {
|
||||
container = {
|
||||
enable_character_fade = true,
|
||||
},
|
||||
diagnostics = {
|
||||
symbols = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warn = "",
|
||||
error = "",
|
||||
},
|
||||
highlight = {
|
||||
hint = "DiagnosticSignHint",
|
||||
info = "DiagnosticSignInfo",
|
||||
warn = "DiagnosticSignWarn",
|
||||
error = "DiagnosticSignError",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 0, -- extra padding on left hand side
|
||||
-- indent guides
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
-- expander config, needed for nesting files
|
||||
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
folder_empty = "",
|
||||
provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available
|
||||
if node.type == "file" or node.type == "terminal" then
|
||||
local success, web_devicons = pcall(require, "nvim-web-devicons")
|
||||
local name = node.type == "terminal" and "terminal" or node.name
|
||||
if success then
|
||||
local devicon, hl = web_devicons.get_icon(name)
|
||||
icon.text = devicon or icon.text
|
||||
icon.highlight = hl or icon.highlight
|
||||
end
|
||||
end
|
||||
end,
|
||||
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||
-- then these will never be used.
|
||||
default = "*",
|
||||
highlight = "NeoTreeFileIcon",
|
||||
},
|
||||
modified = {
|
||||
symbol = "[+]",
|
||||
highlight = "NeoTreeModified",
|
||||
},
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
highlight = "NeoTreeFileName",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
-- Change type
|
||||
added = "✚", -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
|
||||
deleted = "✖", -- this can only be used in the git_status source
|
||||
renamed = "", -- this can only be used in the git_status source
|
||||
-- Status type
|
||||
untracked = "",
|
||||
ignored = "",
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
},
|
||||
},
|
||||
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
|
||||
file_size = {
|
||||
enabled = true,
|
||||
width = 12, -- width of the column
|
||||
required_width = 64, -- min width of window required to show this column
|
||||
},
|
||||
type = {
|
||||
enabled = true,
|
||||
width = 10, -- width of the column
|
||||
required_width = 122, -- min width of window required to show this column
|
||||
},
|
||||
last_modified = {
|
||||
enabled = true,
|
||||
width = 20, -- width of the column
|
||||
required_width = 88, -- min width of window required to show this column
|
||||
},
|
||||
created = {
|
||||
enabled = true,
|
||||
width = 20, -- width of the column
|
||||
required_width = 110, -- min width of window required to show this column
|
||||
},
|
||||
symlink_target = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
-- A list of functions, each representing a global custom command
|
||||
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
|
||||
-- see `:h neo-tree-custom-commands-global`
|
||||
window = {
|
||||
position = "left",
|
||||
width = 35,
|
||||
mapping_options = {
|
||||
noremap = true,
|
||||
nowait = true,
|
||||
},
|
||||
mappings = {
|
||||
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } },
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false, -- when true, they will just be displayed differently than normal items
|
||||
hide_dotfiles = true,
|
||||
hide_gitignored = false,
|
||||
hide_hidden = true, -- only works on Windows for hidden files/directories
|
||||
hide_by_name = {
|
||||
--"node_modules"
|
||||
},
|
||||
hide_by_pattern = { -- uses glob style patterns
|
||||
--"*.meta",
|
||||
--"*/src/*/tsconfig.json",
|
||||
},
|
||||
always_show = { -- remains visible even if other settings would normally hide it
|
||||
".gitignored",
|
||||
},
|
||||
always_show_by_pattern = { -- uses glob style patterns
|
||||
".env*",
|
||||
},
|
||||
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||
--".DS_Store",
|
||||
--"thumbs.db"
|
||||
},
|
||||
never_show_by_pattern = { -- uses glob style patterns
|
||||
--".null-ls_*",
|
||||
},
|
||||
},
|
||||
follow_current_file = {
|
||||
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||
-- -- the current file is changed while the tree is open.
|
||||
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||
},
|
||||
group_empty_dirs = false, -- when true, empty folders will be grouped together
|
||||
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
|
||||
-- in whatever position is specified in window.position
|
||||
-- "open_current", -- netrw disabled, opening a directory opens within the
|
||||
-- window like netrw would, regardless of window.position
|
||||
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
|
||||
-- instead of relying on nvim autocmd events.
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>er", "<cmd>Neotree filesystem reveal left<CR>", { desc = "Reveal file-tree" })
|
||||
vim.keymap.set("n", "<leader>ee", "<cmd>Neotree toggle<CR>", { desc = "Toggle file-tree" })
|
||||
vim.keymap.set("n", "<leader>ef", "<cmd>Neotree float<CR>", { desc = "Float file-tree" })
|
||||
|
||||
vim.opt.fillchars:append({ eob = " " })
|
||||
end,
|
||||
}
|
47
nvim.bak/lua/config/plugins/core/telescope.lua
Normal file
47
nvim.bak/lua/config/plugins/core/telescope.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.8",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
fzf = {},
|
||||
},
|
||||
})
|
||||
require("telescope").load_extension("fzf")
|
||||
vim.keymap.set("n", "<leader>ff", require("telescope.builtin").find_files, { desc = "Find files" })
|
||||
vim.keymap.set("n", "<leader>fb", require("telescope.builtin").buffers, { desc = "Find buffers" })
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>fs",
|
||||
require("telescope.builtin").lsp_document_symbols,
|
||||
{ desc = "Find lsp symbols" }
|
||||
)
|
||||
vim.keymap.set("n", "<leader>fo", require("telescope.builtin").oldfiles, { desc = "Find recent files" })
|
||||
vim.keymap.set("n", "<leader>fs", require("telescope.builtin").grep_string, { desc = "Find string" })
|
||||
vim.keymap.set("n", "<leader>fc", function()
|
||||
require("telescope.builtin").find_files({
|
||||
cwd = vim.fn.expand("~/.config"),
|
||||
})
|
||||
end, { desc = "Find config files" })
|
||||
require("config.telescope.multigrep").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown({}),
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").load_extension("ui-select")
|
||||
end,
|
||||
},
|
||||
}
|
35
nvim.bak/lua/config/plugins/core/tree-sitter.lua
Normal file
35
nvim.bak/lua/config/plugins/core/tree-sitter.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<leader><leader>",
|
||||
node_incremental = "<leader><leader>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.keymap.set("n", "<leader>ti", "<cmd>InspectTree<CR>", { desc = "Inspect tree-sitter" })
|
||||
end,
|
||||
},
|
||||
}
|
19
nvim.bak/lua/config/plugins/core/trouble.lua
Normal file
19
nvim.bak/lua/config/plugins/core/trouble.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" },
|
||||
opts = {
|
||||
focus = true,
|
||||
},
|
||||
cmd = "Trouble",
|
||||
keys = {
|
||||
{ "<leader>xw", "<cmd>Trouble diagnostics toggle<CR>", desc = "Open trouble workspace diagnostics" },
|
||||
{
|
||||
"<leader>xd",
|
||||
"<cmd>Trouble diagnostics toggle filter.buf=0<CR>",
|
||||
desc = "Open trouble document diagnostics",
|
||||
},
|
||||
{ "<leader>xq", "<cmd>Trouble quickfix toggle<CR>", desc = "Open trouble quickfix list" },
|
||||
{ "<leader>xl", "<cmd>Trouble loclist toggle<CR>", desc = "Open trouble location list" },
|
||||
{ "<leader>xt", "<cmd>Trouble todo toggle<CR>", desc = "Open todos in trouble" },
|
||||
},
|
||||
}
|
3
nvim.bak/lua/config/plugins/git/fugitive.lua
Normal file
3
nvim.bak/lua/config/plugins/git/fugitive.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"tpope/vim-fugitive",
|
||||
}
|
9
nvim.bak/lua/config/plugins/git/gitsigns.lua
Normal file
9
nvim.bak/lua/config/plugins/git/gitsigns.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
|
||||
vim.keymap.set("n", "<leader>gh", "<cmd>Gitsigns preview_hunk<CR>", { desc = "Preview git hunks" })
|
||||
vim.keymap.set("n", "<leader>gb", "<cmd>Gitsigns toggle_current_line_blame<CR>", { desc = "Toggle git blame" })
|
||||
end,
|
||||
}
|
20
nvim.bak/lua/config/plugins/git/lazygit.lua
Normal file
20
nvim.bak/lua/config/plugins/git/lazygit.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
-- optional for floating window border decoration
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
-- setting the keybinding for LazyGit with 'keys' is recommended in
|
||||
-- order to load the plugin when the command is run for the first time
|
||||
keys = {
|
||||
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "Open lazy git" },
|
||||
},
|
||||
}
|
68
nvim.bak/lua/config/plugins/lsp/lspconfig.lua
Normal file
68
nvim.bak/lua/config/plugins/lsp/lspconfig.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- See the configuration section for more details
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
-- default handler for installed servers
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Code action" })
|
||||
|
||||
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.declaration, { desc = "Go to declaration" }) -- go to declaration
|
||||
|
||||
vim.keymap.set("n", "<leader>co", vim.lsp.buf.rename, { desc = "Change all occurrence" }) -- smart rename
|
||||
|
||||
vim.keymap.set("n", "<leader>dp", vim.diagnostic.goto_prev, { desc = "Go to prev diagnostic" }) -- jump to previous diagnostic in buffer
|
||||
|
||||
vim.keymap.set("n", "<leader>dn", vim.diagnostic.goto_next, { desc = "Go to next diagnostic" }) -- jump to next diagnostic in buffer
|
||||
|
||||
vim.keymap.set("n", "<leader>lr", ":LspRestart<CR>", { desc = "Restart LSP" }) -- mapping to restart lsp if necessary
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = args.buf, id = client.id })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
6
nvim.bak/lua/config/plugins/lsp/mason-lspconfig.lua
Normal file
6
nvim.bak/lua/config/plugins/lsp/mason-lspconfig.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
opts = {
|
||||
auto_install = true,
|
||||
},
|
||||
}
|
33
nvim.bak/lua/config/plugins/lsp/mason.lua
Normal file
33
nvim.bak/lua/config/plugins/lsp/mason.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
return {
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup({
|
||||
ui = {
|
||||
check_outdated_packages_on_open = true,
|
||||
|
||||
---@since 1.0.0
|
||||
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
||||
border = "rounded",
|
||||
|
||||
---@since 1.0.0
|
||||
-- Width of the window. Accepts:
|
||||
-- - Integer greater than 1 for fixed width.
|
||||
-- - Float in the range of 0-1 for a percentage of screen width.
|
||||
width = 0.6,
|
||||
|
||||
---@since 1.0.0
|
||||
-- Height of the window. Accepts:
|
||||
-- - Integer greater than 1 for fixed height.
|
||||
-- - Float in the range of 0-1 for a percentage of screen height.
|
||||
height = 0.6,
|
||||
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.keymap.set("n", "<leader>m", "<cmd>Mason<CR>", { desc = "Mason" })
|
||||
end,
|
||||
}
|
14
nvim.bak/lua/config/plugins/lsp/none-ls.lua
Normal file
14
nvim.bak/lua/config/plugins/lsp/none-ls.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, { desc = "Format file" })
|
||||
end,
|
||||
}
|
10
nvim.bak/lua/config/plugins/qol/auto-pairs.lua
Normal file
10
nvim.bak/lua/config/plugins/qol/auto-pairs.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({
|
||||
disable_in_macro = false,
|
||||
disable_in_replace_mode = false,
|
||||
})
|
||||
end,
|
||||
}
|
11
nvim.bak/lua/config/plugins/qol/auto-session.lua
Normal file
11
nvim.bak/lua/config/plugins/qol/auto-session.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"rmagatti/auto-session",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("auto-session").setup({
|
||||
auto_restore_enabled = false,
|
||||
})
|
||||
vim.keymap.set("n", "<leader>sr", "<cmd>SessionRestore<CR>", { desc = "Restore session" })
|
||||
vim.keymap.set("n", "<leader>ss", "<cmd>SessionSave<CR>", { desc = "Save session" })
|
||||
end,
|
||||
}
|
6
nvim.bak/lua/config/plugins/qol/surround.lua
Normal file
6
nvim.bak/lua/config/plugins/qol/surround.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"kylechui/nvim-surround",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||
config = true,
|
||||
}
|
18
nvim.bak/lua/config/plugins/qol/vim-tmux-navigator.lua
Normal file
18
nvim.bak/lua/config/plugins/qol/vim-tmux-navigator.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
"christoomey/vim-tmux-navigator",
|
||||
cmd = {
|
||||
"TmuxNavigateLeft",
|
||||
"TmuxNavigateDown",
|
||||
"TmuxNavigateUp",
|
||||
"TmuxNavigateRight",
|
||||
"TmuxNavigatePrevious",
|
||||
"TmuxNavigatorProcessList",
|
||||
},
|
||||
keys = {
|
||||
{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>", { desc = "Tmux left" } },
|
||||
{ "<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>" },
|
||||
},
|
||||
}
|
17
nvim.bak/lua/config/plugins/qol/which-key.lua
Normal file
17
nvim.bak/lua/config/plugins/qol/which-key.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 3000
|
||||
end,
|
||||
opts = {
|
||||
preset = "modern",
|
||||
icons = {
|
||||
-- set to false to disable all mapping icons,
|
||||
-- both those explicitly added in a mapping
|
||||
-- and those from rules
|
||||
mappings = false,
|
||||
},
|
||||
},
|
||||
}
|
52
nvim.bak/lua/config/plugins/ui/alpha.lua
Normal file
52
nvim.bak/lua/config/plugins/ui/alpha.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
return {
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- Set header
|
||||
dashboard.section.header.val = {
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
|
||||
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
|
||||
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
|
||||
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
|
||||
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
|
||||
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
|
||||
" ",
|
||||
}
|
||||
|
||||
-- Set menu
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("?", "? > Help", "<cmd>WhichKey<CR>", { desc = "Help/Search backward" }),
|
||||
-- dashboard.button("SPC l", "L > Lazy", "<cmd>Lazy<CR>", { desc = "Lazy" }),
|
||||
-- dashboard.button("SPC m", "M > Mason", "<cmd>Mason<CR>", { desc = "Mason" }),
|
||||
dashboard.button(
|
||||
"SPC ee",
|
||||
" > Toggle file explorer",
|
||||
"<cmd>Neotree toggle<CR>",
|
||||
{ desc = "Toggle file tree" }
|
||||
),
|
||||
dashboard.button("SPC ff", " > Find File", "<cmd>Telescope find_files<CR>", { desc = "Find files" }),
|
||||
dashboard.button(
|
||||
"SPC sr",
|
||||
" > Restore Session",
|
||||
"<cmd>SessionRestore<CR>",
|
||||
{ desc = "Restore session" }
|
||||
),
|
||||
dashboard.button("q", " > Quit NVIM", "<cmd>quit<CR>", { desc = "Quit" }),
|
||||
}
|
||||
|
||||
-- Send config to alpha
|
||||
alpha.setup(dashboard.opts)
|
||||
|
||||
-- Disable folding on alpha buffer
|
||||
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
|
||||
end,
|
||||
}
|
16
nvim.bak/lua/config/plugins/ui/catppuccin.lua
Normal file
16
nvim.bak/lua/config/plugins/ui/catppuccin.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
integrations = {
|
||||
mason = true,
|
||||
},
|
||||
})
|
||||
-- setup must be called before loading
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
},
|
||||
}
|
5
nvim.bak/lua/config/plugins/ui/dressing.lua
Normal file
5
nvim.bak/lua/config/plugins/ui/dressing.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
enabled = false,
|
||||
event = "VeryLazy",
|
||||
}
|
9
nvim.bak/lua/config/plugins/ui/indent-blankline.lua
Normal file
9
nvim.bak/lua/config/plugins/ui/indent-blankline.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
main = "ibl",
|
||||
opts = {
|
||||
indent = { char = "¦" },
|
||||
-- indent = { char = "│" },
|
||||
},
|
||||
}
|
25
nvim.bak/lua/config/plugins/ui/lua-line.lua
Normal file
25
nvim.bak/lua/config/plugins/ui/lua-line.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "horizon",
|
||||
},
|
||||
sections = {
|
||||
lualine_b = {
|
||||
{
|
||||
"filename",
|
||||
symbols = {
|
||||
unnamed = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
15
nvim.bak/lua/config/plugins/ui/todo-comments.lua
Normal file
15
nvim.bak/lua/config/plugins/ui/todo-comments.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("todo-comments").setup()
|
||||
vim.keymap.set("n", "<leader>tn", function()
|
||||
require("todo-comments").jump_next()
|
||||
end, { desc = "Next todo comment" })
|
||||
|
||||
vim.keymap.set("n", "<leader>tp", function()
|
||||
require("todo-comments").jump_prev()
|
||||
end, { desc = "Previous todo comment" })
|
||||
end,
|
||||
}
|
54
nvim.bak/lua/config/telescope/multigrep.lua
Normal file
54
nvim.bak/lua/config/telescope/multigrep.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local make_entry = require("telescope.make_entry")
|
||||
local conf = require("telescope.config").values
|
||||
local M = {}
|
||||
|
||||
local live_multigrep = function(opts)
|
||||
opts = opts or {}
|
||||
opts.cwd = opts.cwd or vim.fn.getcwd()
|
||||
|
||||
local finder = finders.new_async_job({
|
||||
command_generator = function(prompt)
|
||||
if not prompt or prompt == "" then
|
||||
return nil
|
||||
end
|
||||
|
||||
local pieces = vim.split(prompt, " ")
|
||||
local args = { "rg" }
|
||||
|
||||
if pieces[1] then
|
||||
table.insert(args, "-e")
|
||||
table.insert(args, pieces[1])
|
||||
end
|
||||
|
||||
if pieces[2] then
|
||||
table.insert(args, "-g")
|
||||
table.insert(args, pieces[2])
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: deprecated
|
||||
return vim.tbl_flatten({
|
||||
args,
|
||||
{ "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" },
|
||||
})
|
||||
end,
|
||||
entry_maker = make_entry.gen_from_vimgrep(opts),
|
||||
cwd = opts.cwd,
|
||||
})
|
||||
pickers
|
||||
.new(opts, {
|
||||
debounce = 100,
|
||||
prompt_title = "Multi Grep",
|
||||
finder = finder,
|
||||
previewer = conf.grep_previewer(opts),
|
||||
sorter = require("telescope.sorters").empty(),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
vim.keymap.set("n", "<leader>fg", live_multigrep, { desc = "Multi grep" })
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue