From 8e2d413e0a6adee197fe2a36a405255124a6a183 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 11 Nov 2025 21:51:41 +0000 Subject: [PATCH] Yazi plugin --- lua/plugins/neo-tree.lua | 106 +++++++++++++++++++-------------------- lua/plugins/oil.lua | 38 +++++++------- lua/plugins/yazi.lua | 39 ++++++++++++++ lua/projects.lua | 2 +- 4 files changed, 112 insertions(+), 73 deletions(-) create mode 100644 lua/plugins/yazi.lua diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 63c336c..c22c451 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -2,57 +2,57 @@ -- https://github.com/nvim-neo-tree/neo-tree.nvim return { - 'nvim-neo-tree/neo-tree.nvim', - version = '*', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended - 'MunifTanjim/nui.nvim', - }, - cmd = 'Neotree', - keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, - }, - - build = function() - if vim.fn.executable 'fd' == 0 then - local install_cmd - if vim.fn.has 'mac' == 1 then - install_cmd = 'brew install fd' - elseif vim.fn.has 'unix' == 1 then - if vim.fn.filereadable '/etc/arch-release' == 1 then - install_cmd = 'sudo pacman -S --noconfirm fd' - else - install_cmd = 'sudo apt-get install -y fd-find' - end - else - vim.notify("Please install 'fd' manually for neo-tree.", vim.log.levels.WARN) - return - end - vim.fn.system(install_cmd) - end - end, - - opts = function(_, opts) - local function on_move(data) - Snacks.rename.on_rename_file(data.source, data.destination) - end - local events = require 'neo-tree.events' - opts.event_handlers = opts.event_handlers or {} - vim.list_extend(opts.event_handlers, { - { event = events.FILE_MOVED, handler = on_move }, - { event = events.FILE_RENAMED, handler = on_move }, - }) - - opts.filesystem = { - window = { - mappings = { - ['\\'] = 'close_window', - }, - }, - filtered_items = { - hide_dotfiles = false, - }, - } - end, + -- 'nvim-neo-tree/neo-tree.nvim', + -- version = '*', + -- dependencies = { + -- 'nvim-lua/plenary.nvim', + -- 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + -- 'MunifTanjim/nui.nvim', + -- }, + -- cmd = 'Neotree', + -- keys = { + -- { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, + -- }, + -- + -- build = function() + -- if vim.fn.executable 'fd' == 0 then + -- local install_cmd + -- if vim.fn.has 'mac' == 1 then + -- install_cmd = 'brew install fd' + -- elseif vim.fn.has 'unix' == 1 then + -- if vim.fn.filereadable '/etc/arch-release' == 1 then + -- install_cmd = 'sudo pacman -S --noconfirm fd' + -- else + -- install_cmd = 'sudo apt-get install -y fd-find' + -- end + -- else + -- vim.notify("Please install 'fd' manually for neo-tree.", vim.log.levels.WARN) + -- return + -- end + -- vim.fn.system(install_cmd) + -- end + -- end, + -- + -- opts = function(_, opts) + -- local function on_move(data) + -- Snacks.rename.on_rename_file(data.source, data.destination) + -- end + -- local events = require 'neo-tree.events' + -- opts.event_handlers = opts.event_handlers or {} + -- vim.list_extend(opts.event_handlers, { + -- { event = events.FILE_MOVED, handler = on_move }, + -- { event = events.FILE_RENAMED, handler = on_move }, + -- }) + -- + -- opts.filesystem = { + -- window = { + -- mappings = { + -- ['\\'] = 'close_window', + -- }, + -- }, + -- filtered_items = { + -- hide_dotfiles = false, + -- }, + -- } + -- end, } diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index e82e9b3..890b7e3 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -1,23 +1,23 @@ -- Filesystem manager -require('helpers').edit_cf('po', '/lua/plugins/oil.lua') - -vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) +-- require('helpers').edit_cf('po', '/lua/plugins/oil.lua') +-- +-- vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) return { - 'stevearc/oil.nvim', - ---@module 'oil' - ---@type oil.SetupOpts - opts = { - view_options = { - show_hidden = true, - }, - keymaps = { - [''] = false, - }, - }, - -- Optional dependencies - dependencies = { { 'echasnovski/mini.icons', opts = {} } }, - -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons - -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. - lazy = false, + -- 'stevearc/oil.nvim', + -- ---@module 'oil' + -- ---@type oil.SetupOpts + -- opts = { + -- view_options = { + -- show_hidden = true, + -- }, + -- keymaps = { + -- [''] = false, + -- }, + -- }, + -- -- Optional dependencies + -- dependencies = { { 'echasnovski/mini.icons', opts = {} } }, + -- -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + -- lazy = false, } diff --git a/lua/plugins/yazi.lua b/lua/plugins/yazi.lua new file mode 100644 index 0000000..425ce5c --- /dev/null +++ b/lua/plugins/yazi.lua @@ -0,0 +1,39 @@ +---@type LazySpec +return { + 'mikavilpas/yazi.nvim', + version = '*', -- use the latest stable version + event = 'VeryLazy', + dependencies = { + { 'nvim-lua/plenary.nvim', lazy = true }, + }, + keys = { + -- 👇 in this section, choose your own keymappings! + { + '-', + mode = { 'n', 'v' }, + 'Yazi', + desc = 'Open yazi at the current file', + }, + { + -- Open in the current working directory + '\\', + 'Yazi cwd', + desc = "Open the file manager in nvim's working directory", + }, + }, + ---@type YaziConfig | {} + opts = { + -- if you want to open yazi instead of netrw, see below for more info + open_for_directories = true, + keymaps = { + show_help = '', + }, + }, + -- 👇 if you use `open_for_directories=true`, this is recommended + init = function() + -- mark netrw as loaded so it's not loaded at all. + -- + -- More details: https://github.com/mikavilpas/yazi.nvim/issues/802 + vim.g.loaded_netrwPlugin = 1 + end, +} diff --git a/lua/projects.lua b/lua/projects.lua index dbe3909..417fb1c 100644 --- a/lua/projects.lua +++ b/lua/projects.lua @@ -49,7 +49,7 @@ local PROJECTS = { map('db', function() helpers.open_term { cmd = 'lazysql mysql://root@localhost:3306/runcats' } end, { desc = 'Open database manager' }) - map('E', ':e .env', { desc = 'Edit .env file' }) + map('E', ':e .env', { desc = 'Edit .env file' }) map('s ', '!cd server && ', { desc = 'Run command in server directory' }, 'c') map('c ', '!cd client && ', { desc = 'Run command in client directory' }, 'c') map('sl ', '!cd server && vendor/bin/sail ', { desc = 'Run sail command' }, 'c')