Skip to content

Commit 61bdcba

Browse files
committed
Get working
1 parent efbcede commit 61bdcba

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lua/obsidian/command.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,11 @@ command.search = function(client, data)
165165
else
166166
telescope.live_grep { cwd = tostring(client.dir), vimgrep_arguments = vimgrep_arguments }
167167
end
168-
elseif vim.fn.exists "*fzf#vim#grep" and vim.fn.exists "*fzf#vim#with_preview" then
169-
-- Search with fzf.vim
168+
return
169+
end
170+
171+
-- Fall back to trying with fzf.vim
172+
local has_fzf, _ = pcall(function()
170173
local grep_cmd =
171174
vim.tbl_flatten { base_cmd, { "--color=always", "--", vim.fn.shellescape(data.args), tostring(client.dir) } }
172175

@@ -176,8 +179,10 @@ command.search = function(client, data)
176179
vim.api.nvim_call_function("fzf#vim#with_preview", {}),
177180
false,
178181
})
179-
else
180-
echo.err "Either fzf.vim or telescope.nvim is required for :ObsidianSearch command"
182+
end)
183+
184+
if not has_fzf then
185+
echo.err "Either telescope.nvim or fzf.vim is required for :ObsidianSearch command"
181186
end
182187
end
183188

0 commit comments

Comments
 (0)