chezmoi: reorganise repo

This commit is contained in:
js0ny 2025-09-27 15:28:09 +01:00
parent b391e03c87
commit 67a78879db
278 changed files with 102 additions and 182 deletions

View file

@ -0,0 +1,100 @@
-- https://stackoverflow.com/a/73365602
vim.api.nvim_create_autocmd("TextYankPost", {
group = vim.api.nvim_create_augroup("highlight_yank", {}),
desc = "Hightlight selection on yank",
pattern = "*",
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 500 })
end,
})
return {
-- Colorschemes
{
"catppuccin/nvim",
name = "catppuccin",
lazy = true,
opts = {
flavor = "auto",
background = {
light = "latte",
dark = "mocha",
},
integrations = {
-- lualine = true,
"lualine",
"blink_cmp"
},
},
},
{
"rose-pine/neovim",
name = "rose-pine",
opts = {
variant = "dawn",
},
cmd = "FzfLua colorschemes",
},
{ "rebelot/kanagawa.nvim", cmd = "FzfLua colorschemes" },
{ -- Modern Status Line
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
event = "VeryLazy",
config = function()
require("plugins.mod.lualine")
end,
},
-- { -- Breadcrumb
-- "Bekaboo/dropbar.nvim",
-- dependencies = {
-- "nvim-telescope/telescope-fzf-native.nvim",
-- build = "make",
-- },
-- opts = {},
-- keys = {
-- {
-- "<Leader>+",
-- function()
-- require("dropbar.api").pick()
-- end,
-- desc = "Pick symbols in winbar",
-- },
-- {
-- "[;",
-- function()
-- require("dropbar.api").goto_context_start()
-- end,
-- desc = "Go to start of current context",
-- },
-- {
-- "];",
-- function()
-- require("dropbar.api").select_next_context()
-- end,
-- desc = "Select next context",
-- },
-- },
-- },
{ import = "plugins.mod.bufferline" }, -- Buffer Top Bar
{ -- Git Blames, Changes
"lewis6991/gitsigns.nvim",
opts = {
current_line_blame = true,
},
event = "BufReadPre",
keys = {
{ "<leader>gb", "<cmd>Gitsigns blame<CR>", desc = "Blame file" },
{ "<leader>gd", "<cmd>Gitsigns diffthis<CR>", desc = "Diff file" },
{ "<leader>gB", "<cmd>Gitsigns toggle_current_line_blame<CR>", desc = "Toggle line blame" },
{ "[g", "<cmd>Gitsigns prev_hunk<CR>", desc = "Prev hunk" },
{ "]g", "<cmd>Gitsigns next_hunk<CR>", desc = "Next hunk" },
},
},
-- { -- Highlight and navigate between TODOs
-- "folke/todo-comments.nvim",
-- cmd = { "TodoTelescope" },
-- event = "BufRead",
-- opts = {},
-- dependencies = { "nvim-lua/plenary.nvim" },
-- },
}

View file

@ -0,0 +1,24 @@
return {
{ import = "plugins.mod.blink-cmp" },
-- { import = "plugins.mod.nvim-cmp" },
{
"L3MON4D3/LuaSnip",
build = "make install_jsregexp",
event = "InsertEnter",
config = function()
require("luasnip.loaders.from_vscode").lazy_load({ paths = "~/.config/lsp-snippets" })
require("luasnip").setup({
history = true,
enable_autosnippets = true,
})
end,
},
{
"js0ny/luasnip-latex-snippets.nvim",
dependencies = { "L3MON4D3/LuaSnip", "lervag/vimtex" },
ft = { "tex", "latex", "markdown", "org" },
opts = {},
-- dev = true,
-- dir = "~/Source/Forks/luasnip-latex-snippets.nvim/"
}
}

View file

@ -0,0 +1,43 @@
-- Debugger setups
return {
{
"mfussenegger/nvim-dap",
event = "BufReadPre",
config = function()
local dap = require("dap")
dap.adapters.codelldb = {
type = "executable",
command = "codelldb",
}
dap.configurations.cpp = {
{
name = "Launch file",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
},
}
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
end,
},
{
"rcarriga/nvim-dap-ui",
opts = {},
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
cmd = "DapNew",
},
{ "theHamsta/nvim-dap-virtual-text", opts = {}, cmd = "DapNew" },
{
"mfussenegger/nvim-dap-python",
event = "BufReadPost",
ft = "python",
config = function()
require("dap-python").setup("uv")
end,
},
}

View file

@ -0,0 +1,46 @@
return {
{
"folke/flash.nvim",
event = "BufEnter",
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
},
{ import = "plugins.mod.img-clip" },
{ import = "plugins.mod.mc" }, -- Multiple-cursors
{ import = "plugins.mod.autopairs" },
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "BufEnter",
opts = {},
},
{
"MagicDuck/grug-far.nvim",
opts = { headerMaxWidth = 80 },
cmd = "GrugFar",
keys = {
{
"<leader>fF",
function()
local grug = require("grug-far")
local ext = vim.bo.buftype == "" and vim.fn.expand("%:e")
grug.open({
transient = true,
prefills = {
filesFilter = ext and ext ~= "" and "*." .. ext or nil,
},
})
end,
mode = { "n", "v" },
desc = "Search and Replace",
},
},
},
}

View file

@ -0,0 +1,39 @@
return {
{
"rmagatti/auto-session",
event = "BufReadPre",
cmd = {
"SessionSearch",
"SessionSave",
},
opts = {
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
},
},
-- { import = "plugins.mod.nvim-tree" },
-- { import = "plugins.mod.telescope" },
{ import = "plugins.mod.fzf" },
-- {
-- "ahmedkhalf/project.nvim",
-- event = "VeryLazy",
-- opts = {
-- detection_methods = { "lsp", "pattern" },
-- patterns = { ".git", "Makefile", "package.json" },
-- sync_root_with_cwd = true,
-- silent_chdir = true,
-- scope_chdir = "global",
-- },
-- config = function()
-- require("telescope").load_extension("projects")
-- end,
-- dependencies = { "nvim-telescope/telescope.nvim" },
-- },
-- {
-- "NeogitOrg/neogit",
-- config = true,
-- cmd = {
-- "Neogit",
-- },
-- },
{ import = "plugins.mod.neo-tree" }
}

View file

@ -0,0 +1,15 @@
require("plugins.lazy-nvim")
-- Setup lazy.nvim
require("lazy").setup({
spec = {
{ import = "plugins.appearance" },
{ import = "plugins.completion" },
{ import = "plugins.fileutils" },
{ import = "plugins.lang" },
{ import = "plugins.dap" },
{ import = "plugins.edit" },
{ import = "plugins.misc" },
},
checker = { enabled = false },
})

View file

@ -0,0 +1,12 @@
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "*.bean",
callback = function()
vim.bo.filetype = "beancount"
end,
})
return {
"nathangrigg/vim-beancount",
ft = "beancount",
}

View file

@ -0,0 +1,22 @@
return {
{ import = "plugins.lang.org" },
{ import = "plugins.lang.markdown" },
{ import = "plugins.lang.just" },
{ import = "plugins.lang.typst" },
{ import = "plugins.lang.beancount" },
{ import = "plugins.lang.tex" },
{ import = "plugins.lang.lua" },
{ import = "plugins.lang.treesitter" },
{ import = "plugins.mod.trouble-nvim" },
-- Remove mason and use system package manager
-- {
-- "williamboman/mason.nvim",
-- cmd = "Mason",
-- build = ":MasonUpdate",
-- -- opts_extend = { "ensure_installed" },
-- opts = {
-- -- ensure_installed = require("config.servers").servers,
-- },
-- },
{ import = "plugins.mod.conform-nvim" },
}

View file

@ -0,0 +1,4 @@
return {
"NoahTheDuke/vim-just",
ft = { "just" },
}

View file

@ -0,0 +1,9 @@
return {
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
}

View file

@ -0,0 +1,6 @@
return {
{ import = "plugins.lang.markdown.render-markdown" },
-- { import = "plugins.mod.lang.markdown.markview" },
{ import = "plugins.lang.markdown.obsidian-nvim" },
{ "bullets-vim/bullets.vim", ft = "markdown" },
}

View file

@ -0,0 +1,29 @@
-- This won't be loaded
-- I keep this since render-markdown sometimes buggy
return {
{
"OXY2DEV/markview.nvim",
lazy = false,
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
opts = {
checkboxes = require("markview-presets").checkboxes.nerd,
headings = {
enable = true,
shift_width = 1,
heading_1 = {
style = "label",
hl = "MarkviewH1",
},
},
code_blocks = {
style = "language",
language_direction = "right",
hl = "MarkviewCode",
info_hl = "MarkviewCodeInfo",
},
},
},
}

View file

@ -0,0 +1,145 @@
local uuid = function()
local template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function(c)
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
return string.format('%x', v)
end)
end
return {
"obsidian-nvim/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
-- lazy = false,
ft = "markdown",
cmd = {
"ObsidianNewFromTemplate",
"ObsidianToggleCheckbox",
"ObsidianQuickSwitch",
"ObsidianExtractNote",
"ObsidianFollowLink",
"ObsidianBacklinks",
"ObsidianWorkspace",
"ObsidianYesterday",
"ObsidianPasteImg",
"ObsidianTomorrow",
"ObsidianTemplate",
"ObsidianDailies",
"ObsidianLinkNew",
"ObsidianRename",
"ObsidianSearch",
"ObsidianCheck",
"ObsidianLinks",
"ObsidianToday",
"ObsidianDebug",
"ObsidianOpen",
"ObsidianTags",
"ObsidianLink",
"ObsidianNew",
"ObsidianTOC",
},
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
-- -- refer to `:h file-pattern` for more examples
-- "BufReadPre path/to/my-vault/*.md",
-- "BufNewFile path/to/my-vault/*.md",
-- },
keys = {
{ "<leader>fo", "<cmd>ObsidianQuickSwitch<CR>", desc = "Obsidian: Quick Switch" },
},
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
-- see below for full list of optional dependencies 👇
"ibhagwan/fzf-lua",
},
opts = {
workspaces = {
{
name = "personal",
path = "~/Obsidian",
},
},
completion = {
nvim_cmp = false,
blink = true,
min_chars = 2,
},
ui = {
enable = false,
},
templates = {
folder = "_Global/LuaTemplates",
date_format = "%Y-%m-%d",
time_format = "%H:%M",
substitutions = {
yesterday = function()
return os.date("%Y-%m-%d", os.time() - 86400)
end,
uuid = uuid()
},
},
---@return table
note_frontmatter_func = function(note)
-- Add the title of the note as an alias.
if note.title then
note:add_alias(note.title)
end
-- Force to use UUID as the note id.
local note_id
if note.metadata then
note_id = note.id
else
note_id = uuid()
end
local out = {
id = note_id,
aliases = note.aliases,
tags = note.tags,
title = note.id,
date = os.date(
"%Y-%m-%dT00:00:00"),
}
-- `note.metadata` contains any manually added fields in the frontmatter.
-- So here we just make sure those fields are kept in the frontmatter.
if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
for k, v in pairs(note.metadata) do
out[k] = v
end
end
-- Force to update mtime.
out.mtime = os.date("%Y-%m-%dT%H:%M:%S")
return out
end,
daily_notes = {
folder = "_Global/Periodic",
date_format = "%Y-%m-%d",
default_tags = { "daily" },
template = nil,
},
-- see below for full list of options 👇
attachments = {
img_folder = "_Global/Assets",
img_name_func = function()
return string.format("%s-", os.time())
end,
},
mappings = {
["<cr>"] = {
action = function()
require("obsidian").util.smart_action()
end,
opts = { buffer = true, expr = true },
},
},
new_notes_location = "current_dir",
},
}

View file

