-
Notifications
You must be signed in to change notification settings - Fork 11
No preview or title with FZF #31
Comments
Looking at the source code, I see that the |
I'm seeing the same thing. Any chance you've figured this out? I did modify the standard config for zk b/c it wasn't getting the path. require("zk").setup({
debug = true,
log = true,
default_keymaps = true,
-- default_notebook_path = vim.env.ZK_NOTEBOOK_DIR or "",
default_notebook_path = vim.loop.cwd(),
fuzzy_finder = "fzf", -- or "telescope"
link_format = "wiki" -- "markdown" or "wiki"
}) But I still don't get previews from |
I've stripped everything down to the base that I can. I'm running with the following config. call plug#begin()
" zk
Plug 'vijaymarupudi/nvim-fzf'
Plug 'neovim/nvim-lspconfig'
Plug 'megalithic/zk.nvim'
" fzf
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
call plug#end()
" Done with plugins
" zk
command! -nargs=0 ZkIndex :lua require'lspconfig'.zk.index()
command! -nargs=? ZkNew :lua require'lspconfig'.zk.new(<args>)
lua << EOF
require("zk").setup({
debug = true,
log = true,
default_keymaps = true,
-- default_notebook_path = vim.env.ZK_NOTEBOOK_DIR or "",
default_notebook_path = vim.loop.cwd(),
fuzzy_finder = "fzf", -- or "telescope"
link_format = "wiki" -- "markdown" or "wiki"
})
local lspconfig = require'lspconfig'
local configs = require'lspconfig/configs'
configs.zk = {
default_config = {
cmd = {'zk', 'lsp'};
filetypes = {'markdown'};
root_dir = lspconfig.util.root_pattern('.zk');
settings = {};
};
}
configs.zk.index = function()
vim.lsp.buf.execute_command({
command = "zk.index",
arguments = {vim.api.nvim_buf_get_name(0)},
})
end
configs.zk.new = function(...)
vim.lsp.buf_request(0, 'workspace/executeCommand',
{
command = "zk.new",
arguments = {
vim.api.nvim_buf_get_name(0),
...
},
},
function(_, _, result)
if not (result and result.path) then return end
vim.cmd("edit " .. result.path)
end
)
end
lspconfig.zk.setup({
on_attach = function(client, bufnr)
-- Key mappings
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local opts = { noremap=true, silent=true }
buf_set_keymap("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap("n", "<leader>zi", ":ZkIndex<CR>", opts)
buf_set_keymap("v", "<leader>zn", ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
buf_set_keymap("n", "<leader>zn", ":ZkNew {title = vim.fn.input('Title: ')}<CR>", opts)
buf_set_keymap("n", "<leader>zl", ":ZkNew {dir = 'log'}<CR>", opts)
end
})
EOF Vim:
Other:
That's all I can think to provide, if anyone see's anything I've got wrong. |
@pinpox I've got a PR #38 up which makes this work for me. However, in the process I saw how it was being displayed and tested something out. $ time zk list -m Theil --format=path > /dev/null
Found 14 notes
real 0m0.051s
user 0m0.046s
sys 0m0.015s
$ time ag Theil > /dev/null
real 0m0.013s
user 0m0.009s
sys 0m0.012s
$ time rg Theil > /dev/null
real 0m0.012s
user 0m0.019s
sys 0m0.003s zk does a full text search, throws away the results and returns just the file, which zk.vim then configures fzf to display with bat. So you need bat installed. If you instead install Silver Searcher (Ag) or Ripgrep (Rg) FZF.vim already includes full text search with those programs. They're blazing fast and Rg by default highlights the search term. Now that I've fixed it, I'm not actually sure what the use case is for ZkSearch. |
@chris-sanders So basically replace zk.nvim with custom ripgrep bindings? I already have ripgrep installed |
Until/unless ZkSearch gains additional features, yes just use ripgrep and fzf already has an |
Personally I don't even use |
@mickael-menu thanks for the clarification. Is your full configuration available somewhere? I'm having some issues and just want to start from a clean ZK LSP that is known working. |
Would be interested in this as well if you are willing to share some insights |
Sure, I don't have anything really special but here you go:
|
I've got
fzf
setup and it seems to work. The selection based on filenames without preview is not very useful though when using non-title filenames. It would also be great if the preview window to the right would show up, fzf does that normally on my setupa) Is it possible to show matching titles instead of the filename?
b) Is it possible to show the preview window?
Example using
:Zksearch something
:For comparison, this is what
fzf
usually looks like, e.g. when searching/showing vim buffers, there is a preview window to the right:The text was updated successfully, but these errors were encountered: