neoconfig/lua/custom/functions.lua

10 lines
551 B
Lua

-- Alternatively, using a Lua function
local function lines_with_preview()
local current_file = vim.fn.fnameescape(vim.fn.expand('%'))
local rg_command = string.format("rg --with-filename --column --line-number --no-heading --color=always --smart-case . %s", current_file)
local fzf_command = string.format("call fzf#vim#grep('%s', 1, fzf#vim#with_preview({'options': '--delimiter : --nth 4.. --no-sort'}, 'up:50%%', '?'), 1)", rg_command)
vim.cmd(fzf_command)
end
vim.api.nvim_create_user_command('LinesWithPreview', lines_with_preview, {})