From b0e8637ed4140df43808be5df2c0bb4fc6ad0984 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Wed, 1 Apr 2026 12:59:43 +0200 Subject: [PATCH] oxfmt --- lua/plugins/conform.lua | 12 ++++++------ lua/plugins/telescope.lua | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index 56b7a74..fbf7302 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -20,12 +20,12 @@ return { -- Define your formatters formatters_by_ft = { lua = { 'stylua' }, - javascript = { 'prettierd', 'prettier', stop_after_first = true }, - javascriptreact = { 'prettierd', 'prettier', stop_after_first = true }, - typescript = { 'prettierd', 'prettier', stop_after_first = true }, - typescriptreact = { 'prettierd', 'prettier', stop_after_first = true }, - css = { 'prettierd', 'prettier', stop_after_first = true }, - scss = { 'prettierd', 'prettier', stop_after_first = true }, + javascript = { 'oxfmt' }, + javascriptreact = { 'oxfmt' }, + typescript = { 'oxfmt' }, + typescriptreact = { 'oxfmt' }, + scss = { 'oxfmt' }, + css = { 'oxfmt' }, json = { 'prettierd', 'prettier', stop_after_first = true }, jsonc = { 'prettierd', 'prettier', stop_after_first = true }, markdown = { 'prettierd', 'prettier', stop_after_first = true }, diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index cd7dd24..7b4e607 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -49,7 +49,7 @@ return { -- Fuzzy Finder (files, lsp, etc) local builtin = require('telescope.builtin') vim.keymap.set('n', 'fh', builtin.help_tags) vim.keymap.set('n', 'fk', builtin.keymaps) - vim.keymap.set('n', 'ff', builtin.find_files) + -- vim.keymap.set('n', 'ff', builtin.find_files) vim.keymap.set('n', 'fs', builtin.builtin) vim.keymap.set('n', 'fw', builtin.grep_string) vim.keymap.set('n', 'fg', builtin.live_grep) @@ -58,5 +58,36 @@ return { -- Fuzzy Finder (files, lsp, etc) vim.keymap.set('n', 'f.', builtin.oldfiles) vim.keymap.set('n', 'fb', builtin.buffers) vim.keymap.set('n', 'ft', 'TodoTelescope') + + -- keybind to grep after find + local actions = require('telescope.actions') + local action_state = require('telescope.actions.state') + local builtin = require('telescope.builtin') + + vim.keymap.set('n', 'ff', function() + builtin.find_files({ + attach_mappings = function(_, map) + map('i', '', function(prompt_bufnr) + local picker = action_state.get_current_picker(prompt_bufnr) + local dirs = {} + + -- collect all selected/filtered results + for _, entry in ipairs(picker:get_multi_selection()) do + table.insert(dirs, entry.path) + end + + -- fallback to current entry if nothing multi-selected + if #dirs == 0 then + local entry = action_state.get_selected_entry() + table.insert(dirs, vim.fn.fnamemodify(entry.path, ':h')) + end + + actions.close(prompt_bufnr) + builtin.live_grep({ search_dirs = dirs }) + end) + return true + end, + }) + end) end, }