Compare commits
5 Commits
1b3c174531
...
ef4aae4baa
Author | SHA1 | Date | |
---|---|---|---|
ef4aae4baa | |||
d965bd5d66 | |||
88dbefae00 | |||
e0ba4d036b | |||
d8c53db3b9 |
@ -38,36 +38,68 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
'rmagatti/auto-session',
|
'stevearc/resession.nvim',
|
||||||
-- event = 'VeryLazy', -- 或者你選擇合適的時機載入
|
dependencies = {
|
||||||
event = 'VimLeavePre', -- 插件只在關閉時載入以自動儲存
|
'romgrk/barbar.nvim',
|
||||||
cmd = { "SessionRestore", "SessionSave", "SessionDelete" },
|
|
||||||
opts = {
|
|
||||||
log_level = 'error',
|
|
||||||
auto_session_enable = true, -- ✅ 開啟 plugin 的 session 功能
|
|
||||||
auto_restore_enabled = false, -- ❌ 禁止自動還原
|
|
||||||
auto_save_enabled = true, -- ✅ 啟用自動儲存
|
|
||||||
auto_session_suppress_dirs = { '~/', '~/Downloads', '/' }, -- 可選
|
|
||||||
},
|
|
||||||
keys = {
|
|
||||||
{ "<Leader>sr", "<cmd>SessionRestore<cr>", desc = "Restore Session" },
|
|
||||||
{ "<Leader>ss", "<cmd>SessionSave<cr>", desc = "Save Session" },
|
|
||||||
{ "<Leader>sd", "<cmd>SessionDelete<cr>", desc = "Delete Session" },
|
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("auto-session").setup(opts)
|
local resession = require("resession")
|
||||||
end,
|
|
||||||
},
|
resession.setup({
|
||||||
{
|
autosave = {
|
||||||
'rmagatti/session-lens',
|
enabled = true,
|
||||||
dependencies = { 'rmagatti/auto-session', 'nvim-telescope/telescope.nvim' },
|
interval = 60,
|
||||||
config = function()
|
notify = true,
|
||||||
require('session-lens').setup({
|
},
|
||||||
path_display = { 'shorten' },
|
extensions = {
|
||||||
|
barbar = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Resession does NOTHING automagically, so we have to set up some keymaps
|
||||||
|
vim.keymap.set("n", "<leader>ss", resession.save)
|
||||||
|
vim.keymap.set("n", "<leader>sr", resession.load)
|
||||||
|
vim.keymap.set("n", "<leader>sd", resession.delete)
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||||
|
callback = function()
|
||||||
|
-- Always save a special session named "last"
|
||||||
|
resession.save("last")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
keys = {
|
|
||||||
{ "<Leader>sl", "<cmd>Telescope session-lens search_session<cr>", desc = "Search Sessions" },
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
-- {
|
||||||
|
-- 'rmagatti/auto-session',
|
||||||
|
-- -- event = 'VeryLazy', -- 或者你選擇合適的時機載入
|
||||||
|
-- event = 'VimLeavePre', -- 插件只在關閉時載入以自動儲存
|
||||||
|
-- cmd = { "SessionRestore", "SessionSave", "SessionDelete" },
|
||||||
|
-- opts = {
|
||||||
|
-- log_level = 'error',
|
||||||
|
-- auto_session_enable = true, -- ✅ 開啟 plugin 的 session 功能
|
||||||
|
-- auto_restore_enabled = false, -- ❌ 禁止自動還原
|
||||||
|
-- auto_save_enabled = true, -- ✅ 啟用自動儲存
|
||||||
|
-- auto_session_suppress_dirs = { '~/', '~/Downloads', '/' }, -- 可選
|
||||||
|
-- },
|
||||||
|
-- keys = {
|
||||||
|
-- { "<Leader>sr", "<cmd>SessionRestore<cr>", desc = "Restore Session" },
|
||||||
|
-- { "<Leader>ss", "<cmd>SessionSave<cr>", desc = "Save Session" },
|
||||||
|
-- { "<Leader>sd", "<cmd>SessionDelete<cr>", desc = "Delete Session" },
|
||||||
|
-- },
|
||||||
|
-- config = function(_, opts)
|
||||||
|
-- require("auto-session").setup(opts)
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- 'rmagatti/session-lens',
|
||||||
|
-- dependencies = { 'rmagatti/auto-session', 'nvim-telescope/telescope.nvim' },
|
||||||
|
-- config = function()
|
||||||
|
-- require('session-lens').setup({
|
||||||
|
-- path_display = { 'shorten' },
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
-- keys = {
|
||||||
|
-- { "<Leader>sl", "<cmd>Telescope session-lens search_session<cr>", desc = "Search Sessions" },
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
}
|
}
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
return {
|
|
||||||
{ "nvzone/volt" , lazy = true },
|
|
||||||
{
|
|
||||||
"nvzone/menu",
|
|
||||||
dependencies = {
|
|
||||||
"MunifTanjim/nui.nvim",
|
|
||||||
"nvim-neo-tree/neo-tree.nvim"
|
|
||||||
},
|
|
||||||
event = "VeryLazy",
|
|
||||||
config = function()
|
|
||||||
-- Keyboard users
|
|
||||||
vim.keymap.set("n", "<C-t>", function()
|
|
||||||
require("menu").open("default")
|
|
||||||
end, {})
|
|
||||||
|
|
||||||
-- mouse users + nvimtree users!
|
|
||||||
vim.keymap.set({ "n", "v" }, "<RightMouse>", function()
|
|
||||||
require('menu.utils').delete_old_menus()
|
|
||||||
|
|
||||||
vim.cmd.exec '"normal! \\<RightMouse>"'
|
|
||||||
|
|
||||||
-- clicked buf
|
|
||||||
local buf = vim.api.nvim_win_get_buf(vim.fn.getmousepos().winid)
|
|
||||||
local options = vim.bo[buf].ft == "neo-tree" and "neo-tree" or "default"
|
|
||||||
|
|
||||||
require("menu").open(options, { mouse = true })
|
|
||||||
end, {})
|
|
||||||
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
62
dot_config/nvim/exact_lua/exact_plugins/exact_ui/menu.lua
Normal file
62
dot_config/nvim/exact_lua/exact_plugins/exact_ui/menu.lua
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
-- if true then return {} end
|
||||||
|
return {
|
||||||
|
{ "nvzone/volt" , lazy = true },
|
||||||
|
{
|
||||||
|
"nvzone/menu",
|
||||||
|
dependencies = {
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
"nvim-neo-tree/neo-tree.nvim"
|
||||||
|
},
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
-- Keyboard users
|
||||||
|
vim.keymap.set("n", "<C-t>", function()
|
||||||
|
require("menu").open("default")
|
||||||
|
end, {})
|
||||||
|
|
||||||
|
-- mouse users + nvimtree users!
|
||||||
|
vim.keymap.set({ "n", "v" }, "<RightMouse>", function()
|
||||||
|
require('menu.utils').delete_old_menus()
|
||||||
|
|
||||||
|
vim.cmd.exec '"normal! \\<RightMouse>"'
|
||||||
|
|
||||||
|
-- clicked buf
|
||||||
|
local mouse = vim.fn.getmousepos()
|
||||||
|
local buf = vim.api.nvim_win_get_buf(mouse.winid)
|
||||||
|
local ft = vim.bo[buf].ft
|
||||||
|
local gitsigns = require("gitsigns")
|
||||||
|
local hunks = gitsigns.get_hunks and gitsigns.get_hunks(buf)
|
||||||
|
|
||||||
|
local in_signcolumn = mouse.wincol <= vim.fn.getwininfo(mouse.winid)[1].textoff
|
||||||
|
local is_git_buf = vim.b[buf].gitsigns_head ~= nil
|
||||||
|
local has_hunks = hunks and #hunks > 0
|
||||||
|
|
||||||
|
local options
|
||||||
|
if ft == "neo-tree" then
|
||||||
|
options = "neo-tree"
|
||||||
|
elseif in_signcolumn and is_git_buf and has_hunks then
|
||||||
|
options = "gitsigns"
|
||||||
|
else
|
||||||
|
options = "default"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- -- Debug用途
|
||||||
|
-- local name = vim.api.nvim_buf_get_name(buf)
|
||||||
|
-- local lsp = vim.lsp.get_clients({ bufnr = buf })
|
||||||
|
-- vim.notify("👉 Buffer: " .. buf ..
|
||||||
|
-- "\nFile: " .. name ..
|
||||||
|
-- "\nFiletype: " .. ft ..
|
||||||
|
-- "\nGitsigns Head: " .. vim.inspect(vim.b[buf].gitsigns_head) ..
|
||||||
|
-- "\nHas Hunks: " .. tostring(has_hunks) ..
|
||||||
|
-- "\nMouse Col: " .. mouse.wincol ..
|
||||||
|
-- "\nText Offset: " .. vim.fn.getwininfo(mouse.winid)[1].textoff ..
|
||||||
|
-- "\nIn SignColumn: " .. tostring(in_signcolumn) ..
|
||||||
|
-- "\nLSP: " .. tostring(#lsp > 0) ..
|
||||||
|
-- "\n🧭 Menu: " .. options, vim.log.levels.INFO
|
||||||
|
-- )
|
||||||
|
require("menu").open(options, { mouse = true })
|
||||||
|
end, {})
|
||||||
|
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
17
dot_config/nvim/exact_lua/exact_plugins/exact_ui/pathbar.lua
Normal file
17
dot_config/nvim/exact_lua/exact_plugins/exact_ui/pathbar.lua
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'Bekaboo/dropbar.nvim',
|
||||||
|
-- optional, but required for fuzzy finder support
|
||||||
|
dependencies = {
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
build = 'make'
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local dropbar_api = require('dropbar.api')
|
||||||
|
vim.keymap.set('n', '<Leader>;', dropbar_api.pick, { desc = 'Pick symbols in winbar' })
|
||||||
|
vim.keymap.set('n', '[;', dropbar_api.goto_context_start, { desc = 'Go to start of current context' })
|
||||||
|
vim.keymap.set('n', '];', dropbar_api.select_next_context, { desc = 'Select next context' })
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user