@ -0,0 +1,74 @@
return {
{
"MeanderingProgrammer/render-markdown.nvim",
event = "BufRead",
ft = { "markdown", "Avante" },
opts = {
file_types = { "markdown", "Avante" },
render_modes = { "n", "c", "t" },
latex = {
-- enabled = true,
enabled = false,
converter = "latex2text",
highlight = "RenderMarkdownMath",
top_pad = 0,
bottom_pad = 0,
},
-- heading = {
-- position = "overlay",
-- width = "block",
-- left_margin = 0.5,
-- left_pad = 0.2,
-- right_pad = 0.2,
-- },
link = {
custom = {
python = { pattern = "%.py", icon = "" },
lua = { pattern = "%.lua", icon = "" },
markdown = { pattern = "%.md", icon = "" },
},
},
bullet = {
icons = { "󰮯 ", "", "", "", "" },
},
checkbox = {
checked = { scope_highlight = "@markup.strikethrough" },
unchecked = { scope_highlight = "@comment.todo" },
},
code = {
position = "right",
width = "block",
right_pad = 10,
},
callout = {
note = { raw = "[!NOTE]", rendered = "󰋽 Note", highlight = "RenderMarkdownInfo" },
tip = { raw = "[!TIP]", rendered = "󰌶 Tip", highlight = "RenderMarkdownSuccess" },
important = { raw = "[!IMPORTANT]", rendered = "󰅾 Important", highlight = "RenderMarkdownHint" },
warning = { raw = "[!WARNING]", rendered = "󰀪 Warning", highlight = "RenderMarkdownWarn" },
caution = { raw = "[!CAUTION]", rendered = "󰳦 Caution", highlight = "RenderMarkdownError" },
abstract = { raw = "[!ABSTRACT]", rendered = "󰨸 Abstract", highlight = "RenderMarkdownInfo" },
summary = { raw = "[!SUMMARY]", rendered = "󰨸 Summary", highlight = "RenderMarkdownInfo" },
tldr = { raw = "[!TLDR]", rendered = "󰨸 Tldr", highlight = "RenderMarkdownInfo" },
info = { raw = "[!INFO]", rendered = "󰋽 Info", highlight = "RenderMarkdownInfo" },
todo = { raw = "[!TODO]", rendered = "󰗡 Todo", highlight = "RenderMarkdownInfo" },
hint = { raw = "[!HINT]", rendered = "󰌶 Hint", highlight = "RenderMarkdownSuccess" },
success = { raw = "[!SUCCESS]", rendered = "󰄬 Success", highlight = "RenderMarkdownSuccess" },
check = { raw = "[!CHECK]", rendered = "󰄬 Check", highlight = "RenderMarkdownSuccess" },
done = { raw = "[!DONE]", rendered = "󰄬 Done", highlight = "RenderMarkdownSuccess" },
question = { raw = "[!QUESTION]", rendered = "󰘥 Question", highlight = "RenderMarkdownWarn" },
help = { raw = "[!HELP]", rendered = "󰘥 Help", highlight = "RenderMarkdownWarn" },
faq = { raw = "[!FAQ]", rendered = "󰘥 Faq", highlight = "RenderMarkdownWarn" },
attention = { raw = "[!ATTENTION]", rendered = "󰀪 Attention", highlight = "RenderMarkdownWarn" },
failure = { raw = "[!FAILURE]", rendered = "󰅖 Failure", highlight = "RenderMarkdownError" },
fail = { raw = "[!FAIL]", rendered = "󰅖 Fail", highlight = "RenderMarkdownError" },
missing = { raw = "[!MISSING]", rendered = "󰅖 Missing", highlight = "RenderMarkdownError" },
danger = { raw = "[!DANGER]", rendered = "󱐌 Danger", highlight = "RenderMarkdownError" },
error = { raw = "[!ERROR]", rendered = "󱐌 Error", highlight = "RenderMarkdownError" },
bug = { raw = "[!BUG]", rendered = "󰨰 Bug", highlight = "RenderMarkdownError" },
example = { raw = "[!EXAMPLE]", rendered = "󰉹 Example", highlight = "RenderMarkdownHint" },
quote = { raw = "[!QUOTE]", rendered = "󱆨 Quote", highlight = "RenderMarkdownQuote" },
cite = { raw = "[!CITE]", rendered = "󱆨 Cite", highlight = "RenderMarkdownQuote" },
},
},
},
}

View file

@ -0,0 +1,88 @@
return {
{
"nvim-orgmode/orgmode",
dependencies = {
-- "nvim-telescope/telescope.nvim",
-- "nvim-orgmode/telescope-orgmode.nvim",
"nvim-orgmode/org-bullets.nvim",
"Saghen/blink.cmp",
},
cmd = {
"Org",
},
ft = {
"org",
"orgagenda",
},
keys = {
{ "<leader>A", "<cmd>Org agenda<CR>", desc = "Org Agenda" },
},
event = "BufEnter *.org",
config = function()
require("orgmode").setup({
org_agenda_files = "~/OrgFiles/tasks/*",
org_default_notes_file = "~/OrgFiles/tasks/inbox.org",
org_archive_location = "~/OrgFiles/.archive/%s_archive::",
org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" },
org_hide_leading_stars = true,
org_hide_emphasis_markers = true,
org_log_into_drawer = "LOGBOOK",
org_highlight_latex_and_related = "native",
org_startup_indented = true,
org_deadline_warning_days = 10,
mappings = {
agenda = {
org_agenda_schedule = "<C-c><C-s>",
org_agenda_deadline = "<C-c><C-d>",
org_agenda_todo = "<C-c><C-t>",
org_agenda_set_tags = "<C-c><C-c>",
org_agenda_earlier = { "[[", "<" },
org_agenda_later = { "]]", ">" },
org_agenda_archive = "$",
},
org = {
org_deadline = "<C-c><C-d>",
org_schedule = "<C-c><C-s>",
org_todo = "<C-c><C-t>",
org_set_tags_command = "<C-c><C-c>",
org_archive_subtree = "<C-c>$",
},
},
})
require("org-bullets").setup()
require("blink.cmp").setup({
sources = {
per_filetype = {
org = { "orgmode" },
},
providers = {
orgmode = {
name = "Orgmode",
module = "orgmode.org.autocompletion.blink",
fallbacks = { "buffer" },
},
},
},
})
-- require("telescope").setup()
-- require("telescope").load_extension("orgmode")
-- vim.keymap.set("n", "<leader>r", require("telescope").extensions.orgmode.refile_heading)
-- vim.keymap.set("n", "<leader>oP", require("telescope").extensions.orgmode.search_headings)
vim.keymap.set("n", "<leader>op", "<cmd>FzfLua files cwd=~/OrgFiles<CR>")
-- vim.keymap.set("n", "<leader>li", require("telescope").extensions.orgmode.insert_link)
end,
},
-- {
-- dir = "~/Source/org-pomodoro.nvim",
-- name = "org-pomodoro.nvim",
-- lazy = false,
-- opts = {},
-- dependencies = {
-- "nvim-orgmode/orgmode",
-- },
-- cmd = {
-- "OrgPomodoro",
-- },
-- },
}

View file

@ -0,0 +1,7 @@
return {
"lervag/vimtex",
ft = { "tex", "bib" },
init = function()
vim.g.vimtex_view_method = "okular"
end,
}

View file

@ -0,0 +1,23 @@
return {
{ "nvim-treesitter/nvim-treesitter-context", lazy = true },
{
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
cmd = {
"TSInstall",
"TSUpdate",
"TSUpdateSync",
},
event = {
"BufReadPre",
},
opts = {
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline", "latex" },
highlight = { enable = true },
indent = { enable = true },
},
config = function()
require('nvim-treesitter.configs').setup({ highlight = { enable = true } })
end
},
}

View file

@ -0,0 +1,6 @@
return {
'chomosuke/typst-preview.nvim',
ft = { 'typst' },
version = '1.*',
opts = {}, -- lazy.nvim will implicitly calls `setup {}`
}

View file

@ -0,0 +1,22 @@
-- 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)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

View file

@ -0,0 +1,28 @@
return {
{ "nvim-lua/plenary.nvim", lazy = true },
{ "wakatime/vim-wakatime", lazy = false },
{ import = "plugins.mod.toggleterm" },
{ import = "plugins.mod.which-keys-nvim" },
{ import = "plugins.mod.copilot-lua" },
{ import = "plugins.mod.avante-nvim" },
{
"kawre/leetcode.nvim",
build = ":TSUpdate html", -- if you have `nvim-treesitter` installed
cmd = {
"Leet",
},
lazy = true,
-- event = "VeryLazy",
dependencies = {
-- "nvim-telescope/telescope.nvim",
"ibhagwan/fzf-lua",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
},
opts = {
-- configuration goes here
},
},
{ import = "plugins.mod.image-nvim" },
{ import = "plugins.mod.snacks-nvim" },
}

View file

@ -0,0 +1,56 @@
-- alpha-nvim.lua
return {
{
"goolord/alpha-nvim",
dependencies = {},
keys = {
{ "<leader>ba", "<cmd>Alpha<CR>", desc = "Toggle Alpha Dashboard" },
},
cmd = {
"Alpha",
},
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
" ",
"================= =============== =============== ======== ========",
"\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //",
"||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||",
"|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||",
"||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||",
"|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||",
"||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||",
"|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||",
"||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||",
"|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||",
"|| `' || || `' || || `' || || | \\ / | ||",
"|| .===' `===. .==='.`===. .===' /==. | \\/ | ||",
"|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||",
"|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||",
"|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||",
"||.==' _-' `' | /==.||",
"==' _-' j s 0 n y N E O V I M \\/ `==",
"\\ _-' `-_ /",
" `'' ``' ",
}
dashboard.section.buttons.val.leader = "SPC"
dashboard.section.buttons.val = {
-- leader = "SPC",
dashboard.button("p", "󰈞 查找项目", "<cmd>Telescope projects<CR>"),
dashboard.button("h", " 历史文件", "<cmd>Telescope oldfiles<CR>"),
dashboard.button("l", " 加载会话", "<cmd>SessionSearch<CR>"),
-- FIXME: This does not work on Windows - Make it more portable
dashboard.button("c", " 转到设置", "<cmd>Telescope find_files cwd=~/.config/nvim<CR>"),
dashboard.button("SPC q", "󱊷 退出", "<cmd>qa<CR>"),
}
dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " "
dashboard.config.opts.noautocmd = true
-- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']]
alpha.setup(dashboard.config)
end,
},
}

View file

@ -0,0 +1,21 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
local npairs = require("nvim-autopairs")
local Rule = require("nvim-autopairs.rule")
npairs.setup()
npairs.add_rule(Rule("$", "$", "markdown"))
npairs.add_rule(Rule("\\(", "\\)", "tex"))
npairs.add_rule(Rule("\\[", "\\]", "tex"))
npairs.add_rules({
Rule("%(", "%)", "cmd"):with_pair(function(opts)
if vim.fn.getcmdtype() == ":" then
return true
end
end),
})
end,
}

View file

@ -0,0 +1,35 @@
return {
"yetone/avante.nvim",
event = "BufRead",
-- lazy = false,
version = false, -- Set this to "*" to always pull the latest release version, or set it to false to update to the latest code changes.
opts = {
-- add any opts here
-- for example
provider = "openai",
openai = {
endpoint = "https://aihubmix.com/v1",
model = "claude-3-7-sonnet-20250219", -- your desired model (or use gpt-4o, etc.)
timeout = 30000, -- timeout in milliseconds
temperature = 0, -- adjust if needed
max_tokens = 4096,
-- reasoning_effort = "high" -- only supported for "o" models
},
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
-- "nvim-telescope/telescope.nvim", -- for file_selector provider telescope
"ibhagwan/fzf-lua",
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
"zbirenbaum/copilot.lua", -- for providers='copilot'
"HakonHarnes/img-clip.nvim",
},
}

View file

@ -0,0 +1,79 @@
return {
"saghen/blink.cmp",
-- optional: provides snippets for the snippet source
-- dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" },
-- use a release tag to download pre-built binaries
version = "*",
event = "InsertEnter",
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
enabled = function()
if vim.fn.getcmdtype() ~= "" then
return true
end
return not vim.tbl_contains({ "TelescopePrompt", "dap-repl", "snacks_picker_list" }, vim.bo.filetype)
end,
keymap = {
preset = "default",
["<Tab>"] = {
function(cmp)
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_and_accept()
end
end,
"snippet_forward",
"fallback",
},
["<C-f>"] = { "select_and_accept" },
["<C-b>"] = { "hide", "fallback" },
["<CR>"] = { "accept", "fallback" },
},
completion = {
menu = { border = "single" },
documentation = { window = { border = "single" } },
},
signature = { window = { border = "single" } },
appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = "normal",
},
snippets = {
preset = "luasnip",
},
sources = {
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
per_filetype = {
org = { "orgmode" },
},
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
score_offset = 100,
},
orgmode = {
name = "Orgmode",
module = "orgmode.org.autocompletion.blink",
fallbacks = { "buffer" },
},
},
},
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
--
-- See the fuzzy documentation for more information
fuzzy = { implementation = "prefer_rust_with_warning" },
},
opts_extend = { "sources.default" },
}

View file

