Replace custom finder with fzf-lua

This commit is contained in:
2026-05-28 08:07:00 +03:00
parent 5672967635
commit 1aca4d9501
4 changed files with 131 additions and 9 deletions

View File

@@ -1,12 +1,124 @@
require('plugins.filetree') require('plugins.filetree')
local finder = require('plugins.finder') -- local finder = require('plugins.finder')
finder.setup({ -- finder.setup({
exclude_patterns = { 'node_modules', 'dist', 'build', '.git', '.cache', '.turbo', '*-lock.json' }, -- exclude_patterns = { 'node_modules', 'dist', 'build', '.git', '.cache', '.turbo', '*-lock.json' },
use_disk_cache = true, -- use_disk_cache = true,
follow_symlinks = true, -- follow_symlinks = true,
}) -- })
vim.keymap.set('n', '<leader>f', finder.files) require('fzf-lua').setup({
vim.keymap.set('n', '<leader>g', finder.grep) fzf_colors = {
['fg'] = { 'fg', 'PickerNormal' },
['bg'] = { 'bg', 'PickerNormal' },
['fg+'] = { 'fg', 'PickerSelection' },
['bg+'] = { 'bg', 'PickerSelection' },
['hl'] = { 'fg', 'PickerMatch' },
['hl+'] = { 'fg', 'PickerMatch' },
['info'] = { 'fg', 'PickerMuted' },
['prompt'] = { 'fg', 'PickerPrompt' },
['pointer'] = { 'fg', 'PickerPrompt' },
['marker'] = { 'fg', 'PickerPrompt' },
['spinner'] = { 'fg', 'PickerPrompt' },
['header'] = { 'fg', 'PickerMuted' },
['border'] = { 'fg', 'PickerBorder' },
['separator'] = { 'fg', 'PickerBorder' },
['gutter'] = '-1',
},
hls = {
normal = 'PickerNormal',
border = 'PickerBorder',
title = 'PickerTitle',
title_flags = 'PickerMuted',
preview_normal = 'PickerPreview',
preview_border = 'PickerPreviewBorder',
preview_title = 'PickerTitle',
cursorline = 'PickerSelection',
cursorlinenr = 'PickerMuted',
search = 'PickerMatch',
header_bind = 'PickerMuted',
header_text = 'PickerMuted',
path_colnr = 'PickerMuted',
path_linenr = 'PickerMuted',
},
winopts = {
split = function()
vim.cmd(('botright %dnew +set\\ nobl'):format(math.max(12, math.floor(vim.o.lines * 0.35))))
end,
backdrop = 100,
treesitter = false,
preview = {
default = 'builtin',
delay = 0,
layout = 'flex',
horizontal = 'right:55%',
vertical = 'down:45%',
flip_columns = 120,
},
},
files = {
follow = true,
fd_opts = table.concat({
'--color=never',
'--type f',
'--type l',
'--hidden',
'--follow',
'--exclude .git',
'--exclude .cache',
'--exclude .turbo',
'--exclude node_modules',
'--exclude dist',
'--exclude build',
'--exclude "*-lock.json"',
'--exclude "*-lock.yaml"',
}, ' '),
rg_opts = table.concat({
'--color=never',
'--files',
'--hidden',
'--follow',
'-g "!.git"',
'-g "!.cache"',
'-g "!.turbo"',
'-g "!node_modules"',
'-g "!dist"',
'-g "!build"',
'-g "!*-lock.json"',
'-g "!*-lock.yaml"',
}, ' '),
},
grep = {
rg_opts = table.concat({
'--column',
'--line-number',
'--no-heading',
'--color=always',
'--colors "path:none"',
'--colors "line:none"',
'--colors "column:none"',
'--colors "match:fg:166"',
'--colors "match:style:bold"',
'--smart-case',
'--max-columns=4096',
'--hidden',
'--follow',
'--glob "!.git"',
'--glob "!.cache"',
'--glob "!.turbo"',
'--glob "!node_modules"',
'--glob "!dist"',
'--glob "!build"',
'--glob "!*-lock.json"',
'--glob "!*-lock.yaml"',
'-e',
}, ' '),
},
})
local fzf = require('fzf-lua')
-- vim.keymap.set('n', '<leader>f', finder.files)
-- vim.keymap.set('n', '<leader>g', finder.grep)
-- vim.keymap.set('n', '<leader>fc', finder.clear_cache) -- vim.keymap.set('n', '<leader>fc', finder.clear_cache)
-- vim.keymap.set('n', '<leader>fD', finder.diagnose) -- vim.keymap.set('n', '<leader>fD', finder.diagnose)
vim.keymap.set('n', '<leader>f', fzf.files)
vim.keymap.set('n', '<leader>g', fzf.live_grep)

View File

@@ -15,6 +15,15 @@ function M.load_theme()
TabLineFill = { bg = c.black }, TabLineFill = { bg = c.black },
Pmenu = { fg = c.text, bg = c.surface }, Pmenu = { fg = c.text, bg = c.surface },
PmenuSel = { fg = c.text, bg = c.accent_light }, PmenuSel = { fg = c.text, bg = c.accent_light },
PickerNormal = { fg = c.text, bg = c.surface },
PickerSelection = { fg = c.text, bg = c.selection },
PickerMatch = { fg = c.yellow, bg = c.none, bold = true },
PickerMuted = { fg = c.muted },
PickerBorder = { fg = c.outline, bg = c.surface },
PickerPrompt = { fg = c.accent, bg = c.none, bold = true },
PickerPreview = { fg = c.text, bg = c.base },
PickerPreviewBorder = { fg = c.outline, bg = c.base },
PickerTitle = { fg = c.muted, bg = c.surface },
QuickFixLine = { fg = c.accent, bg = c.none, bold = true }, QuickFixLine = { fg = c.accent, bg = c.none, bold = true },
Special = { fg = c.syntax, bg = c.none, bold = false, italic = true }, Special = { fg = c.syntax, bg = c.none, bold = false, italic = true },
['@lsp'] = { fg = c.syntax, bg = c.none }, ['@lsp'] = { fg = c.syntax, bg = c.none },

