From a48d83cc2f9bf48842f1faed66d940c812916322 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 28 May 2026 16:57:54 +0800 Subject: [PATCH] Remove moonfly colorscheme and refine mini.files keymaps - Delete colors/moonfly.vim (unused theme) - Remove - binding for mini.files - Add _ binding to open mini.files at project root (git root) - Update starter page keymaps accordingly Co-Authored-By: Claude Opus 4.7 (1M context) --- colors/moonfly.vim | 35 ----------------------------------- lua/pack.lua | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 46 deletions(-) delete mode 100644 colors/moonfly.vim diff --git a/colors/moonfly.vim b/colors/moonfly.vim deleted file mode 100644 index 30737ae..0000000 --- a/colors/moonfly.vim +++ /dev/null @@ -1,35 +0,0 @@ -" Dark Vim/Neovim colorscheme. -" -" URL: github.com/bluz71/vim-moonfly-colors -" License: MIT (https://opensource.org/licenses/MIT) - -" Clear highlights and reset syntax. -highlight clear -if exists('syntax_on') - syntax reset -endif - -" Set colorscheme name. -let g:colors_name = 'moonfly' - -" Define theme options. -let g:moonflyCursorColor = get(g:, 'moonflyCursorColor', v:false) -let g:moonflyItalics = get(g:, 'moonflyItalics', v:true) -let g:moonflyNormalPmenu = get(g:, 'moonflyNormalPmenu', v:false) -let g:moonflyNormalFloat = get(g:, 'moonflyNormalFloat', v:false) -let g:moonflyTerminalColors = get(g:, 'moonflyTerminalColors', v:true) -let g:moonflyTransparent = get(g:, 'moonflyTransparent', v:false) -let g:moonflyUndercurls = get(g:, 'moonflyUndercurls', v:true) -let g:moonflyUnderlineMatchParen = get(g:, 'moonflyUnderlineMatchParen', v:false) -let g:moonflyVirtualTextColor = get(g:, 'moonflyVirtualTextColor', v:false) -let g:moonflyWinSeparator = get(g:, 'moonflyWinSeparator', 1) - -" Load theme style independently for Neovim and Vim. -if has('nvim') - lua pcall(function() require("moonfly").style() end) -else - call moonfly#Style() -end - -set background=dark " moonfly is a dark theme -set termguicolors " moonfly is a true-color theme diff --git a/lua/pack.lua b/lua/pack.lua index 65eea53..f64e35c 100644 --- a/lua/pack.lua +++ b/lua/pack.lua @@ -238,11 +238,6 @@ local function setup_mini_files() }) end --- - :在当前工作目录打开文件浏览器 -lazy.on_keys("files", "-", "n", setup_mini_files, function() - require("mini.files").open() -end, { desc = "打开文件浏览器(工作目录)" }) - -- - :在当前文件所在目录打开文件浏览器 lazy.on_keys("files", "-", "n", setup_mini_files, function() local MiniFiles = require("mini.files") @@ -251,22 +246,30 @@ lazy.on_keys("files", "-", "n", setup_mini_files, function() MiniFiles.reveal_cwd() end, { desc = "打开文件浏览器(当前文件目录)" }) --- 在启动页(mini.starter)中也绑定 - / -, +-- _ :在项目根目录(git root)打开文件浏览器 +lazy.on_keys("files", "_", "n", setup_mini_files, function() + local git_root = vim.fs.root(0, ".git") + -- use_latest = false 避免恢复上次浏览深度,确保只展开根目录一层 + require("mini.files").open(git_root or vim.fn.getcwd(), false) +end, { desc = "打开文件浏览器(项目根目录)" }) + +-- 在启动页(mini.starter)中也绑定 - / _, -- 因为 starter buffer 可能拦截全局映射 vim.api.nvim_create_autocmd("User", { pattern = "MiniStarterOpened", callback = function(args) - vim.keymap.set("n", "-", function() - require("lazy").load("files", setup_mini_files) - require("mini.files").open() - end, { buffer = args.buf, desc = "打开文件浏览器(工作目录)" }) - vim.keymap.set("n", "-", function() require("lazy").load("files", setup_mini_files) local MiniFiles = require("mini.files") -- starter 无当前文件,打开工作目录 MiniFiles.open(vim.fn.getcwd()) end, { buffer = args.buf, desc = "打开文件浏览器(工作目录)" }) + + vim.keymap.set("n", "_", function() + require("lazy").load("files", setup_mini_files) + local git_root = vim.fs.root(0, ".git") + require("mini.files").open(git_root or vim.fn.getcwd(), false) + end, { buffer = args.buf, desc = "打开文件浏览器(项目根目录)" }) end, })