Closed dmartzol closed 1 month ago
Hi @dmartzol, as the README suggested, you should first call:
require("lspmark").setup()
require("telescope").load_extension("lspmark")
to initialize this plugin. Below is the config I'm currently using FYI:
{
"tristone13th/lspmark.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
lazy = false,
config = function()
require("lspmark").setup()
require("telescope").load_extension("lspmark")
vim.keymap.set("n", "m", function()
require("lspmark.bookmarks").paste_text()
end, { silent = true })
vim.keymap.set("n", "M", function()
require("lspmark.bookmarks").toggle_bookmark()
end, { silent = true })
vim.api.nvim_set_keymap(
"v",
"d",
":lua require('lspmark.bookmarks').delete_visual_selection()<CR>",
{ silent = true, noremap = true }
)
vim.api.nvim_set_keymap(
"n",
"dd",
":lua require('lspmark.bookmarks').delete_line()<CR>",
{ silent = true, noremap = true }
)
vim.keymap.set("n", "gm", function()
vim.api.nvim_command([[ Telescope lspmark ]])
end, { silent = true })
end,
},
Ahh, thank you @tristone13th. I swaer I read the readme but I misunderstood where to put the first code block. 😅
Now I'm trying with this
{
"tristone13th/lspmark.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
lazy = false,
config = function()
require("lspmark").setup()
require("telescope").load_extension("lspmark")
vim.keymap.set("n", "M", function()
require("lspmark.bookmarks").toggle_bookmark()
end, { silent = true })
end,
},
But still not able to persist bookmarks. I'll check if some other plugin is interfering with this and I will report back.
Kindly remind that don't forget the following code to load the bookmarks:
vim.api.nvim_create_autocmd({ "DirChanged" }, {
callback = require("lspmark.bookmarks").load_bookmarks,
pattern = { "*" },
})
For me, I'm using a session management plugin so I load the bookmarks manually there, thus my config doesn't include the load_bookmarks
.
I just tried with
{
"tristone13th/lspmark.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
lazy = false,
config = function()
require("lspmark").setup()
require("telescope").load_extension("lspmark")
vim.api.nvim_create_autocmd({ "DirChanged" }, {
callback = require("lspmark.bookmarks").load_bookmarks,
pattern = { "*" },
})
end,
},
But that didn't work.
Then I tried this:
{
"tristone13th/lspmark.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
lazy = false,
config = function()
require("lspmark").setup()
require("telescope").load_extension("lspmark")
require("lspmark.bookmarks").load_bookmarks()
end,
},
And that worked and loaded the bookmarks on startup. Seems that the DirChanged trigger is not happening when I open nvim. Is this an acceptable alternative?
Yes, though I'm not configuring this way but I think it should work well.
Thank you for your help, @tristone13th. Closing this Issue then
I think adding example configurations to the readme would be helpful. I can't make the persistent functionality work for some reason. I'm using folke/lazy.nvim as plugin manager and I'm trying this plugin with:
Any help would be appreciated! 🙏