From 60852c0473c88065c1c3d7bc95e9823eacb0e335 Mon Sep 17 00:00:00 2001
From: jdhao
Date: Wed, 2 Apr 2025 18:20:01 +0200
Subject: [PATCH] Switch from LeaderF to Fzf-lua as the default fuzzy finder
(#395)
---
README.md | 7 ++--
lua/config/dashboard-nvim.lua | 6 +--
lua/plugin_specs.lua | 28 ++++++-------
viml_conf/plugins.vim | 79 -----------------------------------
4 files changed, 18 insertions(+), 102 deletions(-)
diff --git a/README.md b/README.md
index e3b9542..a03da8f 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
+ Language server protocol (LSP) support via [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
+ Git integration via [vim-fugitive](https://github.com/tpope/vim-fugitive).
+ Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim).
-+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
++ Ultra-fast project-wide fuzzy searching via [fzf-lua](https://github.com/ibhagwan/fzf-lua).
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
+ Faster matching pair insertion and jump via [nvim-autopairs](https://github.com/windwp/nvim-autopairs).
+ Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich).
@@ -79,7 +79,6 @@ and how to set up on different platforms (Linux, macOS, and Windows).
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex)
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
-+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
+ Undo management via [vim-mundo](https://github.com/simnalamburt/vim-mundo)
+ Code folding with [nvim-ufo](https://github.com/kevinhwang91/nvim-ufo) and [statuscol.nvim](https://github.com/luukvbaal/statuscol.nvim)
+ ......
@@ -94,10 +93,10 @@ For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15).
-## File fuzzy finding using LeaderF
+## File fuzzy finding using fzf-lua
-
+
## Code autocompletion with nvim-cmp
diff --git a/lua/config/dashboard-nvim.lua b/lua/config/dashboard-nvim.lua
index 562c124..fd92171 100644
--- a/lua/config/dashboard-nvim.lua
+++ b/lua/config/dashboard-nvim.lua
@@ -23,19 +23,19 @@ conf.center = {
{
icon = " ",
desc = "Find File ",
- action = "Leaderf file --popup",
+ action = "FzfLua files",
key = " f f",
},
{
icon = " ",
desc = "Recently opened files ",
- action = "Leaderf mru --popup",
+ action = "FzfLua oldfiles",
key = " f r",
},
{
icon = " ",
desc = "Project grep ",
- action = "Leaderf rg --popup",
+ action = "FzfLua live_grep",
key = " f g",
},
{
diff --git a/lua/plugin_specs.lua b/lua/plugin_specs.lua
index 475006c..5f201bd 100644
--- a/lua/plugin_specs.lua
+++ b/lua/plugin_specs.lua
@@ -106,20 +106,6 @@ local plugin_specs = {
require("config.hlslens")
end,
},
- {
- "Yggdroot/LeaderF",
- cmd = "Leaderf",
- build = function()
- local leaderf_path = plugin_dir .. "/LeaderF"
- vim.opt.runtimepath:append(leaderf_path)
- vim.cmd("runtime! plugin/leaderf.vim")
-
- if not vim.g.is_win then
- vim.cmd("LeaderfInstallCExtension")
- end
- end,
- },
- "nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
@@ -132,8 +118,18 @@ local plugin_specs = {
-- optional for icon support
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
- -- calling `setup` is optional for customization
- require("fzf-lua").setup {}
+ require("fzf-lua").setup {
+ winopts = {
+ row = 0.5,
+ height = 0.7,
+ },
+ }
+
+ vim.keymap.set("n", "ff", "FzfLua files", { desc = "Fuzzy find files" })
+ vim.keymap.set("n", "fg", "FzfLua live_grep", { desc = "Fuzzy grep files" })
+ vim.keymap.set("n", "fh", "FzfLua helptags", { desc = "Fuzzy grep tags in help files" })
+ vim.keymap.set("n", "ft", "FzfLua btags", { desc = "Fuzzy search buffer tags" })
+ vim.keymap.set("n", "fb", "FzfLua buffers", { desc = "Fuzzy search opened buffers" })
end,
},
{
diff --git a/viml_conf/plugins.vim b/viml_conf/plugins.vim
index 415bd78..cbf8ec4 100644
--- a/viml_conf/plugins.vim
+++ b/viml_conf/plugins.vim
@@ -34,85 +34,6 @@ let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
"""""""""""""""""""""""""" vlime settings """"""""""""""""""""""""""""""""
command! -nargs=0 StartVlime call jobstart(printf("sbcl --load %s/vlime/lisp/start-vlime.lisp", g:package_home))
-"""""""""""""""""""""""""""""LeaderF settings"""""""""""""""""""""
-" Do not use cache file
-let g:Lf_UseCache = 0
-" Refresh each time we call leaderf
-let g:Lf_UseMemoryCache = 0
-
-" Ignore certain files and directories when searching files
-let g:Lf_WildIgnore = {
- \ 'dir': ['.git', '__pycache__', '.DS_Store', '*_cache'],
- \ 'file': ['*.exe', '*.dll', '*.so', '*.o', '*.pyc', '*.jpg', '*.png',
- \ '*.gif', '*.svg', '*.ico', '*.db', '*.tgz', '*.tar.gz', '*.gz',
- \ '*.zip', '*.bin', '*.pptx', '*.xlsx', '*.docx', '*.pdf', '*.tmp',
- \ '*.wmv', '*.mkv', '*.mp4', '*.rmvb', '*.ttf', '*.ttc', '*.otf',
- \ '*.mp3', '*.aac']
- \}
-
-" Do not show fancy icons for Linux server.
-if g:is_linux
- let g:Lf_ShowDevIcons = 0
-endif
-
-" Only fuzzy-search files names
-let g:Lf_DefaultMode = 'FullPath'
-
-" Do not use version control tool to list files under a directory since
-" submodules are not searched by default.
-let g:Lf_UseVersionControlTool = 0
-
-" Use rg as the default search tool
-let g:Lf_DefaultExternalTool = "rg"
-
-" show dot files
-let g:Lf_ShowHidden = 1
-
-" Disable default mapping
-let g:Lf_ShortcutF = ''
-let g:Lf_ShortcutB = ''
-
-" set up working directory for git repository
-let g:Lf_WorkingDirectoryMode = 'a'
-
-" Search files in popup window
-nnoremap ff :Leaderf file --popup
-
-" Grep project files in popup window
-nnoremap fg :Leaderf rg --no-messages --popup --nameOnly
-
-" Search vim help files
-nnoremap fh :Leaderf help --popup
-
-" Search tags in current buffer
-nnoremap ft :Leaderf bufTag --popup
-
-" Switch buffers
-nnoremap fb :Leaderf buffer --popup
-
-" Search recent files
-nnoremap fr :Leaderf mru --popup --absolute-path
-
-let g:Lf_PopupColorscheme = 'gruvbox_material'
-
-" Change keybinding in LeaderF prompt mode, use ctrl-n and ctrl-p to navigate
-" items.
-let g:Lf_CommandMap = {'': [''], '': ['']}
-
-" do not preview results, it will add the file to buffer list
-let g:Lf_PreviewResult = {
- \ 'File': 0,
- \ 'Buffer': 0,
- \ 'Mru': 0,
- \ 'Tag': 0,
- \ 'BufTag': 1,
- \ 'Function': 1,
- \ 'Line': 0,
- \ 'Colorscheme': 0,
- \ 'Rg': 0,
- \ 'Gtags': 0
- \}
-
""""""""""""""""""""""""""" vista settings """"""""""""""""""""""""""""""""""
let g:vista#renderer#icons = {
\ 'member': '',