Skip to content

Commit cf6bb72

Browse files
committed
fzy
1 parent ef5746c commit cf6bb72

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

ftplugin/json.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
vim.bo.formatprg = "jq ."
1+
vim.bo.shiftwidth = 2
2+
vim.bo.tabstop = 2
3+
vim.bo.softtabstop = 2

lua/kide/init.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ function M.file_or_lsp_status()
3131
end
3232
function M.format_uri(uri)
3333
if vim.startswith(uri, "jdt://") then
34-
local package = uri:match("contents/[%a%d._-]+/([%a%d._-]+)") or ""
35-
local class = uri:match("contents/[%a%d._-]+/[%a%d._-]+/([%a%d$]+).class") or ""
36-
return string.format("%s::%s", package, class)
34+
local jar, pkg, class = uri:match("^jdt://contents/([^/]+)/([^/]+)/(.+)?")
35+
return string.format("%s::%s (%s)", pkg, class, jar)
3736
else
3837
local fname = vim.fn.fnamemodify(vim.uri_to_fname(uri), ":.")
3938
fname = fname:gsub("src/main/java/", "s/m/j/")

lua/mappings.lua

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,22 @@ if vim.fn.executable("find") == 1 then
219219
end
220220

221221
if vim.fn.executable("fzy") == 1 then
222+
command("Rg", function(opt)
223+
local fzy = require("kide.fzy")
224+
fzy.execute("rg --no-heading --trim -nH --smart-case " .. opt.args, fzy.sinks.edit_live_grep, "Grep  ")
225+
end, {
226+
desc = "Grep",
227+
nargs = 1,
228+
})
222229
map("n", "<leader>fb", function()
223230
local fzy = require("kide.fzy")
224231
local bufs = vim.api.nvim_list_bufs()
225232
local cats = {}
226233
for _, v in ipairs(bufs) do
227-
local buf_name = vim.api.nvim_buf_get_name(v)
228-
table.insert(cats, tostring(v) .. ": " .. buf_name)
234+
if vim.bo[v].buflisted then
235+
local buf_name = vim.api.nvim_buf_get_name(v)
236+
table.insert(cats, tostring(v) .. ": " .. buf_name)
237+
end
229238
end
230239
local param = vim.fn.shellescape(table.concat(cats, "\n"))
231240
fzy.execute("echo -e " .. param, function(choice)

0 commit comments

Comments
 (0)