@ -0,0 +1,55 @@
local function get_highlight()
if vim.g.colors_name == "catppuccin" then
return require("catppuccin.groups.integrations.bufferline").get()
elseif vim.g.colors_name == "rose-pine" then
return require("rose-pine.plugins.bufferline")
end
end
return {
"akinsho/bufferline.nvim",
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
after = "catppuccin",
event = "VeryLazy",
keys = {
{ "<leader>b1", "<cmd>BufferLineGotoBuffer 1<CR>", desc = "Switch to Buffer #1" },
{ "<leader>b2", "<cmd>BufferLineGotoBuffer 2<CR>", desc = "Switch to Buffer #2" },
{ "<leader>b3", "<cmd>BufferLineGotoBuffer 3<CR>", desc = "Switch to Buffer #3" },
{ "<leader>b4", "<cmd>BufferLineGotoBuffer 4<CR>", desc = "Switch to Buffer #4" },
{ "<leader>b5", "<cmd>BufferLineGotoBuffer 5<CR>", desc = "Switch to Buffer #5" },
{ "<leader>b6", "<cmd>BufferLineGotoBuffer 6<CR>", desc = "Switch to Buffer #6" },
{ "<leader>b7", "<cmd>BufferLineGotoBuffer 7<CR>", desc = "Switch to Buffer #7" },
{ "<leader>b8", "<cmd>BufferLineGotoBuffer 8<CR>", desc = "Switch to Buffer #8" },
{ "<leader>b9", "<cmd>BufferLineGotoBuffer 9<CR>", desc = "Switch to Buffer #9" },
{ "<leader>bb", "<cmd>BufferLinePick<CR>", desc = "Quick Switch Buffers" },
{ "<leader>bD", "<cmd>BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>bxx", "<cmd>BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>bxh", "<cmd>BufferLineCloseLeft<CR>", desc = "Delete Buffers Left" },
{ "<leader>bxi", "<cmd>BufferLineCloseRight<CR>", desc = "Delete Buffers Right" },
{ "<leader>bX", "<cmd>BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>bt", "<cmd>BufferLineTogglePin<CR>", desc = "Pin Buffer" },
},
opts = {
options = {
indicator = {
icon = "", -- this should be omitted if indicator style is not 'icon'
style = "icon",
},
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local icon = level:match("error") and "" or ""
return " " .. icon .. count
end,
show_buffer_icons = true,
numbers = "ordinal", -- 显示 buffer 序号
close_command = "bdelete! %d", -- 关闭 buffer 的命令
right_mouse_command = "bdelete! %d", -- 右键关闭
offsets = {
{ filetype = "NvimTree", text = "资源管理器", text_align = "center" },
},
separator_style = "thin",
},
highlights = get_highlight(),
},
}

View file

@ -0,0 +1,38 @@
return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
-- This will provide type hinting with LuaLS
---@module "conform"
---@type conform.setupOpts
opts = {
-- Define your formatters
formatters_by_ft = {
lua = { "stylua" },
python = { "isort", "black" },
javascript = { "prettierd", "prettier", stop_after_first = true },
},
-- Set default options
default_format_opts = {
lsp_format = "fallback",
},
-- Set up format-on-save
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_format = "fallback" }
end,
-- Customize formatters
formatters = {
shfmt = {
prepend_args = { "-i", "2" },
},
},
},
init = function()
-- If you want the formatexpr, here is the place to set it
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
}

View file

@ -0,0 +1,23 @@
return {
"zbirenbaum/copilot.lua",
cmd = "Copilot",
build = ":Copilot auth",
event = "BufReadPost",
opts = {
suggestion = {
enabled = not vim.g.ai_cmp,
auto_trigger = true,
hide_during_completion = vim.g.ai_cmp,
keymap = {
accept = "<M-f>",
next = "<M-]>",
prev = "<M-[>",
},
},
panel = { enabled = false },
filetypes = {
markdown = true,
help = true,
},
},
}

View file

@ -0,0 +1,30 @@
return {
"ibhagwan/fzf-lua",
-- optional for icon support
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = "FzfLua",
keys = {
{ "<leader><leader>", "<cmd>FzfLua files<CR>", desc = "Find Files" },
{ "<leader>fc", "<cmd>FzfLua files cwd=~/.config/nvim<CR>", desc = "Edit configs" },
{ "<leader>/", "<cmd>FzfLua live_grep<CR>", desc = "Grep Files" },
{ "<leader>;", "<cmd>FzfLua<CR>", desc = "Show Telescope Commands" },
{ "<leader>ui", "<cmd>FzfLua colorschemes<CR>", desc = "Change colorscheme" },
-- find_files { "<leader>pp", "<cmd>FzfLua projects<CR>", desc = "Listfind_files all Projects" },
{ "<leader>pd", "<cmd>FzfLua zoxide<CR>", desc = "List recent directories" },
-- { "<leader>pg", "<cmd>FzfLua projects<CR>", desc = "List all Git Projects" },
{ "<leader>ps", "<cmd>FzfLua session-lens<CR>", desc = "List all sessions" },
{ "<leader>gs", "<cmd>FzfLua git_status<CR>", desc = "Git Status" },
{ "<leader>gt", "<cmd>FzfLua git_branches<CR>", desc = "Git Branches" },
{ "<leader>gc", "<cmd>FzfLua git_commits<CR>", desc = "Show commits" },
{ "<leader>fb", "<cmd>FzfLua buffers<CR>", desc = "List Buffers" },
{ "<leader>ff", "<cmd>FzfLua fd<CR>", desc = "Find Files" },
{ "<leader>fh", "<cmd>FzfLua oldfiles<CR>", desc = "Recent Files" },
{ "<leader>ce", "<cmd>FzfLua diagnostics<CR>", desc = "Navigate errors/warnings" },
{ "<leader>cs", "<cmd>FzfLua treesitter<CR>", desc = "Search symbols" },
{ "<leader>cS", "<cmd>FzfLua grep_string<CR>", desc = "Search current symbol" },
{ "<leader>bB", "<cmd>FzfLua buffers<CR>", desc = "List Buffers" },
{ "<leader>fl", "<cmd>FzfLua filetypes<CR>", desc = "Set Filetype/Lang to ..." },
{ "<leader>R", "<cmd>FzfLua resume<CR>", desc = "Resume FzfLua" },
},
opts = {},
}

View file

@ -0,0 +1,58 @@
return {
"lewis6991/hover.nvim",
opts = {
init = function()
-- Require providers
require("hover.providers.lsp")
-- require('hover.providers.gh')
-- require('hover.providers.gh_user')
-- require('hover.providers.jira')
-- require('hover.providers.dap')
-- require('hover.providers.fold_preview')
require("hover.providers.diagnostic")
-- require('hover.providers.man')
-- require('hover.providers.dictionary')
end,
preview_opts = {
border = "single",
},
-- Whether the contents of a currently open hover window should be moved
-- to a :h preview-window when pressing the hover keymap.
preview_window = false,
title = true,
mouse_providers = {
"LSP",
},
mouse_delay = 1000,
},
keys = {
{
"gE",
function()
require("hover").hover_select()
end,
desc = "hover.nvim (select)",
},
{
"<C-p>",
function()
require("hover").hover_switch("previous")
end,
desc = "hover.nvim (previous source)",
},
{
"<C-n>",
function()
require("hover").hover_switch("next")
end,
desc = "hover.nvim (next source)",
},
{
"<MouseMove>",
function()
require("hover").hover_mouse()
end,
desc = "hover.nvim (mouse)",
},
},
}

