add file explorer to replace default explorer
This commit is contained in:
26
README.md
26
README.md
@@ -23,7 +23,7 @@ The **Leader Key** is set to `Space`.
|
|||||||
### Dashboard
|
### Dashboard
|
||||||
| Action | Keybinding | Description |
|
| Action | Keybinding | Description |
|
||||||
| :--- | :--- | :--- |
|
| :--- | :--- | :--- |
|
||||||
| **File Explorer** | `cd` | Open Netrw directly from the dashboard. |
|
| **File Explorer** | `cd` | Open Yazi directly from the dashboard. |
|
||||||
| **Find Files** | `ff` | Fuzzy find files via Telescope. |
|
| **Find Files** | `ff` | Fuzzy find files via Telescope. |
|
||||||
| **Live Grep** | `fg` | Search across all files via Telescope. |
|
| **Live Grep** | `fg` | Search across all files via Telescope. |
|
||||||
| **Harpoon Menu** | `e` | Open the Harpoon quick menu. |
|
| **Harpoon Menu** | `e` | Open the Harpoon quick menu. |
|
||||||
@@ -37,11 +37,32 @@ The **Leader Key** is set to `Space`.
|
|||||||
| Action | Keybinding | Description |
|
| Action | Keybinding | Description |
|
||||||
| :--- | :--- | :--- |
|
| :--- | :--- | :--- |
|
||||||
| **Dashboard** | `<leader>;` | Open the MzansiVim Dasboard. |
|
| **Dashboard** | `<leader>;` | Open the MzansiVim Dasboard. |
|
||||||
| **File Explorer** | `<leader>cd` | Open the built-in Netrw explorer. |
|
| **File Explorer (Current Directory)** | `<leader>cd` | Open the Yazi explorer in current directory. |
|
||||||
|
| **File Explorer (Working Directory)** | `<leader>cw` | Open the Yazi explorer in working directory. |
|
||||||
| **Find Files** | `<leader>ff` | Fuzzy find files in your project. |
|
| **Find Files** | `<leader>ff` | Fuzzy find files in your project. |
|
||||||
| **Live Grep** | `<leader>fg` | Search for specific text across all files. |
|
| **Live Grep** | `<leader>fg` | Search for specific text across all files. |
|
||||||
| **Help Tags** | `<leader>fh` | Search through Neovim help documentation. |
|
| **Help Tags** | `<leader>fh` | Search through Neovim help documentation. |
|
||||||
|
|
||||||
|
### Yazi (File Explorer)
|
||||||
|
| Action | Keybinding | Description |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
| **File Explorer** | `<leader>cd` | Open the Yazi explorer in file location. |
|
||||||
|
| **File Explorer** | `<leader>cw` | Open the Yazi explorer in working directory location. |
|
||||||
|
| **Navigation** | `h / j / k / l` | Move left (parent folder)/ down/ up/ or right (enter folder/open file). |
|
||||||
|
| **Open file** | `Enter` | Open file in new buffer. |
|
||||||
|
| **Open File (Horizontal Split)** | `Ctrl + x` | open file in horizontal split. |
|
||||||
|
| **Open File (Vertical Split)** | `Ctrl + v` | open file in horizontal split. |
|
||||||
|
| **Add file/ folder** | `a` | Create a new file (append / for a folder). |
|
||||||
|
| **Rename file/ folder** | `r` | Rename the highlighted file or directory. |
|
||||||
|
| **Delete file/ folder** | `d` | Move the selected item(s) to the system trash. |
|
||||||
|
| **Permanent Delete file/ folder** | `D` | Delete item(s) permanently (skips trash). |
|
||||||
|
| **Select file/ folder** | `space` | Toggle selection for the current file (allows batch actions). |
|
||||||
|
| **Bulk Select file/ folder** | `v` | Enter visual mode to select multiple files with `j/k` |
|
||||||
|
| **Copy / Cut** | `y / x` | Copy (Yank) or Cut the selected files. |
|
||||||
|
| **Paste** | `p` | Paste copied or cut files into the current directory. |
|
||||||
|
| **Help Menu** | `F1` | Open the help menu for keybindings. |
|
||||||
|
| **Close / Quit** | `q` | Exit Yazi and return to the Neovim buffer. |
|
||||||
|
|
||||||
### Harpoon (Quick-Switching)
|
### Harpoon (Quick-Switching)
|
||||||
| Action | Keybinding | Description |
|
| Action | Keybinding | Description |
|
||||||
| :--- | :--- | :--- |
|
| :--- | :--- | :--- |
|
||||||
@@ -124,6 +145,7 @@ To ensure all plugins (LSP, Tree-sitter, and Telescope) function correctly, plea
|
|||||||
* **Git** (For cloning the repo and managing plugins)
|
* **Git** (For cloning the repo and managing plugins)
|
||||||
* **Tree-sitter-cli** (For syntax highlighting)
|
* **Tree-sitter-cli** (For syntax highlighting)
|
||||||
* **Ripgrep** (Required for Telescope live grep)
|
* **Ripgrep** (Required for Telescope live grep)
|
||||||
|
* **Yazi** (Required for file expolorer)
|
||||||
* **Node & NPM** (Required for various LSP servers like `html` and `eslint`)
|
* **Node & NPM** (Required for various LSP servers like `html` and `eslint`)
|
||||||
* **Go** (Required for certain internal tools)
|
* **Go** (Required for certain internal tools)
|
||||||
|
|
||||||
|
|||||||
@@ -29,5 +29,6 @@
|
|||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
|
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" },
|
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0" }
|
"vim-fugitive": { "branch": "master", "commit": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0" },
|
||||||
|
"yazi.nvim": { "branch": "main", "commit": "25f370e6e84ca7ebca5927ec66cd93e2fa16fd3d" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,33 @@
|
|||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.keymap.set("n", "<leader>cd", vim.cmd.Ex)
|
-- vim.keymap.set("n", "<leader>cd", vim.cmd.Ex)
|
||||||
vim.keymap.set("n", "<leader>;", ":Dashboard<CR>", { desc = "Return to Dashboard", silent = true })
|
vim.keymap.set("n", "<leader>;", ":Dashboard<CR>", { desc = "Return to Dashboard", silent = true })
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "netrw",
|
pattern = "netrw",
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.keymap.set("n", "<Esc>", function()
|
vim.keymap.set("n", "<Esc>", function()
|
||||||
vim.cmd("enew")
|
vim.cmd("enew")
|
||||||
vim.cmd("Dashboard")
|
vim.cmd("Dashboard")
|
||||||
end, {
|
end, {
|
||||||
buffer = event.buf,
|
buffer = event.buf,
|
||||||
nowait = true,
|
nowait = true,
|
||||||
desc = "Return to Dashboard"
|
desc = "Return to Dashboard"
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "netrw",
|
pattern = "netrw",
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.keymap.set("n", "<leader>;", function()
|
vim.keymap.set("n", "<leader>;", function()
|
||||||
vim.cmd("enew")
|
vim.cmd("enew")
|
||||||
vim.cmd("Dashboard")
|
vim.cmd("Dashboard")
|
||||||
end, {
|
end, {
|
||||||
buffer = event.buf,
|
buffer = event.buf,
|
||||||
nowait = true, desc = "Return to Dashboard"
|
nowait = true,
|
||||||
})
|
desc = "Return to Dashboard"
|
||||||
end)
|
})
|
||||||
end,
|
end)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,3 +2,8 @@ vim.opt.number = true
|
|||||||
vim.opt.cursorline = true
|
vim.opt.cursorline = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
vim.opt.shiftwidth = 4
|
vim.opt.shiftwidth = 4
|
||||||
|
-- disable netrw at the very start
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
vim.opt.splitbelow = true -- Opens horizontal splits below
|
||||||
|
vim.opt.splitright = true -- Opens vertical splits to the right
|
||||||
|
|||||||
@@ -19,7 +19,14 @@ return {
|
|||||||
header = vim.split(logo, "\n"),
|
header = vim.split(logo, "\n"),
|
||||||
center = {
|
center = {
|
||||||
-- Aligned to Mzansi Vim Essential Keybindings
|
-- Aligned to Mzansi Vim Essential Keybindings
|
||||||
{ icon = " ", desc = " File Explorer ", key = "cd", action = "Explore" },
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = " File Explorer ",
|
||||||
|
key = "cd",
|
||||||
|
action = function()
|
||||||
|
require("yazi").yazi(nil, vim.fn.getcwd())
|
||||||
|
end
|
||||||
|
},
|
||||||
{ icon = " ", desc = " Find Files ", key = "ff", action = "Telescope find_files" },
|
{ icon = " ", desc = " Find Files ", key = "ff", action = "Telescope find_files" },
|
||||||
{ icon = " ", desc = " Live Grep ", key = "fg", action = "Telescope live_grep" },
|
{ icon = " ", desc = " Live Grep ", key = "fg", action = "Telescope live_grep" },
|
||||||
{
|
{
|
||||||
|
|||||||
29
lua/plugins/yazi.lua
Normal file
29
lua/plugins/yazi.lua
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
return {
|
||||||
|
"mikavilpas/yazi.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
keys = {
|
||||||
|
-- Customize these keymaps to your liking!
|
||||||
|
{
|
||||||
|
"<leader>cd",
|
||||||
|
function()
|
||||||
|
require("yazi").yazi()
|
||||||
|
end,
|
||||||
|
desc = "Open yazi at the current file",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- Open in the current working directory
|
||||||
|
"<leader>cw",
|
||||||
|
function()
|
||||||
|
require("yazi").yazi(nil, vim.fn.getcwd())
|
||||||
|
end,
|
||||||
|
desc = "Open yazi in cwd",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
-- if you want to replace netrw entirely with yazi
|
||||||
|
open_for_directories = true,
|
||||||
|
keymaps = {
|
||||||
|
show_help = "<f1>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user