View File

@@ -6,6 +6,7 @@ function M.get()
{ 'https://github.com/mason-org/mason.nvim', opt = true }, { 'https://github.com/mason-org/mason.nvim', opt = true },
{ 'https://github.com/triimd/invero.nvim' }, { 'https://github.com/triimd/invero.nvim' },
{ 'https://github.com/ibhagwan/fzf-lua' },
{ 'https://gitea.tomastm.com/tomas.mirchev/nvim-tree.lua', version = 'master' }, { 'https://gitea.tomastm.com/tomas.mirchev/nvim-tree.lua', version = 'master' },
{ 'https://github.com/windwp/nvim-ts-autotag' }, { 'https://github.com/windwp/nvim-ts-autotag' },

View File

@@ -1 +1 @@
{"conform.nvim":{"status":0,"hash":"619363c30309d29ffa631e67c8183f2a72caa373","name":"conform.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/conform.nvim","url":"https://github.com/stevearc/conform.nvim"},"nvim-autopairs":{"status":0,"hash":"7b9923abad60b903ece7c52940e1321d39eccc79","name":"nvim-autopairs","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-autopairs","url":"https://github.com/windwp/nvim-autopairs"},"mason.nvim":{"status":0,"hash":"bb639d4bf385a4d89f478b83af4d770be05ab7eb","name":"mason.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/mason.nvim","url":"https://github.com/mason-org/mason.nvim"},"vim-fugitive":{"status":0,"hash":"3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0","name":"vim-fugitive","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/vim-fugitive","url":"https://github.com/tpope/vim-fugitive"},"invero.nvim":{"status":2,"hash":"193065f32af9659a8500c0c093c373cdcac1969a","name":"invero.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/invero.nvim","url":"https://github.com/triimd/invero.nvim"},"nvim-ts-autotag":{"status":0,"hash":"88c1453db4ba7dd24131086fe51fdf74e587d275","name":"nvim-ts-autotag","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-ts-autotag","url":"https://github.com/windwp/nvim-ts-autotag"},"nvim-lint":{"status":0,"hash":"d48f3a76189d03b2239f6df1b2f7e3fa8353743b","name":"nvim-lint","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-lint","url":"https://github.com/mfussenegger/nvim-lint"},"paq-nvim":{"status":0,"hash":"971344d1fe1fd93580961815e7b7c8853c3605e4","name":"paq-nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/paq-nvim","url":"https://github.com/savq/paq-nvim.git"},"nvim-tree.lua":{"status":0,"hash":"7c0f7e906ab6f11b61eec52171eaf7dc06726ef1","name":"nvim-tree.lua","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-tree.lua","url":"https://gitea.tomastm.com/tomas.mirchev/nvim-tree.lua"},"nvim-treesitter":{"status":0,"hash":"4916d6592ede8c07973490d9322f187e07dfefac","name":"nvim-treesitter","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-treesitter","url":"https://github.com/nvim-treesitter/nvim-treesitter"}} {"conform.nvim":{"status":0,"hash":"619363c30309d29ffa631e67c8183f2a72caa373","name":"conform.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/conform.nvim","url":"https://github.com/stevearc/conform.nvim"},"nvim-autopairs":{"status":0,"hash":"7b9923abad60b903ece7c52940e1321d39eccc79","name":"nvim-autopairs","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-autopairs","url":"https://github.com/windwp/nvim-autopairs"},"mason.nvim":{"status":0,"hash":"bb639d4bf385a4d89f478b83af4d770be05ab7eb","name":"mason.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/mason.nvim","url":"https://github.com/mason-org/mason.nvim"},"vim-fugitive":{"status":0,"hash":"3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0","name":"vim-fugitive","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/vim-fugitive","url":"https://github.com/tpope/vim-fugitive"},"invero.nvim":{"status":2,"hash":"193065f32af9659a8500c0c093c373cdcac1969a","name":"invero.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/invero.nvim","url":"https://github.com/triimd/invero.nvim"},"nvim-ts-autotag":{"status":0,"hash":"88c1453db4ba7dd24131086fe51fdf74e587d275","name":"nvim-ts-autotag","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-ts-autotag","url":"https://github.com/windwp/nvim-ts-autotag"},"nvim-lint":{"status":0,"hash":"d48f3a76189d03b2239f6df1b2f7e3fa8353743b","name":"nvim-lint","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-lint","url":"https://github.com/mfussenegger/nvim-lint"},"paq-nvim":{"status":0,"hash":"971344d1fe1fd93580961815e7b7c8853c3605e4","name":"paq-nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/paq-nvim","url":"https://github.com/savq/paq-nvim.git"},"nvim-tree.lua":{"status":0,"hash":"7c0f7e906ab6f11b61eec52171eaf7dc06726ef1","name":"nvim-tree.lua","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-tree.lua","url":"https://gitea.tomastm.com/tomas.mirchev/nvim-tree.lua"},"nvim-treesitter":{"status":0,"hash":"4916d6592ede8c07973490d9322f187e07dfefac","name":"nvim-treesitter","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-treesitter","url":"https://github.com/nvim-treesitter/nvim-treesitter"},"fzf-lua":{"status":0,"hash":"fea9eedc6894c44d44cbb772a5cd11c93b82d7a1","name":"fzf-lua","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/fzf-lua","url":"https://github.com/ibhagwan/fzf-lua"}}