nvim plugin upgrade: lazy update, remove fff snacks picker (use default fff), disable treesitter incremental selection
This commit is contained in:
parent
931501419b
commit
d9d7bb1ade
5 changed files with 30 additions and 216 deletions
|
|
@ -1,24 +1,23 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
|
||||
"arrow.nvim": { "branch": "master", "commit": "6e0f726f55f99332dd726a53effd6813786b6d49" },
|
||||
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
|
||||
"codecompanion-spinner.nvim": { "branch": "main", "commit": "c1fa2a84ea1aed687aaed60df65e347c280f4f22" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "8ad65eef735b31bb47d76f59d878ee1bac4bdc85" },
|
||||
"codesnap.nvim": { "branch": "main", "commit": "d8d55f5b62a6c12bc7756eb0b997a776eafd086e" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "a226ca071ebc1d8b5ae1f70800fa9cf4a06a2101" },
|
||||
"copilot.vim": { "branch": "release", "commit": "f89e977c87180519ba3b942200e3d05b17b1e2fc" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"fff.nvim": { "branch": "main", "commit": "9edf195c8fe71f1ab8f84e863fb27b469d2342bf" },
|
||||
"fff.nvim": { "branch": "main", "commit": "f6af8353c3cb02ddde1588f24f27ff8b3a4037cf" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
|
||||
"goto-preview": { "branch": "main", "commit": "cf561d10b4b104db20375c48b86cf36af9f96e00" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "2597bccb57d1b570fbdbd4adf88b955f7ade715b" },
|
||||
"incline.nvim": { "branch": "main", "commit": "6a3b0635bcd2490dbb1fa124217d41bf69ca0fa2" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"incline.nvim": { "branch": "main", "commit": "8b54c59bcb23366645ae10edca6edfb9d3a0853e" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"logger.nvim": { "branch": "main", "commit": "63dd10c9b9a159fd6cfe08435d9606384ff103c5" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"markview.nvim": { "branch": "main", "commit": "0a5033326f703d99a8788e2d47753d6298195e8a" },
|
||||
"mini.diff": { "branch": "main", "commit": "fbb93ea1728e7c9d0944df8bd022a68402bd2e7e" },
|
||||
"neogit": { "branch": "master", "commit": "300949af63fa48cb6bc8d93822b78cb9dbb4fd75" },
|
||||
"neogit": { "branch": "master", "commit": "d8bf9102692250193b855acd9025a826f1af2729" },
|
||||
"neovim-ayu": { "branch": "master", "commit": "38caa8b5b969010b1dcae8ab1a569d7669a643d5" },
|
||||
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
|
|
@ -30,7 +29,7 @@
|
|||
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
||||
"nvim-lightbulb": { "branch": "master", "commit": "aa3a8b0f4305b25cfe368f6c9be9923a7c9d0805" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" },
|
||||
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "64dd4cf3f6fd0ab17622c5ce15c91fc539c3f24a" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
|
||||
|
|
@ -41,6 +40,6 @@
|
|||
"rustaceanvim": { "branch": "master", "commit": "e9c5aaba16fead831379d5f44617547a90b913c7" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
||||
"tiny-glimmer.nvim": { "branch": "main", "commit": "e83bab26665c2dd4153b8a24e172e674e7c6dee7" },
|
||||
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "38b06435305c30966b7ceb0a43e460dc43acaada" },
|
||||
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "d9d12d4bfb9a4c5b8b8bdf7f612551df6972946c" },
|
||||
"visual-whitespace.nvim": { "branch": "main", "commit": "2c2de32bb97620bcf4b3b78879c185315ee971dc" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,203 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
local STAGED_STATUSES = {
|
||||
staged_new = true,
|
||||
staged_modified = true,
|
||||
staged_deleted = true,
|
||||
renamed = true,
|
||||
}
|
||||
|
||||
local STATUS_MAP = {
|
||||
untracked = "untracked",
|
||||
modified = "modified",
|
||||
deleted = "deleted",
|
||||
renamed = "renamed",
|
||||
staged_new = "added",
|
||||
staged_modified = "modified",
|
||||
staged_deleted = "deleted",
|
||||
ignored = "ignored",
|
||||
unknown = "untracked",
|
||||
}
|
||||
|
||||
local STATUS_ICONS = {
|
||||
untracked = "?",
|
||||
ignored = "!",
|
||||
}
|
||||
|
||||
---@class FFFState
|
||||
---@field current_file_cache? string
|
||||
---@field file_picker? table
|
||||
M.state = {}
|
||||
|
||||
---Get the current file path if valid
|
||||
---@return string|nil
|
||||
local function get_current_file()
|
||||
local current_buf = vim.api.nvim_get_current_buf()
|
||||
if not (current_buf and vim.api.nvim_buf_is_valid(current_buf)) then
|
||||
return nil
|
||||
end
|
||||
|
||||
local current_file = vim.api.nvim_buf_get_name(current_buf)
|
||||
return (current_file ~= "" and vim.fn.filereadable(current_file) == 1) and current_file or nil
|
||||
end
|
||||
|
||||
---Create git status object
|
||||
---@param git_status string
|
||||
---@return table|nil
|
||||
local function create_git_status(git_status)
|
||||
local mapped_status = STATUS_MAP[git_status]
|
||||
if not mapped_status then
|
||||
return nil
|
||||
end
|
||||
|
||||
return {
|
||||
status = mapped_status,
|
||||
staged = STAGED_STATUSES[git_status] or false,
|
||||
unmerged = git_status == "unmerged",
|
||||
}
|
||||
end
|
||||
|
||||
---Get or initialize file picker
|
||||
---@return table|nil
|
||||
local function get_file_picker()
|
||||
if M.state.file_picker then
|
||||
return M.state.file_picker
|
||||
end
|
||||
|
||||
local ok, file_picker = pcall(require, "fff.file_picker")
|
||||
if not ok then
|
||||
vim.notify("Failed to load fff.file_picker: " .. file_picker, vim.log.levels.ERROR)
|
||||
return nil
|
||||
end
|
||||
|
||||
M.state.file_picker = file_picker
|
||||
return file_picker
|
||||
end
|
||||
|
||||
---Format git status highlight group name
|
||||
---@param status table
|
||||
---@return string
|
||||
local function get_status_highlight(status)
|
||||
if status.unmerged then
|
||||
return "SnacksPickerGitStatusUnmerged"
|
||||
elseif status.staged then
|
||||
return "SnacksPickerGitStatusStaged"
|
||||
else
|
||||
local status_name = status.status
|
||||
return "SnacksPickerGitStatus" .. status_name:sub(1, 1):upper() .. status_name:sub(2)
|
||||
end
|
||||
end
|
||||
|
||||
---Get status icon text
|
||||
---@param status_name string
|
||||
---@return string
|
||||
local function get_status_icon(status_name)
|
||||
return STATUS_ICONS[status_name] or status_name:sub(1, 1):upper()
|
||||
end
|
||||
|
||||
local function finder(_, ctx)
|
||||
local file_picker = get_file_picker()
|
||||
if not file_picker then
|
||||
return {}
|
||||
end
|
||||
|
||||
-- Cache current file only once per session
|
||||
if not M.state.current_file_cache then
|
||||
M.state.current_file_cache = get_current_file()
|
||||
end
|
||||
|
||||
local ok, fff_result = pcall(
|
||||
file_picker.search_files,
|
||||
ctx.filter.search,
|
||||
100,
|
||||
4,
|
||||
M.state.current_file_cache,
|
||||
false
|
||||
)
|
||||
|
||||
if not ok then
|
||||
vim.notify("FFF search failed: " .. fff_result, vim.log.levels.ERROR)
|
||||
return {}
|
||||
end
|
||||
|
||||
local items = {}
|
||||
for _, fff_item in ipairs(fff_result) do
|
||||
local item = {
|
||||
text = fff_item.name,
|
||||
file = fff_item.path,
|
||||
score = fff_item.total_frecency_score,
|
||||
status = create_git_status(fff_item.git_status),
|
||||
}
|
||||
table.insert(items, item)
|
||||
end
|
||||
|
||||
return items
|
||||
end
|
||||
|
||||
local function on_close()
|
||||
M.state.current_file_cache = nil
|
||||
end
|
||||
|
||||
local function format_file_git_status(item, _)
|
||||
local status = item.status
|
||||
local hl = get_status_highlight(status)
|
||||
local icon = get_status_icon(status.status)
|
||||
|
||||
return {
|
||||
{
|
||||
col = 0,
|
||||
virt_text = { { icon, hl }, { " " } },
|
||||
virt_text_pos = "right_align",
|
||||
hl_mode = "combine",
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
local function format(item, picker)
|
||||
local ret = {}
|
||||
|
||||
if item.label then
|
||||
vim.list_extend(ret, {
|
||||
{ item.label, "SnacksPickerLabel" },
|
||||
{ " ", virtual = true }
|
||||
})
|
||||
end
|
||||
|
||||
if item.status then
|
||||
vim.list_extend(ret, format_file_git_status(item, picker))
|
||||
end
|
||||
|
||||
vim.list_extend(ret, require("snacks.picker.format").filename(item, picker))
|
||||
|
||||
if item.line then
|
||||
Snacks.picker.highlight.format(item, item.line, ret)
|
||||
table.insert(ret, { " " })
|
||||
end
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
function M.fff()
|
||||
local file_picker = get_file_picker()
|
||||
if not file_picker then
|
||||
return
|
||||
end
|
||||
|
||||
if not file_picker.is_initialized() then
|
||||
local setup_success = file_picker.setup()
|
||||
if not setup_success then
|
||||
vim.notify("Failed to initialize file picker", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
Snacks.picker {
|
||||
title = "FFFiles",
|
||||
finder = finder,
|
||||
on_close = on_close,
|
||||
format = format,
|
||||
live = true,
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -1,7 +1,28 @@
|
|||
-- return
|
||||
-- {
|
||||
-- "dmtrKovalenko/fff.nvim",
|
||||
-- build = "nix run .#release",
|
||||
-- -- No need to lazy-load with lazy.nvim.
|
||||
-- -- This plugin initializes itself lazily.
|
||||
-- lazy = false,
|
||||
-- }
|
||||
return {
|
||||
"dmtrKovalenko/fff.nvim",
|
||||
build = "nix run .#release",
|
||||
-- opts = {
|
||||
-- debug = {
|
||||
-- enabled = true, -- we expect your collaboration at least during the beta
|
||||
-- show_scores = true, -- to help us optimize the scoring system, feel free to share your scores!
|
||||
-- },
|
||||
-- },
|
||||
-- No need to lazy-load with lazy.nvim.
|
||||
-- This plugin initializes itself lazily.
|
||||
lazy = false,
|
||||
keys = {
|
||||
{
|
||||
"<leader>f", -- try it if you didn't it is a banger keybinding for a picker
|
||||
function() require("fff").find_files() end,
|
||||
desc = "FFFind files",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
local fff_picker = require("fff_snacks_picker")
|
||||
|
||||
return {
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
|
|
@ -146,7 +144,6 @@ return {
|
|||
|
||||
{ "<leader>z", function() Snacks.zen() end, },
|
||||
|
||||
{ "<leader>f", function() fff_picker.fff() end, },
|
||||
{ "<leader>g", function() Snacks.picker.grep() end, },
|
||||
{ "<leader>b", function() Snacks.picker.buffers() end, },
|
||||
{ "<leader>l", function() Snacks.picker.git_log_file() end, },
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ return {
|
|||
},
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
enable = false,
|
||||
keymaps = {
|
||||
init_selection = "<cr>",
|
||||
node_incremental = "<cr>",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue