chore(nvim): Change to lazy.nvim recommended format

This commit is contained in:
js0ny 2025-02-26 03:06:43 +00:00
parent 19cedd3fdc
commit f10828fdac
23 changed files with 579 additions and 414 deletions

View file

@ -449,7 +449,7 @@ mapkey(
); );
mapkey( mapkey(
",d", ",d",
"Extract [d]aw link", "Extract [d]ownload link",
function () { function () {
const url = new URL(window.location.href); const url = new URL(window.location.href);
if (url.href.endsWith("&dl=0")) { if (url.href.endsWith("&dl=0")) {
@ -1003,3 +1003,4 @@ addVimMapKey(
// #region Hints // #region Hints
api.Hints.setCharacters("qwfpgarstdcv"); // Left-hand keys api.Hints.setCharacters("qwfpgarstdcv"); // Left-hand keys
// #endregion // #endregion
//

View file

@ -51,9 +51,6 @@ opt.foldlevel = 99
opt.foldenable = false opt.foldenable = false
opt.foldlevelstart = 1 opt.foldlevelstart = 1
-- Disable status line: Use `lualine` instead
opt.laststatus = 0
-- Hide Command Line if empty -- Hide Command Line if empty
opt.cmdheight = 0 opt.cmdheight = 0
@ -64,7 +61,15 @@ opt.sidescrolloff = 10 -- Always show 10 columns left/right of cursor
-- Conceal: Hide some characters, might be useful for markdown and LaTeX -- Conceal: Hide some characters, might be useful for markdown and LaTeX
opt.conceallevel = 2 opt.conceallevel = 2
-- `laststatus`
-- Disable status line: Use `lualine` instead
-- opt.laststatus = 0
-- 3: Global status line (always at the bottom)
opt.laststatus = 3
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
-- hover.nvim
vim.o.mousemoveevent = true
-- Hide zero-width space -- Hide zero-width space
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {

View file

@ -0,0 +1,194 @@
local M = {}
local formatFx = function()
require("conform").format({ async = true })
end
local renameCurrentBuffer = function()
local old_name = vim.fn.expand("%:p")
local new_name = vim.fn.input("New name: ", vim.fn.expand("%:p:h") .. "/")
if new_name == "" then
print("No new name provided")
return
elseif new_name == old_name then
return
end
vim.cmd("write")
local success, err = os.rename(old_name, new_name)
if not success then
print("Error renaming file: " .. err)
return
end
vim.cmd("edit " .. new_name)
vim.cmd("bdelete " .. old_name)
end
-- 通用映射函数
local function apply_mappings(maps, prefix)
for _, map in ipairs(maps) do
local new_map = {
keys = prefix .. map.keys,
cmd = map.cmd,
opts = map.opts,
}
table.insert(M, new_map)
end
end
vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
local leader_mappings = {
general = {
{ keys = "<leader>", cmd = ":Telescope find_files<CR>", opts = { desc = "Find Files" } },
{ keys = "/", cmd = ":Telescope live_grep<CR>", opts = { desc = "Grep Files" } },
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
{ keys = "\\", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "F", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Explorer" } },
{ keys = "<Tab>", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
{ keys = "!", cmd = ":FloatermToggle<CR>", opts = { desc = "Toggle Terminal" } },
{ keys = '"', cmd = ":!wezterm-gui &<CR>", pots = { desc = "Open External Terminal(wezterm)" } },
{ keys = ";", cmd = ":Telescope<CR>", pots = { desc = "Show Telescope Commands" } },
},
b = { -- +buffer
{ keys = "0", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
{ keys = "1", cmd = ":BufferLineGotoBuffer 1<CR>", opts = { desc = "Switch to Buffer #1" } },
{ keys = "2", cmd = ":BufferLineGotoBuffer 2<CR>", opts = { desc = "Switch to Buffer #2" } },
{ keys = "3", cmd = ":BufferLineGotoBuffer 3<CR>", opts = { desc = "Switch to Buffer #3" } },
{ keys = "4", cmd = ":BufferLineGotoBuffer 4<CR>", opts = { desc = "Switch to Buffer #4" } },
{ keys = "5", cmd = ":BufferLineGotoBuffer 5<CR>", opts = { desc = "Switch to Buffer #5" } },
{ keys = "6", cmd = ":BufferLineGotoBuffer 6<CR>", opts = { desc = "Switch to Buffer #6" } },
{ keys = "7", cmd = ":BufferLineGotoBuffer 7<CR>", opts = { desc = "Switch to Buffer #7" } },
{ keys = "8", cmd = ":BufferLineGotoBuffer 8<CR>", opts = { desc = "Switch to Buffer #8" } },
{ keys = "9", cmd = ":BufferLineGotoBuffer 9<CR>", opts = { desc = "Switch to Buffer #9" } },
{ keys = "a", cmd = ":Alpha<CR>", opts = { desc = "Dashboard" } },
{ keys = "b", cmd = ":BufferLinePick<CR>", opts = { desc = "Quick Switch Buffers" } },
{ keys = "B", cmd = ":Telescope buffers<CR>", opts = { desc = "List Buffers" } },
{ keys = "d", cmd = ":bdelete<CR>", opts = { desc = "Delete Buffer" } },
{ keys = "D", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "xx", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "xh", cmd = ":BufferLineCloseLeft<CR>", opts = { desc = "Delete Buffers Left" } },
{ keys = "xi", cmd = ":BufferLineCloseRight<CR>", opts = { desc = "Delete Buffers Right" } },
{ keys = "X", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "h", cmd = ":bprevious<CR>", opts = { desc = "Previous Buffer" } },
{ keys = "i", cmd = ":bnext<CR>", opts = { desc = "Next Buffer" } },
{ keys = "H", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "I", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
{ keys = "0", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "^", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "$", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
{ keys = "s", cmd = ":new<CR>", opts = { desc = "Scratch buffers" } },
{ keys = "t", cmd = ":BufferLineTogglePin<CR>", opts = { desc = "Pin Buffer" } },
{ keys = "y", cmd = ":%y+<CR>", opts = { desc = "Copy Buffer to Clipboard" } },
},
c = { -- +code/compile
{ keys = "r", cmd = ":RunCode<CR>", opts = { desc = "Run code" } },
{ keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } },
{ keys = "e", cmd = ":Telescope diagnostics<CR>", opts = { desc = "Navigate errors/warnings" } },
{ keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } },
{ keys = "s", cmd = ":Telescope treesitter<CR>", opts = { desc = "Search symbols" } },
{ keys = "S", cmd = ":Telescope grep_string<CR>", opts = { desc = "Search current symbol" } },
},
f = { -- +file/find
{ keys = "f", cmd = ":Telescope fd<CR>", opts = { desc = "Find Files" } },
{ keys = "F", cmd = ":GrugFar<CR>", opts = { desc = "Search & Replace" } },
{ keys = "l", cmd = ":set filetype=", opts = { desc = "Set Filetype to ..." } },
{ keys = "n", cmd = ":new<CR>", opts = { desc = "New File" } },
{ keys = "s", cmd = ":write<CR>", opts = { desc = "Save File" } },
{ keys = "S", cmd = ":wall<CR>", opts = { desc = "Save All Files" } },
{ keys = "b", cmd = ":Telescope buffers<CR>", opts = { desc = "List Buffers" } },
{ keys = "D", cmd = "!trash-rm %<CR>", opts = { desc = "Delete current file" } },
{ keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } },
{ keys = "T", cmd = ":FloatermNew<CR>", opts = { desc = "Spawn a float terminal" } },
{ keys = "h", cmd = ":Telescope oldfiles<CR>", opts = { desc = "Search history files" } },
{ keys = "c", cmd = ":Telescope find_files cwd=~/.config/nvim<CR>", opts = { desc = "Search Config" } },
{ keys = "o", cmd = ":!open %<CR>", opts = { desc = "Open file in default program" } },
{ keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } },
{ keys = "x", cmd = ":Lazy<CR>", opts = { desc = "Open extension view" } },
{ keys = "yy", cmd = ":let @+ = expand('%:p')<CR>", opts = { desc = "Copy file path" } },
{ keys = "yY", cmd = ":let @+ = expand('%')<CR>", opts = { desc = "Copy relative file path" } },
{ keys = "yn", cmd = ":let @+ = expand('%:t')<CR>", opts = { desc = "Copy file name" } },
{ keys = "yN", cmd = ":let @+ = expand('%:t:r')<CR>", opts = { desc = "Copy file name without extension" } },
{ keys = "yd", cmd = ":let @+ = expand('%:p:h')<CR>", opts = { desc = "Copy directory path" } },
{
keys = "yl",
cmd = ":let @+ = expand('%:p') . ':' . line('.')<CR>",
opts = { desc = "Copy file path with line number" },
},
{
keys = "yL",
cmd = ":let @+ = expand('%') . ':' . line('.')<CR>",
opts = { desc = "Copy relative file path with line number" },
},
},
g = { -- +git/version control
{ keys = "g", cmd = ":LazyGit<CR>", opts = { desc = "Toggle LazyGit" } },
{ keys = "c", cmd = ":Telescope git_commits<CR>", opts = { desc = "Show commits" } },
{ keys = "b", cmd = ":Gitsigns blame<CR>", opts = { desc = "Blame file" } },
{ keys = "d", cmd = ":Gitsigns diffthis<CR>", opts = { desc = "Diff file" } },
{ keys = "B", cmd = ":Gitsigns toggle_current_line_blame<CR>", opts = { desc = "Toggle line blame" } },
{ keys = "s", cmd = ":Telescope git_status<CR>", opts = { desc = "Git Status" } },
{ keys = "t", cmd = ":Telescope git_branches<CR>", opts = { desc = "Git Branches" } },
},
j = { -- +lsp
{ keys = "r", cmd = vim.lsp.buf.references, opts = { desc = "Show current reference" } },
},
p = { -- +project
{ keys = "p", cmd = ":Telescope projects<CR>", opts = { desc = "List all Projects" } },
{ keys = "g", cmd = ":Telescope projects<CR>", opts = { desc = "List all Git Projects" } },
{ keys = "s", cmd = ":Telescope session-lens<CR>", opts = { desc = "List all sessions" } },
},
q = { -- +quit
{ keys = "q", cmd = ":q<CR>", opts = { desc = "Quit" } },
{ keys = "Q", cmd = ":qa!<CR>", opts = { desc = "Force Quit" } },
{ keys = "w", cmd = ":wq<CR>", opts = { desc = "Write and Quit" } },
{ keys = "W", cmd = ":wall<CR>:qa!<CR>", opts = { desc = "Write all and Force Quit" } },
},
t = { -- +toggle/test
{ keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } },
{ keys = "F", cmd = ":FormatToggle<CR>", opts = { desc = "Toggle autoformat-on-save" } },
{ keys = "t", cmd = ":FloatermToggle<CR>", opts = { desc = "toggle visibility of the float terminal" } },
},
u = { -- +ui
{ keys = "i", cmd = ":Telescope colorscheme<CR>", opts = { desc = "Change colorscheme" } },
{ keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } },
},
w = { -- +window
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "H", cmd = "<C-w>H", opts = { desc = "Move Window Left" } },
{ keys = "N", cmd = "<C-w>J", opts = { desc = "Move Window Down" } },
{ keys = "E", cmd = "<C-w>K", opts = { desc = "Move Window Up" } },
{ keys = "I", cmd = "<C-w>L", opts = { desc = "Move Window Right" } },
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
{ keys = "/", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
{ keys = "d", cmd = "<C-w>c", opts = { desc = "Close Window" } },
{ keys = "D", cmd = "<C-w>o", opts = { desc = "Close Other Windows" } },
{ keys = "r", cmd = "<C-w>r", opts = { desc = "Rotate Windows" } },
{ keys = "R", cmd = "<C-w>R", opts = { desc = "Reverse Rotate Windows" } },
{ keys = "t", cmd = "<C-w>T", opts = { desc = "Move Window to New Tab" } },
{ keys = "]", cmd = ":resize +5<CR>", opts = { desc = "Increase Window Size" } },
{ keys = "[", cmd = ":resize -5<CR>", opts = { desc = "Decrease Window Size" } },
{ keys = "M", cmd = ":resize<CR>:vertical resize<CR>", opts = { desc = "Maximize window size" } },
},
}
for key, maps in pairs(leader_mappings) do
if key == "general" then
apply_mappings(maps, "<leader>")
else
apply_mappings(maps, "<leader>" .. key)
end
end
return M

View file

@ -42,8 +42,6 @@ vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
local leader_mappings = { local leader_mappings = {
general = { general = {
{ keys = "<leader>", cmd = ":Telescope find_files<CR>", opts = { desc = "Find Files" } },
{ keys = "/", cmd = ":Telescope live_grep<CR>", opts = { desc = "Grep Files" } },
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } }, { keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
{ keys = "\\", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } }, { keys = "\\", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } }, { keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
@ -51,11 +49,8 @@ local leader_mappings = {
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } }, { keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } }, { keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } }, { keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "F", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Explorer" } },
{ keys = "<Tab>", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } }, { keys = "<Tab>", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
{ keys = "!", cmd = ":FloatermToggle<CR>", opts = { desc = "Toggle Terminal" } },
{ keys = '"', cmd = ":!wezterm-gui &<CR>", pots = { desc = "Open External Terminal(wezterm)" } }, { keys = '"', cmd = ":!wezterm-gui &<CR>", pots = { desc = "Open External Terminal(wezterm)" } },
{ keys = ";", cmd = ":Telescope<CR>", pots = { desc = "Show Telescope Commands" } },
}, },
b = { -- +buffer b = { -- +buffer
{ keys = "0", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } }, { keys = "0", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
@ -68,9 +63,7 @@ local leader_mappings = {
{ keys = "7", cmd = ":BufferLineGotoBuffer 7<CR>", opts = { desc = "Switch to Buffer #7" } }, { keys = "7", cmd = ":BufferLineGotoBuffer 7<CR>", opts = { desc = "Switch to Buffer #7" } },
{ keys = "8", cmd = ":BufferLineGotoBuffer 8<CR>", opts = { desc = "Switch to Buffer #8" } }, { keys = "8", cmd = ":BufferLineGotoBuffer 8<CR>", opts = { desc = "Switch to Buffer #8" } },
{ keys = "9", cmd = ":BufferLineGotoBuffer 9<CR>", opts = { desc = "Switch to Buffer #9" } }, { keys = "9", cmd = ":BufferLineGotoBuffer 9<CR>", opts = { desc = "Switch to Buffer #9" } },
{ keys = "a", cmd = ":Alpha<CR>", opts = { desc = "Dashboard" } },
{ keys = "b", cmd = ":BufferLinePick<CR>", opts = { desc = "Quick Switch Buffers" } }, { keys = "b", cmd = ":BufferLinePick<CR>", opts = { desc = "Quick Switch Buffers" } },
{ keys = "B", cmd = ":Telescope buffers<CR>", opts = { desc = "List Buffers" } },
{ keys = "d", cmd = ":bdelete<CR>", opts = { desc = "Delete Buffer" } }, { keys = "d", cmd = ":bdelete<CR>", opts = { desc = "Delete Buffer" } },
{ keys = "D", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } }, { keys = "D", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "xx", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } }, { keys = "xx", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
@ -89,26 +82,15 @@ local leader_mappings = {
{ keys = "y", cmd = ":%y+<CR>", opts = { desc = "Copy Buffer to Clipboard" } }, { keys = "y", cmd = ":%y+<CR>", opts = { desc = "Copy Buffer to Clipboard" } },
}, },
c = { -- +code/compile c = { -- +code/compile
{ keys = "r", cmd = ":RunCode<CR>", opts = { desc = "Run code" } },
{ keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } }, { keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } },
{ keys = "e", cmd = ":Telescope diagnostics<CR>", opts = { desc = "Navigate errors/warnings" } },
{ keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } }, { keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } },
{ keys = "s", cmd = ":Telescope treesitter<CR>", opts = { desc = "Search symbols" } },
{ keys = "S", cmd = ":Telescope grep_string<CR>", opts = { desc = "Search current symbol" } },
}, },
f = { -- +file/find f = { -- +file/find
{ keys = "f", cmd = ":Telescope fd<CR>", opts = { desc = "Find Files" } },
{ keys = "F", cmd = ":GrugFar<CR>", opts = { desc = "Search & Replace" } },
{ keys = "l", cmd = ":set filetype=", opts = { desc = "Set Filetype to ..." } },
{ keys = "n", cmd = ":new<CR>", opts = { desc = "New File" } }, { keys = "n", cmd = ":new<CR>", opts = { desc = "New File" } },
{ keys = "s", cmd = ":write<CR>", opts = { desc = "Save File" } }, { keys = "s", cmd = ":write<CR>", opts = { desc = "Save File" } },
{ keys = "S", cmd = ":wall<CR>", opts = { desc = "Save All Files" } }, { keys = "S", cmd = ":wall<CR>", opts = { desc = "Save All Files" } },
{ keys = "b", cmd = ":Telescope buffers<CR>", opts = { desc = "List Buffers" } },
{ keys = "D", cmd = "!trash-rm %<CR>", opts = { desc = "Delete current file" } }, { keys = "D", cmd = "!trash-rm %<CR>", opts = { desc = "Delete current file" } },
{ keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } }, { keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } },
{ keys = "T", cmd = ":FloatermNew<CR>", opts = { desc = "Spawn a float terminal" } },
{ keys = "h", cmd = ":Telescope oldfiles<CR>", opts = { desc = "Search history files" } },
{ keys = "c", cmd = ":Telescope find_files cwd=~/.config/nvim<CR>", opts = { desc = "Search Config" } },
{ keys = "o", cmd = ":!open %<CR>", opts = { desc = "Open file in default program" } }, { keys = "o", cmd = ":!open %<CR>", opts = { desc = "Open file in default program" } },
{ keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } }, { keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } },
{ keys = "x", cmd = ":Lazy<CR>", opts = { desc = "Open extension view" } }, { keys = "x", cmd = ":Lazy<CR>", opts = { desc = "Open extension view" } },
@ -129,21 +111,11 @@ local leader_mappings = {
}, },
}, },
g = { -- +git/version control g = { -- +git/version control
{ keys = "g", cmd = ":LazyGit<CR>", opts = { desc = "Toggle LazyGit" } },
{ keys = "c", cmd = ":Telescope git_commits<CR>", opts = { desc = "Show commits" } },
{ keys = "b", cmd = ":Gitsigns blame<CR>", opts = { desc = "Blame file" } },
{ keys = "d", cmd = ":Gitsigns diffthis<CR>", opts = { desc = "Diff file" } },
{ keys = "B", cmd = ":Gitsigns toggle_current_line_blame<CR>", opts = { desc = "Toggle line blame" } },
{ keys = "s", cmd = ":Telescope git_status<CR>", opts = { desc = "Git Status" } },
{ keys = "t", cmd = ":Telescope git_branches<CR>", opts = { desc = "Git Branches" } },
}, },
j = { -- +lsp j = { -- +lsp
{ keys = "r", cmd = vim.lsp.buf.references, opts = { desc = "Show current reference" } }, { keys = "r", cmd = vim.lsp.buf.references, opts = { desc = "Show current reference" } },
}, },
p = { -- +project p = { -- +project
{ keys = "p", cmd = ":Telescope projects<CR>", opts = { desc = "List all Projects" } },
{ keys = "g", cmd = ":Telescope projects<CR>", opts = { desc = "List all Git Projects" } },
{ keys = "s", cmd = ":Telescope session-lens<CR>", opts = { desc = "List all sessions" } },
}, },
q = { -- +quit q = { -- +quit
{ keys = "q", cmd = ":q<CR>", opts = { desc = "Quit" } }, { keys = "q", cmd = ":q<CR>", opts = { desc = "Quit" } },
@ -154,10 +126,8 @@ local leader_mappings = {
t = { -- +toggle/test t = { -- +toggle/test
{ keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } }, { keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } },
{ keys = "F", cmd = ":FormatToggle<CR>", opts = { desc = "Toggle autoformat-on-save" } }, { keys = "F", cmd = ":FormatToggle<CR>", opts = { desc = "Toggle autoformat-on-save" } },
{ keys = "t", cmd = ":FloatermToggle<CR>", opts = { desc = "toggle visibility of the float terminal" } },
}, },
u = { -- +ui u = { -- +ui
{ keys = "i", cmd = ":Telescope colorscheme<CR>", opts = { desc = "Change colorscheme" } },
{ keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } }, { keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } },
}, },
w = { -- +window w = { -- +window

View file

@ -9,13 +9,10 @@ return {
light = "latte", light = "latte",
dark = "mocha", dark = "mocha",
}, },
styles = {
-- keywords = { "underline" },
},
integrations = { integrations = {
"lualine", "lualine",
}, },
} },
}, },
{ "olimorris/onedarkpro.nvim" }, { "olimorris/onedarkpro.nvim" },
@ -31,30 +28,61 @@ return {
}, },
{ -- Highlight yanked text { -- Highlight yanked text
"gbprod/yanky.nvim", "gbprod/yanky.nvim",
config = function() opts = {
require("yanky").setup({
highlight = { highlight = {
on_put = true, on_put = true,
on_yank = true, on_yank = true,
timer = 500, timer = 500,
}, },
}) },
end,
}, },
{ import = "plugins.mod.alpha-nvim" }, -- Dashboard { import = "plugins.mod.alpha-nvim" }, -- Dashboard
{ import = "plugins.mod.winbar-nvim" }, -- Breadcrumb { -- 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 { import = "plugins.mod.bufferline" }, -- Buffer Top Bar
{ -- Git Blames, Changes { -- Git Blames, Changes
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
config = function() opts = {
require("gitsigns").setup({
current_line_blame = true, current_line_blame = true,
}) },
end, keys = {
{ "b", ":Gitsigns blame<CR>", desc = "Blame file" },
{ "d", ":Gitsigns diffthis<CR>", desc = "Diff file" },
{ "B", ":Gitsigns toggle_current_line_blame<CR>", desc = "Toggle line blame" },
},
}, },
{ -- Highlight and navigate between TODOs { -- Highlight and navigate between TODOs
"folke/todo-comments.nvim", "folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {}, opts = {},
dependencies = { "nvim-lua/plenary.nvim" },
}, },
} }

