diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index a218432..87032ad 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -20,8 +20,8 @@ end -- e: two-stage find-by-extension. Stage 1 scans the repo with fd -- (respects .gitignore) and shows every file extension ranked by count; --- stage 2 opens the regular files picker restricted to the chosen --- extension (snacks passes `ft` to fd as `-e`). +-- stage 2 opens fff prefilled with a `*. ` glob constraint so the +-- rest of the query fuzzy-matches within that extension. local function find_files_by_extension() local snacks = require "snacks" local root = snacks.git.get_root() or vim.uv.cwd() @@ -61,7 +61,7 @@ local function find_files_by_extension() confirm = function(picker, item) picker:close() if not item then return end - snacks.picker.files { cwd = root, ft = item.ext, transform = file_filter } + require("fff").find_files { cwd = root, title = "*." .. item.ext .. " files", query = "*." .. item.ext .. " " } end, } end @@ -281,18 +281,40 @@ return { function() require("snacks").picker.lines() end, desc = "Find in line", }, - ["t"] = { + -- NOTE: and are the same key at the mapping level, so + -- this also shadows (jumplist-forward) in normal mode + [""] = { function() require("config.templates").pick() end, desc = "Find templates", }, ["w"] = { - function() require("snacks").picker.grep() end, - desc = "Find word", + function() require("fff").live_grep() end, + desc = "Live grep", + }, + ["z"] = { + function() require("fff").live_grep { grep = { modes = { "fuzzy", "plain" } } } end, + desc = "Live fuzzy grep", + }, + [""] = { + function() require("fff").live_grep_under_cursor() end, + desc = "Grep word under cursor", }, ["f"] = { - function() require("snacks").picker.files { transform = file_filter } end, + function() require("fff").find_files() end, desc = "Find files (cwd)", }, + ["m"] = { + function() require("fff").find_files { title = "Git Modified", query = "git:modified " } end, + desc = "Find git-modified files", + }, + ["r"] = { + function() require("fff").resume() end, + desc = "Resume last find/grep", + }, + ["."] = { + function() require("fff").find_files_in_dir(vim.fn.expand "%:p:h") end, + desc = "Find files in buffer directory", + }, ["e"] = { find_files_by_extension, desc = "Find files by extension", @@ -318,10 +340,7 @@ return { vim.notify("No .ai directory found in current project", vim.log.levels.WARN) return end - require("snacks").picker.files { - cwd = ai_dir, - transform = file_filter, - } + require("fff").find_files_in_dir(ai_dir) end, desc = "Find AI files", }, @@ -333,28 +352,25 @@ return { vim.notify("No .github/workflows directory found in current project", vim.log.levels.WARN) return end - require("snacks").picker.files { - cwd = workflows_dir, - transform = file_filter, - } + require("fff").find_files_in_dir(workflows_dir) end, desc = "Find GitHub Workflow files", }, ["gd"] = { function() - require("snacks").picker.files { - cmd = "fd", - args = { "devbox.json|process-compose.yaml|Dockerfile|docker-compose.yaml|compose.yaml" }, + require("fff").find_files { + title = "Devbox/Docker files", + query = "{devbox.json,process-compose.yaml,Dockerfile,docker-compose.yaml,compose.yaml} ", } end, desc = "Find Devbox/Docker files", }, ["gm"] = { - function() require("snacks").picker.files { cmd = "fd", args = { "Makefile" } } end, + function() require("fff").find_files { title = "Makefiles", query = "*Makefile* " } end, desc = "Find Makefile files", }, ["gp"] = { - function() require("snacks").picker.files { cmd = "fd", args = { "package.json" } } end, + function() require("fff").find_files { title = "package.json files", query = "*package.json " } end, desc = "Find Package.json files", }, [""] = { @@ -477,6 +493,10 @@ return { v = { [""] = { "wbd", desc = "Save and close buffer" }, [""] = { "wbd", desc = "Save and close buffer" }, + [""] = { + function() require("fff").live_grep_under_cursor() end, + desc = "Grep selection", + }, ["D"] = { function() vim.cmd 'normal! "vy' diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index 76f3128..48bc171 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -57,7 +57,7 @@ return { width = 32, -- window option, not a top level one (it used to be set top level, -- where neo-tree ignored it) - auto_expand_width = true, + auto_expand_width = false, -- keys must be spelled exactly like neo-tree's own defaults: -- setup() does not case-normalize them, so `` would sit next to -- the default `` and whichever `pairs()` reached last would win