nvim: switch from telescope to fzf-lua
This commit is contained in:
parent
8be233972e
commit
c9a390f19c
10 changed files with 72 additions and 175 deletions
|
@ -1,11 +1,14 @@
|
|||
(let [mod {}
|
||||
keymap vim.keymap
|
||||
substitute (require :substitute)
|
||||
telescope-builtin (require :telescope.builtin)
|
||||
telescope-themes (require :telescope.themes)
|
||||
telescope-nifoc (require :nifoc.telescope)
|
||||
telescope-ivy (telescope-themes.get_ivy)
|
||||
telescope-dropdown (telescope-themes.get_dropdown)
|
||||
fzf (require :fzf-lua)
|
||||
fzf-layout-bottom {:winopts_fn #(let [height (math.floor (* vim.o.lines
|
||||
0.4))]
|
||||
{:split (.. "belowright new | resize "
|
||||
(tostring height))})}
|
||||
fzf-layout-dropdown {:winopts {:height 0.4
|
||||
:width 0.6
|
||||
:preview {:hidden :hidden}}}
|
||||
npairs (require :nvim-autopairs)
|
||||
hover (require :hover)
|
||||
gitsigns (require :gitsigns)
|
||||
|
@ -17,30 +20,21 @@
|
|||
(fn mod.setup []
|
||||
(keymap.set :n :<space> :<nop> {:noremap true})
|
||||
;; Leader Mappings
|
||||
(keymap.set :n :<leader>o telescope-nifoc.find-files {:desc "Find Files"})
|
||||
(keymap.set :n :<leader>s #(telescope-builtin.live_grep telescope-ivy)
|
||||
(keymap.set :n :<leader>o fzf.files {:desc "Find Files"})
|
||||
(keymap.set :n :<leader>s #(fzf.live_grep fzf-layout-bottom)
|
||||
{:desc "Live Grep"})
|
||||
(keymap.set :n :<leader>fn :<cmd>enew<CR> {:desc "New File"})
|
||||
(keymap.set :n :<leader>u "<cmd>UrlView buffer<CR>" {:desc "Open UrlView"})
|
||||
(keymap.set :n :<leader>ut "<cmd>Telescope undo<CR>"
|
||||
{:desc "Toggle Undotree"})
|
||||
(keymap.set :n :<leader>c repl.open-shell {:desc "Open Shell"})
|
||||
(keymap.set :n :<leader>r repl.open-repl {:desc "Open REPL"})
|
||||
(keymap.set :n :<leader>bl #(telescope-builtin.buffers telescope-dropdown)
|
||||
{:desc "List Buffers"})
|
||||
(keymap.set :n :<leader>bf
|
||||
#(telescope-builtin.current_buffer_fuzzy_find telescope-dropdown)
|
||||
{:desc "Find In Buffer"})
|
||||
(keymap.set :n :<leader>bt
|
||||
#(telescope-builtin.treesitter telescope-dropdown)
|
||||
{:desc "Find via Treesitter"})
|
||||
(keymap.set :n :<leader>pt :<cmd>TodoTelescope<CR> {:desc "TODO Comments"})
|
||||
(keymap.set :n :<leader>bl fzf.buffers {:desc "List Buffers"})
|
||||
(keymap.set :n :<leader>bf fzf.grep_curbuf {:desc "Find In Buffer"})
|
||||
(keymap.set :n :<leader>bt fzf.treesitter {:desc "Find via Treesitter"})
|
||||
(keymap.set :n :<leader>g #(neogit.open {:kind :split})
|
||||
{:desc "Open Neogit"})
|
||||
(keymap.set :n :<leader>vs #(neogit.open {:kind :split})
|
||||
{:desc "VCS Status"})
|
||||
(keymap.set :n :<leader>vb
|
||||
#(telescope-builtin.git_branches telescope-dropdown)
|
||||
(keymap.set :n :<leader>vb #(fzf.git_branches fzf-layout-dropdown)
|
||||
{:desc "List VCS Branches"})
|
||||
(keymap.set :n :<leader>vl #(gitsigns.blame_line {:full true})
|
||||
{:desc "Blame Line"})
|
||||
|
@ -49,11 +43,10 @@
|
|||
(keymap.set :n :<leader>vvm #(repo.open-merge-request) {:desc "Open MR"})
|
||||
(keymap.set :n :<leader>vvc #(repo.open-ci) {:desc "Open CI"})
|
||||
(keymap.set :n :<leader>vtc #(repo.run-ci) {:desc "Trigger CI"})
|
||||
(keymap.set :n :<leader>lk telescope-builtin.keymaps
|
||||
{:desc "Show Keymappings"})
|
||||
(keymap.set :n :<leader>ld #(telescope-builtin.diagnostics telescope-ivy)
|
||||
(keymap.set :n :<leader>lk fzf.keymaps {:desc "Show Keymappings"})
|
||||
(keymap.set :n :<leader>ld #(fzf.diagnostics_document fzf-layout-bottom)
|
||||
{:desc "Show Diagnostics"})
|
||||
(keymap.set :n :<leader>lt "<cmd>TodoTelescope theme=ivy<CR>"
|
||||
(keymap.set :n :<leader>lt :<cmd>TodoFzfLua<CR>
|
||||
{:desc "Show Todo Comments"})
|
||||
(keymap.set :n :<leader>dli :<cmd>LspInfo<CR> {:desc "LSP Info"})
|
||||
(keymap.set :n :<leader>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"})
|
||||
|
@ -104,27 +97,21 @@
|
|||
{1 :<leader>d :group :debug}]))
|
||||
|
||||
(fn mod.lsp-attach [_client bufnr]
|
||||
(keymap.set :n :<leader>t
|
||||
#(telescope-builtin.lsp_document_symbols telescope-dropdown)
|
||||
(keymap.set :n :<leader>t #(fzf.lsp_document_symbols fzf-layout-dropdown)
|
||||
{:buffer bufnr :desc "LSP Document Symbols"})
|
||||
(keymap.set :n :<leader>tw
|
||||
#(telescope-builtin.lsp_dynamic_workspace_symbols telescope-dropdown)
|
||||
(keymap.set :n :<leader>tw #(fzf.lsp_workspace_symbols fzf-layout-dropdown)
|
||||
{:buffer bufnr :desc "LSP Workspace Symbols"})
|
||||
(keymap.set :n :<leader>th
|
||||
#(vim.lsp.inlay_hint.enable (not (vim.lsp.inlay_hint.is_enabled bufnr))
|
||||
{: bufnr})
|
||||
{:buffer bufnr :desc "Toggle Inlay Hints"})
|
||||
(keymap.set :n :<leader>lca
|
||||
#(telescope-builtin.lsp_code_actions telescope-dropdown)
|
||||
(keymap.set :n :<leader>lca fzf.lsp_code_actions
|
||||
{:buffer bufnr :desc "LSP Code Action"})
|
||||
(keymap.set :n :<leader>lfr
|
||||
#(telescope-builtin.lsp_references telescope-dropdown)
|
||||
(keymap.set :n :<leader>lfr fzf.lsp_references
|
||||
{:buffer bufnr :desc "Find References"})
|
||||
(keymap.set :n :<leader>lfd
|
||||
#(telescope-builtin.lsp_definitions telescope-dropdown)
|
||||
(keymap.set :n :<leader>lfd fzf.lsp_definitions
|
||||
{:buffer bufnr :desc "Find Definitions"})
|
||||
(keymap.set :n :<leader>lfi
|
||||
#(telescope-builtin.lsp_implementations telescope-dropdown)
|
||||
(keymap.set :n :<leader>lfi fzf.lsp_implementations
|
||||
{:buffer bufnr :desc "Find Implementations"}))
|
||||
|
||||
(fn mod.terminal-open [bufnr]
|
||||
|
|
|
@ -11,8 +11,11 @@
|
|||
nifoc-treesitter (require :nifoc.treesitter)
|
||||
navic (require :nvim-navic)
|
||||
neogit (require :neogit)
|
||||
telescope-builtin (require :telescope.builtin)
|
||||
telescope-themes (require :telescope.themes)]
|
||||
fzf (require :fzf-lua)
|
||||
fzf-layout-bottom {:winopts_fn #(let [height (math.floor (* vim.o.lines
|
||||
0.4))]
|
||||
{:split (.. "belowright new | resize "
|
||||
(tostring height))})}]
|
||||
(fn buffer-variable-exists? [key]
|
||||
(not= (. vim :b key) nil))
|
||||
|
||||
|
@ -207,7 +210,7 @@
|
|||
self.hints]))))
|
||||
:update [:DiagnosticChanged :BufEnter]
|
||||
:on_click {:name :heirline_diagnostics_list
|
||||
:callback #(telescope-builtin.diagnostics (telescope-themes.get_ivy {:bufnr 0}))}
|
||||
:callback #(fzf.diagnostics_document fzf-layout-bottom)}
|
||||
1 mod.space-if-count
|
||||
2 {:provider (fn [self]
|
||||
(let [spacer (if (or (> self.warnings 0)
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
(let [mod {}
|
||||
builtin (require :telescope.builtin)
|
||||
themes (require :telescope.themes)]
|
||||
(fn mod.find-files []
|
||||
(let [find-opts (themes.get_ivy {:find_command [:fd
|
||||
:--type
|
||||
:file
|
||||
:--hidden
|
||||
:--ignore-vcs
|
||||
:-L
|
||||
:--color
|
||||
:never
|
||||
:--exclude
|
||||
:.git
|
||||
:--exclude
|
||||
:node_modules
|
||||
:--exclude
|
||||
:.direnv]})]
|
||||
(builtin.find_files find-opts)))
|
||||
|
||||
(fn mod.project-files []
|
||||
(let [git-opts (themes.get_ivy)
|
||||
ok? (pcall builtin.git_files git-opts)]
|
||||
(when (not ok?)
|
||||
(mod.find-files))))
|
||||
|
||||
mod)
|
17
home/config/nvim/plugins/fzf.fnl
Normal file
17
home/config/nvim/plugins/fzf.fnl
Normal file
|
@ -0,0 +1,17 @@
|
|||
(let [fzf (require :fzf-lua)]
|
||||
(fzf.setup {:files {:cwd_prompt false :prompt "Files❯ "}
|
||||
:grep {:prompt "Grep❯ "}
|
||||
:grep_curbuf {:prompt "BGrep❯ "}
|
||||
:buffers {:prompt "Buffers❯ "}
|
||||
:treesitter {:prompt "Tree-sitter❯ "}
|
||||
:lsp {:prompt_postfix "❯ "
|
||||
:symbols {:prompt_postfix "❯ "}
|
||||
:code_actions {:prompt "CodeActions❯ "}
|
||||
:diagnostics {:prompt "Diagnostics❯ "}
|
||||
:keymaps {:prompt "Keymaps❯ "}}
|
||||
:winopts {:backdrop false}
|
||||
:previewers {:builtin {:extensions {:gif :chafa
|
||||
:jpg :chafa
|
||||
:png :chafa}}}
|
||||
:fzf_colors true})
|
||||
(fzf.register_ui_select))
|
|
@ -20,10 +20,10 @@
|
|||
ns.position
|
||||
ns.search-count
|
||||
ns.command])
|
||||
(local telescope-statusline
|
||||
(local fzf-statusline
|
||||
{:condition (fn []
|
||||
(conditions.buffer_matches {:filetype [:TelescopePrompt]}))
|
||||
1 (ns.custom-mode :Telescope :black :green)})
|
||||
(conditions.buffer_matches {:filetype [:fzf]}))
|
||||
1 (ns.custom-mode :FZF :black :green)})
|
||||
(local neogit-statusline {:condition (fn []
|
||||
(conditions.buffer_matches {:filetype [:NeogitBranchDescription
|
||||
:NeogitCommitMessage
|
||||
|
@ -44,7 +44,7 @@
|
|||
5 (ns.shell-mode :black :purple)})
|
||||
(local statusline {:hl ns.default-hl
|
||||
:fallthrough false
|
||||
1 telescope-statusline
|
||||
1 fzf-statusline
|
||||
2 neogit-statusline
|
||||
3 shell-statusline
|
||||
4 default-statusline})
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
(let [illuminate (require :illuminate)]
|
||||
(illuminate.configure {:filetypes_denylist [:TelescopePrompt :netrw]}))
|
||||
|
||||
(illuminate.configure {:filetypes_denylist [:TelescopePrompt :netrw :fzf]}))
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
(let [telescope (require :telescope)
|
||||
actions (require :telescope.actions)
|
||||
themes (require :telescope.themes)]
|
||||
(telescope.setup {:defaults {; Display
|
||||
:prompt_prefix " "
|
||||
:selection_caret " "
|
||||
:set_env {:COLORTERM :truecolor}
|
||||
:path_display [:truncate :absolute]
|
||||
; Layout
|
||||
:layout_strategy :horizontal
|
||||
:layout_config {:horizontal {:preview_width 0.5}}
|
||||
; Mappings
|
||||
:mappings {:i {:<esc> actions.close}}
|
||||
; Arguments
|
||||
:vimgrep_arguments [:rg
|
||||
:--hidden
|
||||
:--ignore-vcs
|
||||
:-g
|
||||
:!.git/*
|
||||
:--color=never
|
||||
:--no-heading
|
||||
:--with-filename
|
||||
:--line-number
|
||||
:--column
|
||||
:--smart-case
|
||||
:--trim]}
|
||||
:extensions {:ui-select [(themes.get_dropdown {})]
|
||||
:zf-native {:file {:enable true
|
||||
:highlight_results true
|
||||
:match_filename true}
|
||||
:generic {:enable true
|
||||
:highlight_results true
|
||||
:match_filename false}}}})
|
||||
(telescope.load_extension :zf-native)
|
||||
(telescope.load_extension :ui-select)
|
||||
(telescope.load_extension :yank_history)
|
||||
(telescope.load_extension :undo)
|
||||
(let [augroup (vim.api.nvim_create_augroup :NifocTelescope {:clear true})
|
||||
aucmd vim.api.nvim_create_autocmd]
|
||||
(aucmd :FileType {:pattern :TelescopePrompt
|
||||
:callback #(set vim.opt_local.cursorline false)
|
||||
:group augroup})
|
||||
(aucmd :User {:pattern :TelescopePreviewerLoaded
|
||||
:command "let w:is_telescope=v:true"
|
||||
:group augroup})
|
||||
(aucmd :BufWinEnter {:callback #(when vim.w.is_telescope
|
||||
(set vim.opt_local.number true)
|
||||
(set vim.opt_local.relativenumber false)
|
||||
(set vim.opt_local.wrap true))
|
||||
:group augroup})))
|
|
@ -21,11 +21,14 @@ in
|
|||
stdenv.cc
|
||||
|
||||
git
|
||||
delta
|
||||
nodejs
|
||||
tree-sitter
|
||||
fd
|
||||
ripgrep
|
||||
universal-ctags
|
||||
fzf
|
||||
chafa
|
||||
|
||||
# LSP
|
||||
bash-language-server
|
||||
|
@ -131,18 +134,13 @@ in
|
|||
type = "fennel";
|
||||
}
|
||||
|
||||
# Telescope
|
||||
# Finder
|
||||
{
|
||||
plugin = telescope-nvim;
|
||||
config = builtins.readFile ../../config/nvim/plugins/telescope.fnl;
|
||||
plugin = fzf-lua;
|
||||
config = builtins.readFile ../../config/nvim/plugins/fzf.fnl;
|
||||
type = "fennel";
|
||||
}
|
||||
|
||||
pkgs.vimPlugins.telescope-zf-native-nvim
|
||||
|
||||
telescope-ui-select-nvim
|
||||
telescope-undo-nvim
|
||||
|
||||
# LSP
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
|
|
|
@ -36,12 +36,12 @@ in
|
|||
};
|
||||
nvim-web-devicons = buildVimPlugin {
|
||||
pname = "nvim-web-devicons";
|
||||
version = "2024-12-24";
|
||||
version = "2024-12-26";
|
||||
src = fetchFromGitHub {
|
||||
owner = "kyazdani42";
|
||||
repo = "nvim-web-devicons";
|
||||
rev = "c1a86a2c386c55efc02fa2ec2c3a914af653d954";
|
||||
sha256 = "09xqzjsaklic12av1x79blvyjfi3falrxc1q4mnwpyb0f0angv05";
|
||||
rev = "63f552a7f59badc6e6b6d22e603150f0d5abebb7";
|
||||
sha256 = "04yr85zz9b04lgxl9gfda52l0p82a1lc891s921mll3bx48i1xb2";
|
||||
fetchSubmodules = false;
|
||||
|
||||
};
|
||||
|
@ -148,12 +148,12 @@ in
|
|||
};
|
||||
nvim-treesitter = buildVimPlugin {
|
||||
pname = "nvim-treesitter";
|
||||
version = "2024-12-25";
|
||||
version = "2024-12-26";
|
||||
src = fetchFromGitHub {
|
||||
owner = "nvim-treesitter";
|
||||
repo = "nvim-treesitter";
|
||||
rev = "ac6a72a6f83218216948e898362f09029b8035dc";
|
||||
sha256 = "0mrp9w7q60g43yd3f6ryrva06siy9bh4nxjlsjz0bsnssr70yhgm";
|
||||
rev = "17678b00fa5c2712890a0ec2e269d0a4de1207df";
|
||||
sha256 = "0d6fw1205bhlaxi0kzbl9gn4vgnyca2qxbnch21hz2mbm2wlq8qm";
|
||||
fetchSubmodules = false;
|
||||
|
||||
};
|
||||
|
@ -188,42 +188,14 @@ in
|
|||
doCheck = false;
|
||||
doInstallCheck = false;
|
||||
};
|
||||
telescope-nvim = buildVimPlugin {
|
||||
pname = "telescope.nvim";
|
||||
version = "2024-11-29";
|
||||
fzf-lua = buildVimPlugin {
|
||||
pname = "fzf-lua";
|
||||
version = "2024-12-26";
|
||||
src = fetchFromGitHub {
|
||||
owner = "nvim-telescope";
|
||||
repo = "telescope.nvim";
|
||||
rev = "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc";
|
||||
sha256 = "0bkpys6dj01x6ycylmf6vrd2mqjibmny9a2hxxrqn0jqqvagm5ly";
|
||||
fetchSubmodules = false;
|
||||
|
||||
};
|
||||
doCheck = false;
|
||||
doInstallCheck = false;
|
||||
};
|
||||
telescope-ui-select-nvim = buildVimPlugin {
|
||||
pname = "telescope-ui-select.nvim";
|
||||
version = "2023-12-04";
|
||||
src = fetchFromGitHub {
|
||||
owner = "nvim-telescope";
|
||||
repo = "telescope-ui-select.nvim";
|
||||
rev = "6e51d7da30bd139a6950adf2a47fda6df9fa06d2";
|
||||
sha256 = "1cgi4kmq99ssx97nnriff5674cjfvc3qsw62nx3iz0xqc6d4s631";
|
||||
fetchSubmodules = false;
|
||||
|
||||
};
|
||||
doCheck = false;
|
||||
doInstallCheck = false;
|
||||
};
|
||||
telescope-undo-nvim = buildVimPlugin {
|
||||
pname = "telescope-undo.nvim";
|
||||
version = "2024-11-05";
|
||||
src = fetchFromGitHub {
|
||||
owner = "debugloop";
|
||||
repo = "telescope-undo.nvim";
|
||||
rev = "2971cc9f193ec09e0c5de3563f99cbea16b63f10";
|
||||
sha256 = "0cg4w40wmr1k2l5zb25zffpp990wsmi6kq39fvfzy4ay2wx56zgs";
|
||||
owner = "ibhagwan";
|
||||
repo = "fzf-lua";
|
||||
rev = "76e25abc4bbaab243b52fad7f7d4262e76254fd3";
|
||||
sha256 = "0prii8hv8jli4p69mjqjma650q906f187i6zvk2g9i4kdvzzqpj6";
|
||||
fetchSubmodules = false;
|
||||
|
||||
};
|
||||
|
|
|
@ -15,10 +15,8 @@
|
|||
- src: nvim-treesitter/nvim-treesitter
|
||||
- src: HiPhish/rainbow-delimiters.nvim
|
||||
- src: folke/todo-comments.nvim
|
||||
# Telescope
|
||||
- src: nvim-telescope/telescope.nvim
|
||||
- src: nvim-telescope/telescope-ui-select.nvim
|
||||
- src: debugloop/telescope-undo.nvim
|
||||
# Finder
|
||||
- src: ibhagwan/fzf-lua
|
||||
# LSP
|
||||
- src: neovim/nvim-lspconfig
|
||||
- src: mfussenegger/nvim-jdtls
|
||||
|
|
Loading…
Reference in a new issue