add autocommand
This commit is contained in:
parent
c5c3412eaf
commit
106459cd00
2 changed files with 72 additions and 5 deletions
|
|
@ -663,6 +663,34 @@ require("lazy").setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"echasnovski/mini.files",
|
||||||
|
version = false,
|
||||||
|
opts = {},
|
||||||
|
config = function(_, opts)
|
||||||
|
local files = require("mini.files")
|
||||||
|
files.setup(opts)
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"-",
|
||||||
|
function()
|
||||||
|
local MiniFiles = require("mini.files")
|
||||||
|
MiniFiles.open(vim.api.nvim_buf_get_name(0))
|
||||||
|
end,
|
||||||
|
desc = "[F]ile [M]anager",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fm",
|
||||||
|
function()
|
||||||
|
local MiniFiles = require("mini.files")
|
||||||
|
MiniFiles.open(nil)
|
||||||
|
end,
|
||||||
|
desc = "[F]ile [M]anager",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
{ -- Highlight, edit, and navigate code
|
{ -- Highlight, edit, and navigate code
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
event = "LazyFile",
|
event = "LazyFile",
|
||||||
|
|
@ -811,15 +839,16 @@ require("lazy").setup({
|
||||||
dependencies = { { "echasnovski/mini.icons", enabled = vim.g.have_nerd_font } },
|
dependencies = { { "echasnovski/mini.icons", enabled = vim.g.have_nerd_font } },
|
||||||
keys = {
|
keys = {
|
||||||
-- stylua: ignore start
|
-- stylua: ignore start
|
||||||
{ "-", "<CMD>Oil<CR>", desc = "Open parent directory" },
|
-- { "-", "<CMD>Oil<CR>", desc = "Open parent directory" },
|
||||||
{ "<leader>fm", "<CMD>Oil<CR>", desc = "[F]ile [M]anager" },
|
-- { "<leader>fm", "<CMD>Oil<CR>", desc = "[F]ile [M]anager" },
|
||||||
{ "<leader>fM", "<CMD>Oil --float<CR>", desc = "[F]ile [M]anager" },
|
{ "<leader>fo", "<CMD>Oil<CR>", desc = "[F]ile Manager [O]il" },
|
||||||
-- stylua: ignore end
|
-- stylua: ignore end
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
vim.g.oil_show_info = false
|
vim.g.oil_show_info = false
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"christoomey/vim-tmux-navigator",
|
"christoomey/vim-tmux-navigator",
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
|
|
@ -1119,5 +1148,44 @@ vim.api.nvim_create_autocmd("VimResized", {
|
||||||
desc = "Automatically resize windows when the host window size changes.",
|
desc = "Automatically resize windows when the host window size changes.",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- [[ MiniFiles ]] Autocommands
|
||||||
|
|
||||||
|
local yank_relative_path = function()
|
||||||
|
local path = MiniFiles.get_fs_entry().path
|
||||||
|
path = vim.fn.fnamemodify(path, ":.")
|
||||||
|
vim.fn.setreg("+", path)
|
||||||
|
vim.notify(path)
|
||||||
|
end
|
||||||
|
|
||||||
|
local yank_absolute_path = function()
|
||||||
|
local path = MiniFiles.get_fs_entry().path
|
||||||
|
vim.fn.setreg("+", path)
|
||||||
|
vim.notify(path)
|
||||||
|
end
|
||||||
|
|
||||||
|
local set_mark = function(id, path, desc)
|
||||||
|
MiniFiles.set_bookmark(id, path, { desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "MiniFilesExplorerOpen",
|
||||||
|
callback = function()
|
||||||
|
set_mark("c", vim.fn.stdpath("config"), "Config") -- path
|
||||||
|
set_mark("w", vim.fn.getcwd, "Working directory") -- callable
|
||||||
|
set_mark("~", "~", "Home directory")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "MiniFilesBufferCreate",
|
||||||
|
callback = function(args)
|
||||||
|
vim.keymap.set("n", "<C-y>", yank_absolute_path, { buffer = args.data.buf_id })
|
||||||
|
vim.keymap.set("n", "<C-u>", yank_relative_path, { buffer = args.data.buf_id })
|
||||||
|
vim.keymap.set("n", "<cr>", function()
|
||||||
|
MiniFiles.go_in({ close_on_file = true })
|
||||||
|
end, { buffer = args.data.buf_id })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,14 @@
|
||||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||||
"mini.ai": { "branch": "main", "commit": "31c149067d38b97720d2a179619f7745a0006ecc" },
|
"mini.ai": { "branch": "main", "commit": "31c149067d38b97720d2a179619f7745a0006ecc" },
|
||||||
|
"mini.files": { "branch": "main", "commit": "6abe854f1410fc6aec69897a78b1db994c32d9c6" },
|
||||||
"mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" },
|
"mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" },
|
||||||
"mini.statusline": { "branch": "main", "commit": "813854243156472c9d0bc9c64ea0af159b9b37ca" },
|
"mini.statusline": { "branch": "main", "commit": "813854243156472c9d0bc9c64ea0af159b9b37ca" },
|
||||||
"mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" },
|
"mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" },
|
||||||
"multicursor.nvim": { "branch": "1.0", "commit": "b715cc5bf69cf6e338899510eb2b60b1dd7ccce0" },
|
"multicursor.nvim": { "branch": "1.0", "commit": "b715cc5bf69cf6e338899510eb2b60b1dd7ccce0" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
|
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" },
|
"nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" },
|
||||||
"nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" },
|
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "37427012d1c77c544356bfff0c9acc88fd3256bc" },
|
"nvim-treesitter": { "branch": "master", "commit": "37427012d1c77c544356bfff0c9acc88fd3256bc" },
|
||||||
"oil.nvim": { "branch": "master", "commit": "8ea40b5506115b6d355e304dd9ee5089f7d78601" },
|
|
||||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||||
"snacks.nvim": { "branch": "main", "commit": "be8feef4ab584f50aaa96b69d50b3f86a35aacff" },
|
"snacks.nvim": { "branch": "main", "commit": "be8feef4ab584f50aaa96b69d50b3f86a35aacff" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue