Skip to content

Commit

Permalink
Move from Telescope to fzf-lua
Browse files Browse the repository at this point in the history
  • Loading branch information
ldonnez committed Dec 20, 2024
1 parent 0691068 commit 5072ad7
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 178 deletions.
5 changes: 1 addition & 4 deletions .config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "6239d9986f51ca93ded99ecdb1af0e287eabb651" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "43b8f74e0b1e3f41e51f640f8efa3bcd401cea0d" },
"emmet-vim": { "branch": "master", "commit": "6c511a8d7d2863066f32e25543e2bb99d505172c" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"fzf-lua": { "branch": "main", "commit": "34d5e4053a3825ef16a04aa3664dc856c6a13e64" },
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
"hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" },
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
Expand All @@ -29,9 +29,6 @@
"persisted.nvim": { "branch": "main", "commit": "e9a179271b1c7888e0a87448b3cf81652a6606c1" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"rest.nvim": { "branch": "main", "commit": "e82dc524894b1b55bcc3296d3644f15c9e06d5ad" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
"telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" },
"typescript-tools.nvim": { "branch": "master", "commit": "f8c2e0b36b651c85f52ad5c5373ff8b07adc15a7" },
"vim-dadbod": { "branch": "master", "commit": "f740950d0703099e0f172016f10e0e39f50fd0ba" },
"vim-dadbod-completion": { "branch": "master", "commit": "04485bfb53a629423233a4178d71cd4f8abf7406" },
Expand Down
2 changes: 1 addition & 1 deletion .config/nvim/lua/plugins/catppuccin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ return {
treesitter = true,
cmp = true,
gitsigns = true,
telescope = true,
telescope = false,
dashboard = false,
neotree = true,
which_key = true,
Expand Down
109 changes: 109 additions & 0 deletions .config/nvim/lua/plugins/fzf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
return {
"ibhagwan/fzf-lua",
config = function()
local actions = require("fzf-lua.actions")

require("fzf-lua").setup({
"fzf-vim",
fzf_colors = true,
fzf_opts = {
["--no-scrollbar"] = true,
},
keymap = {
fzf = {
["ctrl-a"] = "toggle-all",
},
},
defaults = {
actions = {
["ctrl-q"] = actions.file_sel_to_qf,
["ctrl-y"] = function(selected)
local path = require("fzf-lua.path")
local entry = path.entry_to_file(selected[1])

if entry.path == "<none>" then
return
end

vim.fn.setreg("+", entry.path)

print("Copied to clipboard: " .. entry.path)
end,
},
},
files = {
fd_opts = [[--type f --hidden --follow --no-ignore-vcs]],
no_header_i = true,
},
grep = {
rg_opts = [[--line-number --column --no-heading --color=always --with-filename --smart-case --trim --no-ignore-vcs --hidden]],
},
winopts = {
row = 0.2,
height = 0.8,
width = 0.7,
treesitter = {
enabled = true,
},
preview = {
layout = "vertical",
vertical = "down:60%",
hidden = "nohidden",
},
},
})

require("fzf-lua").register_ui_select(function(_, items)
return {
winopts = {
height = math.floor(math.min(vim.o.lines * 0.4, #items + 2) + 0.5),
width = 0.5,
relative = "cursor",
row = 1,
backdrop = 100,
preview = { hidden = "hidden" },
},
}
end)
end,
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = { "FzfLua" },
keys = {
{
"<C-p>",
function()
require("fzf-lua").files()
end,

desc = "Find files",
},
{
"<leader>b",
function()
require("fzf-lua").buffers()
end,
desc = "Find buffers",
},
{
"<leader>lg",
function()
require("fzf-lua").live_grep()
end,
desc = "Live grep",
},
{
"<leader>g",
function()
require("fzf-lua").git_status()
end,
desc = "Show changed files (git)",
},
{
"<leader>cr",
function()
require("fzf-lua").lsp_references()
end,
desc = "LSP References",
},
},
}
173 changes: 0 additions & 173 deletions .config/nvim/lua/plugins/telescope.lua

This file was deleted.

0 comments on commit 5072ad7

Please sign in to comment.