Skip to content

Commit 787367d

Browse files
Migrate fzf-lua to Snacks.picker
1 parent e50c026 commit 787367d

File tree

10 files changed

+447
-59
lines changed

10 files changed

+447
-59
lines changed

.config/nvim/lazy-lock.json

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,39 @@
22
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
33
"blink.cmp": { "branch": "main", "commit": "b6f11a0aa33e601c469a126e3ed6e35208fe3ea3" },
44
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
5-
"cellular-automaton.nvim": { "branch": "main", "commit": "11aea08aa084f9d523b0142c2cd9441b8ede09ed" },
5+
"cellular-automaton.nvim": { "branch": "main", "commit": "1606e9d5d04ff254023c3f3c62842d065708d6d3" },
66
"conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" },
77
"duck.nvim": { "branch": "main", "commit": "d8a6b08af440e5a0e2b3b357e2f78bb1883272cd" },
8-
"fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" },
9-
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
8+
"fidget.nvim": { "branch": "main", "commit": "3fa10de61546fd0a98faac3084a6c0db612adaf8" },
9+
"flash.nvim": { "branch": "main", "commit": "f899265876ecdcf7352dbc9f0adf87068cedefbb" },
1010
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
11-
"fzf-lua": { "branch": "main", "commit": "7a83b844423c6ec55c445f1de9ad51fe038f5df5" },
12-
"gitsigns.nvim": { "branch": "main", "commit": "d8918f06624dd53b9a82bd0e29c31bcfd541b40d" },
13-
"grug-far.nvim": { "branch": "main", "commit": "635e69adf3a714621bd0a289314bc23c5848babb" },
11+
"gitsigns.nvim": { "branch": "main", "commit": "0883d0f67c1b728713deeddfcec4aabf71410801" },
12+
"grug-far.nvim": { "branch": "main", "commit": "3a8690461afac34c0e5bacb0f7b4bc3066aab665" },
1413
"harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" },
1514
"incline.nvim": { "branch": "main", "commit": "16fc9c073e3ea4175b66ad94375df6d73fc114c0" },
1615
"indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" },
17-
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
16+
"lazy.nvim": { "branch": "main", "commit": "7527af40ddd4a93a02911be570b32609b9d4ea53" },
1817
"lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" },
1918
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
2019
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
21-
"mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" },
22-
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
20+
"mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" },
21+
"mason-tool-installer.nvim": { "branch": "main", "commit": "374c78d3ebb5c53f43ea6bd906b6587b5e899b9e" },
2322
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
24-
"mini.nvim": { "branch": "main", "commit": "7a75a970d0bae09ef579e41dbb20551bdf596f31" },
25-
"noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
23+
"mini.nvim": { "branch": "main", "commit": "87fc38a8a2b8d498cecb021d057a38ea2e9f5a79" },
24+
"noice.nvim": { "branch": "main", "commit": "e3c68a4d2275a01268a52e2931bfccfbfb693d15" },
2625
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
27-
"nvim-lspconfig": { "branch": "master", "commit": "e5bf88e5ea1c4cea5ea96b1e970cb264f7a401a1" },
28-
"nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" },
29-
"nvim-treesitter": { "branch": "master", "commit": "61a385d74f822dcd1d223f42f1267d1317aaa2d0" },
30-
"nvim-web-devicons": { "branch": "master", "commit": "1c9136332840edee0c593f2f4f89598c8ed97f5f" },
26+
"nvim-lspconfig": { "branch": "master", "commit": "66bc018936c6ff76beb75f89d986af6442db4001" },
27+
"nvim-treesitter": { "branch": "master", "commit": "9e0b5e7f0d148963d6ec71c48cec1a3f8607d619" },
28+
"nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" },
3129
"onedark.nvim": { "branch": "master", "commit": "67a74c275d1116d575ab25485d1bfa6b2a9c38a6" },
3230
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
33-
"snacks.nvim": { "branch": "main", "commit": "b96bd540f785c725289f9f15f0147b1b2dac5a35" },
31+
"snacks.nvim": { "branch": "main", "commit": "09349ecd44040666db9d4835994a378a9ff53e8c" },
3432
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
35-
"trouble.nvim": { "branch": "main", "commit": "50481f414bd3c1a40122c1d759d7e424d5fafe84" },
33+
"trouble.nvim": { "branch": "main", "commit": "6f380b8826fb819c752c8fd7daaee9ef96d4c689" },
3634
"undotree": { "branch": "master", "commit": "2556c6800b210b2096b55b66e74b4cc1d9ebbe4f" },
37-
"vim-fugitive": { "branch": "master", "commit": "d74a7cff4cfcf84f83cc7eccfa365488f3bbabc2" },
35+
"vim-fugitive": { "branch": "master", "commit": "b068eaf1e6cbe35d1ac100d435cd7f7b74a5c87d" },
3836
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
3937
"vim-tmux-navigator": { "branch": "master", "commit": "d847ea942a5bb4d4fab6efebc9f30d787fd96e65" },
4038
"vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" },
41-
"which-key.nvim": { "branch": "main", "commit": "6cebd86917df559a88de0f806b2989799c6e6423" }
39+
"which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" }
4240
}

