Yazi plugin
This commit is contained in:
@@ -2,57 +2,57 @@
|
|||||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'nvim-neo-tree/neo-tree.nvim',
|
-- 'nvim-neo-tree/neo-tree.nvim',
|
||||||
version = '*',
|
-- version = '*',
|
||||||
dependencies = {
|
-- dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
-- 'nvim-lua/plenary.nvim',
|
||||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
-- 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||||
'MunifTanjim/nui.nvim',
|
-- 'MunifTanjim/nui.nvim',
|
||||||
},
|
-- },
|
||||||
cmd = 'Neotree',
|
-- cmd = 'Neotree',
|
||||||
keys = {
|
-- keys = {
|
||||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
-- { '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||||
},
|
-- },
|
||||||
|
--
|
||||||
build = function()
|
-- build = function()
|
||||||
if vim.fn.executable 'fd' == 0 then
|
-- if vim.fn.executable 'fd' == 0 then
|
||||||
local install_cmd
|
-- local install_cmd
|
||||||
if vim.fn.has 'mac' == 1 then
|
-- if vim.fn.has 'mac' == 1 then
|
||||||
install_cmd = 'brew install fd'
|
-- install_cmd = 'brew install fd'
|
||||||
elseif vim.fn.has 'unix' == 1 then
|
-- elseif vim.fn.has 'unix' == 1 then
|
||||||
if vim.fn.filereadable '/etc/arch-release' == 1 then
|
-- if vim.fn.filereadable '/etc/arch-release' == 1 then
|
||||||
install_cmd = 'sudo pacman -S --noconfirm fd'
|
-- install_cmd = 'sudo pacman -S --noconfirm fd'
|
||||||
else
|
-- else
|
||||||
install_cmd = 'sudo apt-get install -y fd-find'
|
-- install_cmd = 'sudo apt-get install -y fd-find'
|
||||||
end
|
-- end
|
||||||
else
|
-- else
|
||||||
vim.notify("Please install 'fd' manually for neo-tree.", vim.log.levels.WARN)
|
-- vim.notify("Please install 'fd' manually for neo-tree.", vim.log.levels.WARN)
|
||||||
return
|
-- return
|
||||||
end
|
-- end
|
||||||
vim.fn.system(install_cmd)
|
-- vim.fn.system(install_cmd)
|
||||||
end
|
-- end
|
||||||
end,
|
-- end,
|
||||||
|
--
|
||||||
opts = function(_, opts)
|
-- opts = function(_, opts)
|
||||||
local function on_move(data)
|
-- local function on_move(data)
|
||||||
Snacks.rename.on_rename_file(data.source, data.destination)
|
-- Snacks.rename.on_rename_file(data.source, data.destination)
|
||||||
end
|
-- end
|
||||||
local events = require 'neo-tree.events'
|
-- local events = require 'neo-tree.events'
|
||||||
opts.event_handlers = opts.event_handlers or {}
|
-- opts.event_handlers = opts.event_handlers or {}
|
||||||
vim.list_extend(opts.event_handlers, {
|
-- vim.list_extend(opts.event_handlers, {
|
||||||
{ event = events.FILE_MOVED, handler = on_move },
|
-- { event = events.FILE_MOVED, handler = on_move },
|
||||||
{ event = events.FILE_RENAMED, handler = on_move },
|
-- { event = events.FILE_RENAMED, handler = on_move },
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
opts.filesystem = {
|
-- opts.filesystem = {
|
||||||
window = {
|
-- window = {
|
||||||
mappings = {
|
-- mappings = {
|
||||||
['\\'] = 'close_window',
|
-- ['\\'] = 'close_window',
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
filtered_items = {
|
-- filtered_items = {
|
||||||
hide_dotfiles = false,
|
-- hide_dotfiles = false,
|
||||||
},
|
-- },
|
||||||
}
|
-- }
|
||||||
end,
|
-- end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
-- Filesystem manager
|
-- Filesystem manager
|
||||||
require('helpers').edit_cf('po', '/lua/plugins/oil.lua')
|
-- require('helpers').edit_cf('po', '/lua/plugins/oil.lua')
|
||||||
|
--
|
||||||
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
|
-- vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'stevearc/oil.nvim',
|
-- 'stevearc/oil.nvim',
|
||||||
---@module 'oil'
|
-- ---@module 'oil'
|
||||||
---@type oil.SetupOpts
|
-- ---@type oil.SetupOpts
|
||||||
opts = {
|
-- opts = {
|
||||||
view_options = {
|
-- view_options = {
|
||||||
show_hidden = true,
|
-- show_hidden = true,
|
||||||
},
|
-- },
|
||||||
keymaps = {
|
-- keymaps = {
|
||||||
['<C-p>'] = false,
|
-- ['<C-p>'] = false,
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
-- Optional dependencies
|
-- -- Optional dependencies
|
||||||
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
|
-- dependencies = { { 'echasnovski/mini.icons', opts = {} } },
|
||||||
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
|
-- -- 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 loading is not recommended because it is very tricky to make it work correctly in all situations.
|
||||||
lazy = false,
|
-- lazy = false,
|
||||||
}
|
}
|
||||||
|
|||||||
39
lua/plugins/yazi.lua
Normal file
39
lua/plugins/yazi.lua
Normal file
@@ -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' },
|
||||||
|
'<cmd>Yazi<cr>',
|
||||||
|
desc = 'Open yazi at the current file',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- Open in the current working directory
|
||||||
|
'\\',
|
||||||
|
'<cmd>Yazi cwd<cr>',
|
||||||
|
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 = '<f1>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- 👇 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,
|
||||||
|
}
|
||||||
@@ -49,7 +49,7 @@ local PROJECTS = {
|
|||||||
map('<leader>db', function()
|
map('<leader>db', function()
|
||||||
helpers.open_term { cmd = 'lazysql mysql://root@localhost:3306/runcats' }
|
helpers.open_term { cmd = 'lazysql mysql://root@localhost:3306/runcats' }
|
||||||
end, { desc = 'Open database manager' })
|
end, { desc = 'Open database manager' })
|
||||||
map('<leader>E', ':e .env', { desc = 'Edit .env file' })
|
map('<leader>E', ':e .env<CR>', { desc = 'Edit .env file' })
|
||||||
map('s ', '!cd server && ', { desc = 'Run command in server directory' }, 'c')
|
map('s ', '!cd server && ', { desc = 'Run command in server directory' }, 'c')
|
||||||
map('c ', '!cd client && ', { desc = 'Run command in client 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')
|
map('sl ', '!cd server && vendor/bin/sail ', { desc = 'Run sail command' }, 'c')
|
||||||
|
|||||||
Reference in New Issue
Block a user