View file

@ -0,0 +1,18 @@
-- 2025-03-03
-- If current session is not spawn by neovide, do not load image.nvim
-- neovide did not support image viewer yet
-- https://github.com/neovide/neovide/issues/2088
-- Disable on: Neovide, alacritty and windows
if vim.g.neovide then
return {}
elseif vim.env.TERM_PROGRAM == "alacritty" then
return {}
elseif vim.loop.os_uname().sysname:lower() == "windows_nt" then
return {}
else
return {
"3rd/image.nvim",
opts = {},
event = "BufReadPre",
}
end

View file

@ -0,0 +1,30 @@
return {
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
ft = { "avante", "markdown", "typst", "org", "tex" },
cmd = "PasteImage",
keys = {
{
"<localleader>p",
function()
require("img-clip").paste_image()
end,
desc = "Paste Image",
}
},
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
}
}
}

View file

@ -0,0 +1,141 @@
local M = {}
local colors = require("config.colors")
local icons = require("config.icons")
local function diff_source()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end
M.mode = {
function()
return ""
end,
-- color = mode_color_bg,
}
M.git = {
"branch",
icon = icons.git.Branch,
color = { fg = colors.scheme.violet, gui = "bold" },
}
M.diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
symbols = {
error = icons.diagnostics.Error .. " ",
warn = icons.diagnostics.Warning .. " ",
info = icons.diagnostics.Information .. " ",
hint = icons.diagnostics.Hint .. " ",
},
}
M.lsp = {
-- Lsp server name .
function()
local msg = "LSP Inactive"
local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 })
local clients = vim.lsp.get_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return msg
end,
icon = icons.lsp,
color = { fg = colors.scheme.yellow, gui = "italic" },
}
M.filetype = {
function()
return vim.bo.filetype
end,
color = { fg = colors.scheme.blue, gui = "bold" },
}
M.eol = {
function()
return vim.bo.eol == true and icons.eol or ""
end,
color = { fg = colors.scheme.red },
}
M.command = {
"command",
color = { fg = colors.scheme.green, gui = "bold" },
}
M.encoding = {
"o:encoding",
color = { fg = colors.scheme.green, gui = "bold" },
}
M.indent = {
function()
local shiftwidth = vim.api.nvim_get_option_value("shiftwidth", { buf = 0 })
return icons.indent .. " " .. shiftwidth
end,
padding = 1,
}
M.diff = {
"diff",
source = diff_source,
-- symbols = { added = " ", modified = "󰝤 ", removed = " " },
symbols = {
added = icons.git.Add .. " ",
modified = icons.git.Change .. " ",
removed = icons.git.Delete .. " ",
},
padding = { left = 2, right = 1 },
diff_color = {
added = { fg = colors.scheme.green },
modified = { fg = colors.scheme.yellow },
removed = { fg = colors.scheme.red },
},
cond = nil,
}
M.progress = {
"progress",
}
-- TODO: Implement orgmode
M.orgmode = {
function()
return _G.orgmode.statusline()
end,
}
-- local conditions = {
-- buffer_not_empty = function()
-- return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
-- end,
-- hide_in_width = function()
-- return vim.fn.winwidth(0) > 80
-- end,
-- check_git_workspace = function()
-- local filepath = vim.fn.expand("%:p:h")
-- local gitdir = vim.fn.finddir(".git", filepath .. ";")
-- return gitdir and #gitdir > 0 and #gitdir < #filepath
-- end,
-- }
-- local mode_color = colors.mode
--
-- local mode_color_bg = function()
-- return { fg = colors.mantle, bg = mode_color[vim.fn.mode()] }
-- end
return M

View file