.config/nvim/lua/config/keymaps.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ vim.keymap.set('v', '<', '<gv')
129129
vim.keymap.set('v', '>', '>gv')
130130

131131
-- Sentence case word
132-
vim.keymap.set('n', '<Leader>gs', 'guiwv~', { desc = '[S]entence case word' })
132+
vim.keymap.set('n', '<Leader>gS', 'guiwv~', { desc = '[S]entence case word' })
133133

134134
-- Visual block mode (Default Ctrl-V)
135135
-- Ctrl-V is bound to paste in Windows Terminal, use Ctrl-Q instead
@@ -148,7 +148,7 @@ vim.keymap.set('n', '<Leader>xl', '<cmd>exec "lua ".getline(".")<CR>', { desc =
148148
vim.keymap.set('n', '<Leader>xp', '<cmd>exec "lua P(".getline(".").")"<CR>', { desc = 'E[X]ecute current line in Lua print()' })
149149

150150
-- Add -- stylua: ignore above current line
151-
vim.keymap.set('n', '<Leader>si', 'yyP^d$a-- stylua: ignore<Esc>', { desc = 'Add [S]tylua [I]gnore above current line' })
151+
vim.keymap.set('n', '<Leader>li', 'yyP^d$a-- stylua: ignore<Esc>', { desc = 'Add [L]ua [I]gnore above current line' })
152152

153153
-- Change all
154154
vim.keymap.set('n', 'cA', 'ggdGi', { desc = '[C]hange [A]ll lines' })

.config/nvim/lua/plugins/flash.lua

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,50 @@ return {
1616
[motion:lower()] = 'next',
1717
[motion:upper()] = 'prev',
1818
-- jump2d style: same case goes next, opposite case goes prev
19-
-- [motion] = "next",
20-
-- [motion:match("%l") and motion:upper() or motion:lower()] = "prev",
19+
-- [motion] = 'next',
20+
-- [motion:match('%l') and motion:upper() or motion:lower()] = 'prev',
2121
}
2222
end,
2323
},
2424
},
2525
},
26+
specs = {
27+
{
28+
'folke/snacks.nvim',
29+
opts = {
30+
picker = {
31+
win = {
32+
input = {
33+
keys = {
34+
['<C-f>'] = { 'flash', mode = { 'n', 'i' } },
35+
-- ['s'] = { 'flash' },
36+
},
37+
},
38+
},
39+
actions = {
40+
flash = function(picker)
41+
require('flash').jump({
42+
pattern = '^',
43+
label = { after = { 0, 0 } },
44+
search = {
45+
mode = 'search',
46+
exclude = {
47+
function(win)
48+
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= 'snacks_picker_list'
49+
end,
50+
},
51+
},
52+
action = function(match)
53+
local idx = picker.list:row2idx(match.pos[1])
54+
picker.list:_move(idx, true, true)
55+
end,
56+
})
57+
end,
58+
},
59+
},
60+
},
61+
},
62+
},
2663
-- stylua: ignore
2764
keys = {
2865
{ '<C-f>', mode = { 'n', 'x', 'o' }, function() require('flash').jump() end, desc = 'Flash' },

.config/nvim/lua/plugins/grug-far.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ return { -- Find And Replace plugin for neovim
22
'MagicDuck/grug-far.nvim',
33
keys = {
44
{
5-
'<Leader>fr',
5+
'<Leader>fR',
66
mode = { 'n' },
77
function()
88
require('grug-far').open({ prefills = { paths = vim.fn.expand('%') } })
99
end,
1010
desc = '[F]ind and [R]eplace in current file',
1111
},
1212
{
13-
'<Leader>gfw',
13+
'<Leader>fW',
1414
mode = { 'n' },
1515
function()
1616
require('grug-far').open({ prefills = { search = vim.fn.expand('<cword>') } })
1717
end,
1818
desc = '[G]rug-[F]ar search current [W]ord under the cursor',
1919
},
2020
{
21-
'<Leader>gfv',
21+
'<Leader>fV',
2222
mode = { 'v' },
2323
[[:<C-u>lua require('grug-far').with_visual_selection({ prefills = { paths = vim.fn.expand("%") } })<CR>]],
2424
desc = '[G]rug-[F]ar search current visual selection in current file',

.config/nvim/lua/plugins/lsp.lua

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,34 +61,6 @@ return { -- LSP Configuration & Plugins
6161
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
6262
end
6363

64-
local fzf_lua = require('fzf-lua')
65-
-- Jump to the definition of the word under your cursor.
66-
-- This is where a variable was first declared, or where a function is defined, etc.
67-
-- To jump back, press <C-T>.
68-
-- https://github.com/ibhagwan/fzf-lua/wiki#lsp-single-result
69-
map('gd', function() fzf_lua.lsp_definitions({ jump_to_single_result=true, ignore_current_line=true }) end, '[G]oto [D]efinition')
70-
71-
-- Find references for the word under your cursor.
72-
-- `gr` is used by mini-operators
73-
map('gR', fzf_lua.lsp_references, '[G]oto [R]eferences')
74-
75-
-- Jump to the implementation of the word under your cursor.
76-
-- Useful when your language has ways of declaring types without an actual implementation.
77-
map('gI', fzf_lua.lsp_implementations, '[G]oto [I]mplementation')
78-
79-
-- Jump to the type of the word under your cursor.
80-
-- Useful when you're not sure what type a variable is and you want to see
81-
-- the definition of its *type*, not where it was *defined*.
82-
map('<Leader>D', fzf_lua.lsp_typedefs, 'Type [D]efinition')
83-
84-
-- Fuzzy find all the symbols in your current document.
85-
-- Symbols are things like variables, functions, types, etc.
86-
map('<Leader>ds', fzf_lua.lsp_document_symbols, '[D]ocument [S]ymbols')
87-
88-
-- Fuzzy find all the symbols in your current workspace
89-
-- Similar to document symbols, except searches over your whole project.
90-
map('<Leader>ws', fzf_lua.lsp_workspace_symbols, '[W]orkspace [S]ymbols')
91-
9264
-- Rename the variable under your cursor
9365
-- Most Language Servers support renaming across files, etc.
9466
map('<Leader>rv', vim.lsp.buf.rename, '[R]ename [V]ariable')
@@ -101,10 +73,6 @@ return { -- LSP Configuration & Plugins
10173
-- See `:help K` for why this keymap
10274
map('K', vim.lsp.buf.hover, 'Hover Documentation')
10375

104-
-- WARN: This is not Goto Definition, this is Goto Declaration.
105-
-- For example, in C this would take you to the header
106-
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
107-
10876
-- The following two autocommands are used to highlight references of the
10977
-- word under your cursor when your cursor rests there for a little while.
11078
-- See `:help CursorHold` for information about when this is executed

0 commit comments

Comments
 (0)