View file

@ -15,8 +15,9 @@ return {
}, },
{ {
"zbirenbaum/copilot-cmp", "zbirenbaum/copilot-cmp",
config = function() opts = {},
require("copilot_cmp").setup() -- config = function()
end, -- require("copilot_cmp").setup()
-- end,
}, },
} }

View file

@ -2,7 +2,6 @@ return {
{ {
"folke/flash.nvim", "folke/flash.nvim",
event = "VeryLazy", event = "VeryLazy",
---@type Flash.Config
opts = {}, opts = {},
-- stylua: ignore -- stylua: ignore
keys = { keys = {
@ -21,20 +20,12 @@ return {
"echasnovski/mini.pairs", "echasnovski/mini.pairs",
version = false, version = false,
opts = {}, opts = {},
-- config = function()
-- require("mini.pairs").setup()
-- end,
}, },
{ {
"kylechui/nvim-surround", "kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy", event = "VeryLazy",
opts = {}, opts = {},
-- config = function()
-- require("nvim-surround").setup({
-- -- Configuration here, or leave empty to use defaults
-- })
-- end,
}, },
{ {
"MagicDuck/grug-far.nvim", "MagicDuck/grug-far.nvim",

View file

@ -1,51 +1,29 @@
return { return {
{ import = "plugins.mod.auto-session" }, {
"rmagatti/auto-session",
lazy = false,
opts = {
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
},
},
{ import = "plugins.mod.nvim-tree" }, { import = "plugins.mod.nvim-tree" },
{ import = "plugins.mod.telescope" }, { import = "plugins.mod.telescope" },
{ import = "plugins.mod.projects" },
{ {
"lewis6991/hover.nvim", "ahmedkhalf/project.nvim",
opts = {
detection_methods = { "lsp", "pattern" },
patterns = { ".git", "Makefile", "package.json" },
sync_root_with_cwd = true,
silent_chdir = true,
scope_chdir = "global",
},
config = function() config = function()
require("hover").setup({ require("telescope").load_extension("projects")
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,
})
-- Setup keymaps
vim.keymap.set("n", "gE", require("hover").hover_select, { desc = "hover.nvim (select)" })
vim.keymap.set("n", "<C-p>", function()
require("hover").hover_switch("previous")
end, { desc = "hover.nvim (previous source)" })
vim.keymap.set("n", "<C-n>", function()
require("hover").hover_switch("next")
end, { desc = "hover.nvim (next source)" })
-- Mouse support
vim.keymap.set("n", "<MouseMove>", require("hover").hover_mouse, { desc = "hover.nvim (mouse)" })
vim.o.mousemoveevent = true
end, end,
dependencies = { "nvim-telescope/telescope.nvim" },
}, },
{ import = "plugins.mod.hover-nvim" },
{ {
"kdheepak/lazygit.nvim", "kdheepak/lazygit.nvim",
lazy = true, lazy = true,

View file

@ -32,15 +32,10 @@ return {
{ "williamboman/mason.nvim" }, { "williamboman/mason.nvim" },
{ "neovim/nvim-lspconfig" }, { "neovim/nvim-lspconfig" },
}, },
config = function() opts = {
local mason_lspconfig = require("mason-lspconfig") ensure_installed = require("config.servers").servers,
local servers = require("config.servers").servers
mason_lspconfig.setup({
ensure_installed = servers,
automatic_installation = false, automatic_installation = false,
}) },
end,
}, },
{ import = "plugins.mod.conform-nvim" }, { import = "plugins.mod.conform-nvim" },
{ "nvim-treesitter/nvim-treesitter-context" }, { "nvim-treesitter/nvim-treesitter-context" },
@ -82,7 +77,15 @@ return {
end, end,
}, },
{ import = "plugins.mod.trouble-nvim" }, { import = "plugins.mod.trouble-nvim" },
{ import = "plugins.mod.nvim-treesitter" }, {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
opts = {
ensure_installed = { "markdown", "markdown_inline", "latex", "python" },
highlight = { enable = true },
indent = { enable = true },
},
},
{ {
"folke/lazydev.nvim", "folke/lazydev.nvim",
ft = "lua", -- only load on lua files ft = "lua", -- only load on lua files

View file

@ -1,16 +1,36 @@
return { return {
{ "wakatime/vim-wakatime", lazy = false }, { "wakatime/vim-wakatime", lazy = false },
{ "voldikss/vim-floaterm" }, {
"voldikss/vim-floaterm",
keys = {
{ "!", ":FloatermToggle<CR>", desc = "Toggle Terminal" },
{ "<leader>tt", ":FloatermToggle<CR>", desc = "Toggle Terminal" },
{ "<leader>fT", ":FloatermNew<CR>", desc = "Spawn a float terminal" },
},
cmd = {
"FloatermToggle",
"FloatermNew",
},
},
{
"CRAG666/code_runner.nvim",
config = true,
keys = {
{ "<leader>cr", ":RunCode<CR>", desc = "Run code" },
},
dependencies = {
{ {
"CRAG666/betterTerm.nvim", "CRAG666/betterTerm.nvim",
opts = { opts = {
position = "bot", position = "bot",
size = 15, size = 15,
}
}, },
{ "CRAG666/code_runner.nvim", config = true }, },
},
},
{ import = "plugins.mod.obsidian-nvim" }, { import = "plugins.mod.obsidian-nvim" },
{ import = "plugins.mod.which-keys-nvim" }, { import = "plugins.mod.which-keys-nvim" },
{ import = "plugins.mod.copilot-lua" }, { import = "plugins.mod.copilot-lua" },
{ import = "plugins.mod.avante-nvim" } { import = "plugins.mod.avante-nvim" },
} }

View file

@ -2,9 +2,12 @@
return { return {
{ {
"goolord/alpha-nvim", "goolord/alpha-nvim",
dependencies = { dependencies = {},
-- 'echasnovski/mini.icons', keys = {
-- 'nvim-lua/plenary.nvim' { "<leader>ba", ":Alpha<CR>", desc = "Toggle Alpha Dashboard" },
},
cmd = {
"Alpha",
}, },
config = function() config = function()
local alpha = require("alpha") local alpha = require("alpha")

View file

@ -1,15 +0,0 @@
---@diagnostic disable: undefined-doc-name
return {
{
"rmagatti/auto-session",
lazy = false,
---enables autocomplete for opts
---@module "auto-session"
---@type AutoSession.Config
opts = {
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
-- log_level = 'debug',
},
},
}

View file

@ -2,8 +2,26 @@ return {
"akinsho/bufferline.nvim", "akinsho/bufferline.nvim",
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持 dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
after = "catppuccin", after = "catppuccin",
config = function() lazy = false,
require("bufferline").setup({ keys = {
{ "<leader>b1", ":BufferLineGotoBuffer 1<CR>", desc = "Switch to Buffer #1" },
{ "<leader>b2", ":BufferLineGotoBuffer 2<CR>", desc = "Switch to Buffer #2" },
{ "<leader>b3", ":BufferLineGotoBuffer 3<CR>", desc = "Switch to Buffer #3" },
{ "<leader>b4", ":BufferLineGotoBuffer 4<CR>", desc = "Switch to Buffer #4" },
{ "<leader>b5", ":BufferLineGotoBuffer 5<CR>", desc = "Switch to Buffer #5" },
{ "<leader>b6", ":BufferLineGotoBuffer 6<CR>", desc = "Switch to Buffer #6" },
{ "<leader>b7", ":BufferLineGotoBuffer 7<CR>", desc = "Switch to Buffer #7" },
{ "<leader>b8", ":BufferLineGotoBuffer 8<CR>", desc = "Switch to Buffer #8" },
{ "<leader>b9", ":BufferLineGotoBuffer 9<CR>", desc = "Switch to Buffer #9" },
{ "<leader>bb", ":BufferLinePick<CR>", desc = "Quick Switch Buffers" },
{ "<leader>bD", ":BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>bxx", ":BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>bxh", ":BufferLineCloseLeft<CR>", desc = "Delete Buffers Left" },
{ "<leader>bxi", ":BufferLineCloseRight<CR>", desc = "Delete Buffers Right" },
{ "<leader>bX", ":BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>bt", ":BufferLineTogglePin<CR>", desc = "Pin Buffer" },
},
opts = {
options = { options = {
indicator = { indicator = {
icon = "", -- this should be omitted if indicator style is not 'icon' icon = "", -- this should be omitted if indicator style is not 'icon'
@ -25,6 +43,5 @@ return {
separator_style = "thin", separator_style = "thin",
}, },
highlights = require("catppuccin.groups.integrations.bufferline").get(), highlights = require("catppuccin.groups.integrations.bufferline").get(),
}) },
end,
} }

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

@ -1,4 +0,0 @@
return {
"neovim/nvim-lspconfig",
lazy = false,
}

View file

@ -20,39 +20,8 @@ local config = {
component_separators = { left = "", right = "" }, component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" }, section_separators = { left = "", right = "" },
theme = "catppuccin", theme = "catppuccin",
-- theme = { -- IDE-like Global Status
-- -- We are going to use lualine_c an lualine_x as left and globalstaus = true,
-- -- right section. Both are highlighted by c theme . So we
-- -- are just setting default looks o statusline
-- -- normal = { c = { fg = colors.mantle, bg = colors.mantle } },
-- -- visual = { c = { fg = colors.mantle, bg = colors.mauve } },
-- -- normal = { c = { fg = colors.mantle, bg = colors.sapphire } },
-- inactive = { c = { fg = colors.mantle, bg = colors.mantle } },
-- normal = {
-- a = {
-- fg = colors.scheme.mantle,
-- bg = colors.mode.n,
-- },
-- b = {
-- bg = colors.scheme.surface2,
-- },
-- c = {
-- bg = colors.scheme.crust,
-- },
-- },
-- visual = {
-- a = {
-- fg = colors.scheme.mantle,
-- bg = colors.mode.v,
-- },
-- },
-- insert = {
-- a = {
-- fg = colors.scheme.mantle,
-- bg = colors.mode.i,
-- },
-- },
-- },
}, },
sections = { sections = {
-- these are to remove the defaults -- these are to remove the defaults

View file

@ -1,3 +1,5 @@
-- This won't be loaded
-- I keep this since render-markdown sometimes buggy
return { return {
{ {
"OXY2DEV/markview.nvim", "OXY2DEV/markview.nvim",
@ -6,10 +8,8 @@ return {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
}, },
config = function() opts = {
local presets = require("markview.presets") checkboxes = require("markview-presets").checkboxes.nerd,
require("markview").setup({
checkboxes = presets.checkboxes.nerd,
headings = { headings = {
enable = true, enable = true,
shift_width = 1, shift_width = 1,
@ -24,7 +24,6 @@ return {
hl = "MarkviewCode", hl = "MarkviewCode",
info_hl = "MarkviewCodeInfo", info_hl = "MarkviewCodeInfo",
}, },
}) },
end,
}, },
} }

View file

@ -23,11 +23,13 @@ return {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
version = "*", version = "*",
lazy = false, lazy = false,
keys = {
{ "<leader>ft", ":NvimTreeToggle", desc = "Toggle File Explorer" },
},
dependencies = { dependencies = {
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
}, },
config = function() opts = {
require("nvim-tree").setup({
on_attach = my_on_attach, on_attach = my_on_attach,
sync_root_with_cwd = true, sync_root_with_cwd = true,
respect_buf_cwd = true, respect_buf_cwd = true,
@ -47,6 +49,5 @@ return {
}, },
}, },
}, },
}) },
end,
} }

View file

@ -1,11 +0,0 @@
return {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "markdown", "markdown_inline", "latex", "python" },
highlight = { enable = true },
indent = { enable = true },
})
end,
}

View file

@ -1,15 +0,0 @@
return {
"ahmedkhalf/project.nvim",
config = function()
require("project_nvim").setup({
detection_methods = { "lsp", "pattern" },
patterns = { ".git", "Makefile", "package.json" },
sync_root_with_cwd = true,
silent_chdir = true,
scope_chdir = "global",
})
require("telescope").load_extension("projects")
end,
dependencies = { "nvim-telescope/telescope.nvim" },
}

View file

@ -2,12 +2,9 @@ return {
{ {
"MeanderingProgrammer/render-markdown.nvim", "MeanderingProgrammer/render-markdown.nvim",
lazy = false, lazy = false,
ft = { "markdown", "Avante" },
opts = { opts = {
file_types = { "markdown", "Avante" }, file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
config = function()
require("render-markdown").setup({
render_modes = { "n", "c", "t" }, render_modes = { "n", "c", "t" },
latex = { latex = {
enabled = true, enabled = true,
@ -72,7 +69,6 @@ return {
quote = { raw = "[!QUOTE]", rendered = "󱆨 Quote", highlight = "RenderMarkdownQuote" }, quote = { raw = "[!QUOTE]", rendered = "󱆨 Quote", highlight = "RenderMarkdownQuote" },
cite = { raw = "[!CITE]", rendered = "󱆨 Cite", highlight = "RenderMarkdownQuote" }, cite = { raw = "[!CITE]", rendered = "󱆨 Cite", highlight = "RenderMarkdownQuote" },
}, },
}) },
end,
}, },
} }

View file

@ -1,7 +1,6 @@
return { return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
config = function() opts = {
require("telescope").setup({
defaults = { defaults = {
prompt_prefix = require("config.icons").telescope, prompt_prefix = require("config.icons").telescope,
selection_caret = " ", selection_caret = " ",
@ -26,7 +25,25 @@ return {
}, },
}, },
}, },
}) },
end,
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
keys = {
{ "<leader><leader>", ":Telescope find_files<CR>", desc = "Find Files" },
{ "<leader>/", ":Telescope live_grep<CR>", desc = "Grep Files" },
{ "<leader>;", ":Telescope<CR>", desc = "Show Telescope Commands" },
{ "<leader>ui", ":Telescope colorscheme<CR>", desc = "Change colorscheme" },
{ "<leader>pp", ":Telescope projects<CR>", desc = "List all Projects" },
{ "<leader>pg", ":Telescope projects<CR>", desc = "List all Git Projects" },
{ "<leader>ps", ":Telescope session-lens<CR>", desc = "List all sessions" },
{ "<leader>gs", ":Telescope git_status<CR>", desc = "Git Status" },
{ "<leader>gt", ":Telescope git_branches<CR>", desc = "Git Branches" },
{ "<leader>gc", ":Telescope git_commits<CR>", desc = "Show commits" },
{ "<leader>fb", ":Telescope buffers<CR>", desc = "List Buffers" },
{ "<leader>ff", ":Telescope fd<CR>", desc = "Find Files" },
{ "<leader>ce", ":Telescope diagnostics<CR>", desc = "Navigate errors/warnings" },
{ "<leader>cs", ":Telescope treesitter<CR>", desc = "Search symbols" },
{ "<leader>cS", ":Telescope grep_string<CR>", desc = "Search current symbol" },
{ "<leader>bB", ":Telescope buffers<CR>", desc = "List Buffers" },
{ "<leader>fl", ":Telescope filetypes", desc = "Set Filetype/Lang to ..." },
},
} }

View file

@ -1,41 +0,0 @@
return {
{
"fgheng/winbar.nvim",
config = function()
require("winbar").setup({
enabled = true,
show_file_path = true,
show_symbols = true,
colors = {
path = "",
file_name = "",
symbols = "",
},
icons = {
file_icon_default = "",
seperator = ">",
editor_state = "",
lock_icon = "",
},
exclude_filetype = {
"help",
"startify",
"dashboard",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"alpha",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"qf",
"floaterm",
"orgagenda",
"grug-far"
},
})
end,
},
}