@@ -302,94 +302,44 @@ end, {
302302 nargs = 0 ,
303303})
304304
305- if vim .fn .executable (" fzy" ) == 1 then
306- command (" Rg" , function (opt )
307- local fzy = require (" kide.fzy" )
308- fzy .execute (" rg --no-heading --trim -nH --smart-case " .. opt .args , fzy .sinks .edit_live_grep , " Grep " , opt .args )
309- end , {
310- desc = " Grep" ,
311- nargs = 1 ,
312- })
313-
314- map (" n" , " <leader>fq" , function ()
315- local fzy = require (" kide.fzy" )
316- local qfl = vim .fn .getqflist ()
317- local tools = require (" kide" )
318-
319- fzy .pick_one (qfl , " Quickfix > " , function (item )
320- local filename = vim .uri_from_bufnr (item .bufnr )
321- return tools .format_uri (filename ) .. " : " .. item .text
322- end , function (qf , _ )
323- if qf then
324- vim .cmd (" b " .. qf .bufnr )
325- vim .api .nvim_win_set_cursor (0 , { qf .lnum , qf .col })
326- end
327- end )
328- end , { desc = " Quickfix" })
329-
330- map (" n" , " <leader>fo" , function ()
331- local fzy = require (" kide.fzy" )
332- fzy .execute (" fd" , function (choice )
333- if choice and vim .trim (choice ) ~= " " then
334- vim .print (choice )
335- require (" kide.tools" ).open_fn (choice )
336- end
337- end , " SystemOpen > " )
338- end , { desc = " System Open" })
339-
340- map (" n" , " <leader>fb" , function ()
341- local fzy = require (" kide.fzy" )
342- local bufs = vim .tbl_filter (function (b )
343- return vim .bo [b ].buflisted
344- end , vim .api .nvim_list_bufs ())
345- local tools = require (" kide" )
346- fzy .pick_one (bufs , " Buffers > " , function (item )
347- local filename = vim .uri_from_bufnr (item )
348- return tools .format_uri (filename )
349- end , function (b , _ )
350- if b then
351- vim .cmd (" b " .. b )
352- end
353- end )
354- end , { desc = " Find buffer" })
355- map (" n" , " <leader>ff" , function ()
356- local fzy = require (" kide.fzy" )
357- fzy .execute (" fd --type file" , fzy .sinks .edit_file , " Files " )
358- end , { desc = " Find files" })
359-
360- map (" v" , " <leader>ff" , function ()
361- vim .api .nvim_feedkeys (" \027 " , " xt" , false )
362- local text = require (" kide.tools" ).get_visual_selection ()
363- local fzy = require (" kide.fzy" )
364- local param = vim .fn .shellescape (text [1 ])
365- fzy .execute (" fd --type file " .. param , fzy .sinks .edit_file , " Files " , text [1 ])
366- end , { desc = " fzy find files" , silent = true , noremap = true })
367-
368- map (" v" , " <leader>fw" , function ()
369- vim .api .nvim_feedkeys (" \027 " , " xt" , false )
370- local text = require (" kide.tools" ).get_visual_selection ()
371- local fzy = require (" kide.fzy" )
372- local param = vim .fn .shellescape (text [1 ])
373- fzy .execute (" rg --no-heading --trim -nH --smart-case " .. param , fzy .sinks .edit_live_grep , " Grep " , text [1 ])
374- end , { desc = " fzy live grep" , silent = true , noremap = true })
375- map (" n" , " <leader>fw" , function ()
376- local ok , text = pcall (vim .fn .input , " rg: " )
377- if ok and text and text ~= " " then
378- local fzy = require (" kide.fzy" )
379- local param = vim .fn .shellescape (text )
380- fzy .execute (" rg --no-heading --trim -nH --smart-case " .. param , fzy .sinks .edit_live_grep , " Grep " , text )
381- end
382- end , { desc = " fzy live grep" , silent = true , noremap = true })
305+ map (" n" , " <leader>fq" , function ()
306+ local builtin = require (" telescope.builtin" )
307+ builtin .quickfix ()
308+ end , { desc = " Quickfix" })
309+
310+ map (" n" , " <leader>fb" , function ()
311+ local builtin = require (" telescope.builtin" )
312+ builtin .buffers ()
313+ end , { desc = " Find buffer" })
314+ map (" n" , " <leader>ff" , function ()
315+ local builtin = require (" telescope.builtin" )
316+ builtin .find_files ()
317+ end , { desc = " Find files" })
318+
319+ map (" n" , " <leader>fd" , function ()
320+ local builtin = require (" telescope.builtin" )
321+ builtin .diagnostics ()
322+ end , { desc = " Find diagnostics" })
323+
324+ map (" v" , " <leader>ff" , function ()
325+ vim .api .nvim_feedkeys (" \027 " , " xt" , false )
326+ local text = require (" kide.tools" ).get_visual_selection ()
327+ local param = text [1 ]
328+ local builtin = require (" telescope.builtin" )
329+ builtin .find_files ({ default_text = param })
330+ end , { desc = " find files" , silent = true , noremap = true })
383331
384- command (" FzyFiles" , function (opt )
385- local fzy = require (" kide.fzy" )
386- local param = vim .fn .shellescape (opt .args )
387- fzy .execute (" fd --type file " .. param , fzy .sinks .edit_file , " " )
388- end , {
389- desc = " find files" ,
390- nargs = " ?" ,
391- })
392- end
332+ map (" v" , " <leader>fw" , function ()
333+ vim .api .nvim_feedkeys (" \027 " , " xt" , false )
334+ local text = require (" kide.tools" ).get_visual_selection ()
335+ local param = text [1 ]
336+ local builtin = require (" telescope.builtin" )
337+ builtin .live_grep ({ default_text = param })
338+ end , { desc = " live grep" , silent = true , noremap = true })
339+ map (" n" , " <leader>fw" , function ()
340+ local builtin = require (" telescope.builtin" )
341+ builtin .live_grep ()
342+ end , { desc = " live grep" , silent = true , noremap = true })
393343
394344if vim .base64 then
395345 command (" Base64Encode" , function (opt )
0 commit comments