@ -0,0 +1,63 @@
local lualine = require("lualine")
-- Color table for highlights
-- local colors = require("config.colors")
local components = require("plugins.mod.lualine.components")
--[[
VSCode Style:
Remote | Git Branch | Diagnostics | Command | | MID | | Line:Column | Indent | Encoding | EOL | File Type LSP | Notifications
--]]
-- Config
local config = {
options = {
disabled_filetypes = {
statusline = { "NvimTree", "alpha", "grug-far", "snacks_dashboard" },
},
-- Disable sections and component separators
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
-- theme = "catppuccin",
theme = vim.g.colors_name,
-- IDE-like Global Status
globalstaus = true,
},
sections = {
-- these are to remove the defaults
lualine_a = {
components.mode,
},
lualine_b = {
components.diff,
},
lualine_c = {
components.diagnostics,
},
lualine_x = {
components.orgmode,
components.indent,
components.encoding,
components.eol,
},
lualine_y = {
components.filetype,
components.lsp,
},
lualine_z = {
components.progress,
},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
lualine.setup(config)

View file

@ -0,0 +1,47 @@
return {
"brenton-leighton/multiple-cursors.nvim",
version = "*", -- Use the latest tagged version
-- opts = , -- This causes the plugin setup function to be called
keys = {
{ "<A-n>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "x" }, desc = "Add cursor and move down" },
{ "<A-e>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "x" }, desc = "Add cursor and move up" },
{ "<C-Up>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "i", "x" }, desc = "Add cursor and move up" },
{ "<C-Down>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "i", "x" }, desc = "Add cursor and move down" },
{ "<A-LeftMouse>", "<Cmd>MultipleCursorsMouseAddDelete<CR>", mode = { "n", "i" }, desc = "Add or remove cursor" },
},
config = function()
local normal_mode_motion = require("multiple-cursors.normal_mode.motion")
local normal_mode_edit = require("multiple-cursors.normal_mode.edit")
local visual_mode_edit = require("multiple-cursors.visual_mode.edit")
local normal_mode_mode_change = require("multiple-cursors.normal_mode.mode_change")
local visual_mode_modify_area = require("multiple-cursors.visual_mode.modify_area")
require("multiple-cursors").setup({
pre_hook = function()
require("nvim-autopairs").disable()
end,
post_hook = function()
require("nvim-autopairs").enable()
end,
custom_key_maps = {
{ { "n", "x" }, { "e", "<Up>" }, normal_mode_motion.k, "nowrap" },
{ { "n", "x" }, { "n", "<Down>" }, normal_mode_motion.j, "nowrap" },
{ { "n", "x" }, { "i", "<Right>", "<Space>" }, normal_mode_motion.l, "nowrap" },
{ { "n", "x" }, "j", normal_mode_motion.e, "nowrap" },
{ { "n", "x" }, "J", normal_mode_motion.E, "nowrap" },
{ { "n", "x" }, "gj", normal_mode_motion.ge, "nowrap" },
{ { "n", "x" }, "gJ", normal_mode_motion.gE, "nowrap" },
{ "n", "E", normal_mode_edit.J, "nowrap" },
{ "n", "gE", normal_mode_edit.gJ, "nowrap" },
{ "n", { "l", "<Insert>" }, normal_mode_mode_change.i, "nowrap" },
{ "n", "L", normal_mode_mode_change.I, "nowrap" },
{ "x", "l", visual_mode_modify_area.i, "nowrap" },
{ "x", "E", visual_mode_edit.J, "nowrap" },
{ "x", "gE", visual_mode_edit.gJ, "nowrap" },
},
})
end,
}

View file

@ -0,0 +1,89 @@
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", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information
},
lazy = false, -- neo-tree will lazily load itself
---@module "neo-tree"
---@type neotree.Config?
opts = {
window = {
mappings = {
["<space>"] = "noop",
["e"] = "noop",
["<2-LeftMouse>"] = "open",
["<cr>"] = "open",
["i"] = "open",
["<esc>"] = "cancel", -- close preview or floating neo-tree window
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } },
-- Read `# Preview Mode` for more information
-- ["i"] = "focus_preview",
["S"] = "open_split",
["s"] = "open_vsplit",
-- ["S"] = "split_with_window_picker",
-- ["s"] = "vsplit_with_window_picker",
["t"] = "open_tabnew",
-- ["<cr>"] = "open_drop",
-- ["t"] = "open_tab_drop",
["w"] = "open_with_window_picker",
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
["C"] = "close_node",
-- ['C'] = 'close_all_subnodes',
["z"] = "close_all_nodes",
--["Z"] = "expand_all_nodes",
["a"] = {
"add",
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
config = {
show_path = "none", -- "none", "relative", "absolute"
},
},
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
["d"] = "delete",
["r"] = "rename",
["b"] = "rename_basename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
-- ["c"] = {
-- "copy",
-- config = {
-- show_path = "none" -- "none", "relative", "absolute"
-- }
--}
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
["q"] = "close_window",
["R"] = "refresh",
["?"] = "show_help",
["<"] = "prev_source",
[">"] = "next_source",
["l"] = "show_file_details",
-- ["i"] = {
-- "show_file_details",
-- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`)
-- -- both options accept a string or a function that takes in the date in seconds and returns a string to display
-- -- config = {
-- -- created_format = "%Y-%m-%d %I:%M %p",
-- -- modified_format = "relative", -- equivalent to the line below
-- -- modified_format = function(seconds) return require('neo-tree.utils').relative_date(seconds) end
-- -- }
-- },
}
}
-- fill any relevant options here
},
keys = {
{
"<leader>ft",
"<cmd>Neotree toggle<CR>",
desc = "Toggle File Explorer",
}
}
}

View file

@ -0,0 +1,111 @@
return {
"hrsh7th/nvim-cmp",
-- lazy = false,
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
config = function()
local cmp = require("cmp")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local servers_module = require("config.servers")
local luasnip = require("luasnip")
local servers = servers_module.servers
local servers_config = servers_module.server_config
-- 默认 LSP 配置
local default_server_config = {
capabilities = capabilities,
}
-- local raw_keymaps = require("keymaps.cmp_map")(cmp.mapping) -- require("keymaps").cmp_nvim_keymaps(cmp.mapping)
-- local mapped = set_keymaps(raw_keymaps)
local kind_icons = require("config.icons").lsp_kind
-- 配置 nvim-cmp
cmp.setup({
formatting = {
format = function(entry, vim_item)
vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind] or "", vim_item.kind)
return vim_item
end,
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
-- cmp.mapping.preset.insert(mapped),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-f>"] = cmp.mapping.confirm({ select = true }),
["<C-b>"] = cmp.mapping.abort(),
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping(function(fallback)
if cmp.visible() then
if luasnip.expandable() then
luasnip.expand()
else
cmp.confirm({
select = true,
})
end
else
fallback()
end
end),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.confirm({ select = true })
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}, -- cmp.mapping.preset.insert(mapped),
sources = cmp.config.sources({
{ name = "copilot", priority = 10 },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "lazydev", group_index = 0 },
}, {
{ name = "buffer" },
{ name = "path" },
}),
})
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
matching = { disallow_symbol_nonprefix_matching = false },
})
end,
}

View file

@ -0,0 +1,40 @@
return {
"neovim/nvim-lspconfig",
dependencies = { "saghen/blink.cmp" },
event = {
"BufReadPost",
"BufWritePost",
"BufNewFile",
},
-- example using `opts` for defining servers
opts = {
servers = {
lua_ls = {},
bashls = {},
clangd = {},
eslint = {}, -- JavaScript
gopls = {}, -- Go
jsonls = {}, -- JSON
markdown_oxide = {}, -- Markdown
omnisharp = {}, -- C# & F#
powershell_es = {}, -- PowerShell
pyright = {}, -- Python
taplo = {}, -- TOML
rust_analyzer = {}, -- Rust
ts_ls = {}, -- TypeScript
vimls = {}, -- vimscript
yamlls = {}, -- YAML
beancount = {}, -- Beancount
},
},
config = function(_, opts)
local lspconfig = require("lspconfig")
for server, config in pairs(opts.servers) do
-- passing config.capabilities to blink.cmp merges with the capabilities in your
-- `opts[server].capabilities, if you've defined it
config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
lspconfig[server].setup(config)
end
end,

View file

@ -0,0 +1,53 @@
local function my_on_attach(bufnr)
-- local keymaps = require("config.keymaps")
local api = require("nvim-tree.api")
local default_mode = { "n" }
local keymaps = require("keymaps")
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
local function set_keymaps(maps)
for _, map in ipairs(maps) do
local mode = map.mode or default_mode
vim.keymap.set(mode, map.keys, map.cmd, map.opts)
end
end
local raw_keymaps = require("keymaps.nvim-tree").plugin(api, opts)
set_keymaps(raw_keymaps)
end
return {
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
keys = {
{ "<leader>ft", "<cmd>NvimTreeToggle<CR>", desc = "Toggle File Explorer" },
},
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
on_attach = my_on_attach,
sync_root_with_cwd = true,
respect_buf_cwd = true,
disable_netrw = true,
renderer = {
icons = {
glyphs = {
git = { -- https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt#L1077C1-L1077C29
unmerged = "",
renamed = "",
deleted = "",
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
},
},
},
},
},
}

View file

@ -0,0 +1,96 @@
-- Welcome to nvim's systemd :D
return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
dashboard = {
enabled = true,
preset = {
keys = {
-- { key = "p", icon = "󰈞 ", desc = "查找项目", action = "<cmd>Telescope projects<CR>" },
{ key = "h", icon = "", desc = "历史文件", action = "<cmd>FzfLua oldfiles<CR>" },
{ key = "l", icon = "", desc = "加载会话", action = "<cmd>SessionSearch<CR>" },
{
key = "c",
icon = "",
desc = "转到设置",
action = "<cmd>FzfLua files cwd=~/.config/nvim<CR>",
},
{ key = "q", icon = "󱊷 ", desc = "退出", action = "<cmd>qa<CR>" },
},
header = [[
================= =============== =============== ======== ========
\\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //
||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||
|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||
||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||
|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||
||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||
|| . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||
||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||
|| ||_-' || || `-_|| || || ||_-' || || | \ / | `||
|| `' || || `' || || `' || || | \ / | ||
|| .===' `===. .==='.`===. .===' /==. | \/ | ||
|| .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||
|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||
|| .==' _-' '-__\._-' '-_./__-' `' |. /| | ||
||.==' _-' `' | /==.||
==' _-' N E O V I M \/ `==
\ _-' `-_ /
`'' ``'
]],
--[[header = [[
--]]
},
sections = {
{ section = "header" },
{ icon = "", title = "Keymaps", section = "keys", indent = 2, padding = 1 },
{ icon = "", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 },
{ icon = "", title = "Projects", section = "projects", indent = 2, padding = 1 },
{ section = "startup" },
},
},
-- explorer = {
-- },
indent = { enabled = true },
-- input = { enabled = true },
notifier = { enabled = true },
-- quickfile = { enabled = true },
scope = { enabled = true },
-- scroll = { enabled = true },
statuscolumn = { enabled = true },
-- words = { enabled = true },
image = {
enabled = true,
img_dirs = { "_Global/Assets" }
},
},
keys = {
-- {
-- "<leader>ft",
-- function()
-- require("snacks").explorer()
-- end,
-- desc = "Toggle File Explorer",
-- },
},
}

View file

@ -0,0 +1,52 @@
return {
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
opts = {
defaults = {
prompt_prefix = require("config.icons").telescope,
selection_caret = " ",
entry_prefix = " ",
layout_config = { -- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/telescope.lua
horizontal = {
prompt_position = "top",
preview_width = 0.55,
},
width = 0.87,
height = 0.80,
},
mappings = {
n = {
["n"] = "move_selection_next",
["e"] = "move_selection_previous",
["w"] = "preview_scrolling_up",
["r"] = "preview_scrolling_down",
["a"] = "preview_scrolling_left",
["s"] = "preview_scrolling_right",
["q"] = require("telescope.actions").close,
},
},
},
},
dependencies = { "nvim-lua/plenary.nvim" },
keys = {
{ "<leader><leader>", "<cmd>Telescope find_files<CR>", desc = "Find Files" },
{ "<leader>fc", "<cmd>Telescope find_files cwd=~/.config/nvim<CR>", desc = "Edit configs" },
{ "<leader>/", "<cmd>Telescope live_grep<CR>", desc = "Grep Files" },
{ "<leader>;", "<cmd>Telescope<CR>", desc = "Show Telescope Commands" },
{ "<leader>ui", "<cmd>FzfLua colorscheme<CR>", desc = "Change colorscheme" },
{ "<leader>pp", "<cmd>Telescope projects<CR>", desc = "List all Projects" },
{ "<leader>pg", "<cmd>Telescope projects<CR>", desc = "List all Git Projects" },
{ "<leader>ps", "<cmd>Telescope session-lens<CR>", desc = "List all sessions" },
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "Git Status" },
{ "<leader>gt", "<cmd>Telescope git_branches<CR>", desc = "Git Branches" },
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "Show commits" },
{ "<leader>fb", "<cmd>Telescope buffers<CR>", desc = "List Buffers" },
{ "<leader>ff", "<cmd>Telescope fd<CR>", desc = "Find Files" },
{ "<leader>fh", "<cmd>Telescope oldfiles<CR>", desc = "Recent Files" },
{ "<leader>ce", "<cmd>Telescope diagnostics<CR>", desc = "Navigate errors/warnings" },
{ "<leader>cs", "<cmd>Telescope treesitter<CR>", desc = "Search symbols" },
{ "<leader>cS", "<cmd>Telescope grep_string<CR>", desc = "Search current symbol" },
{ "<leader>bB", "<cmd>Telescope buffers<CR>", desc = "List Buffers" },
{ "<leader>fl", "<cmd>Telescope filetypes", desc = "Set Filetype/Lang to ..." },
},
}

View file

@ -0,0 +1,26 @@
local function get_highlight()
if vim.g.colors_name == "catppuccin" then
-- NOTE: This won't work since no integration is available
return require("catppuccin.groups.integrations.bufferline").get()
-- return require("rose-pine.plugins.toggleterm")
elseif vim.g.colors_name == "rose-pine" then
return require("rose-pine.plugins.toggleterm")
end
end
return {
"akinsho/toggleterm.nvim",
keys = {
{ "<leader>!", "<cmd>ToggleTerm direction=float<CR>", desc = "Toggle Terminal" },
{ "<leader>tf", "<cmd>ToggleTerm direction=float<CR>", desc = "Toggle Terminal" },
{ "<leader>tt", "<cmd>ToggleTerm<CR>", desc = "Spawn a float terminal" },
},
event = "ColorScheme",
opts = {
highlights = get_highlight(),
},
cmd = {
"ToggleTerm",
"LazyGit",
},
}

View file

@ -0,0 +1,37 @@
return {
"folke/trouble.nvim",
opts = {}, -- for default options, refer to the configuration section for custom setup.
cmd = "Trouble",
keys = {
{
"<leader>eE",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
{
"<leader>ee",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)",
},
{
"<leader>es",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>el",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)",
},
{
"<leader>eL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)",
},
{
"<leader>ef",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)",
},
},
}

View file

@ -0,0 +1,16 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
preset = "modern",
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
}