crusj / bookmarks.nvim Goto Github PK
View Code? Open in Web Editor NEWRemember file locations and sort by time and frequency and support telescope.
License: MIT License
Remember file locations and sort by time and frequency and support telescope.
License: MIT License
Recently wanted to use bookmarks in one of projects with lots of file. Have tried several plugins for bookmarks, that one is good and I am going to use that when need bookmarks next time, so thank you for the work on that plugin.
I also have met some issues with it, see below.
When cursor on tags area, once I press ctrl + j, cursor will be on editor area, fortunately it is possible to close popup with double tab pressed. See screenshots below:
Ctrl + j - cursor on editor area
Note: same happens for ctrl + l, from bookmarks area
I prefer not to use icons plugin as icons for me generally a little bit distractive. But to use that bookmarks plugin I have to install webdev icons. Could it be make optional like in the telescope? Telescope could be used either with or without icons.
When Nerd Tree opened and jump to bookmark it opens in split, and in that split some editor settings are changed, for example, the current line is highlighted (which is turned off in my setup), I would expect it would be opened in same window with my setup. See screenshots below:
<Tab><Tab>
- opens bookmarks popup
Hit <Enter>
- bookmark opened in split, and active line is highlighted:
It would be nice to also have a close command for the bookmarks window in addition to the toggle one.
It would be great to have the possibility to highlight the bookmark preview window and define border styles. For me it would provide consistent border style with the rest of the config.
E.g. in terms of highlights, the bookmarks window could use the "FloatBorder"
and "FloatTitle"
highlights.
Styles could be common predefined styles("single"
, "rounded"
, "dobule"
) or/and a custom set of characters.
Let me know if a PR would be of any help 👍
Environment:
neovim 0.9
Neovide GUI
Windows 11
After add bookmark, a file named "C" generated in the nvim-data/bookmarks folder, 0 byte size.
close nvim and open t again, the error pops.
the path of the file added to bookmark is some kind of "C:\path\file".
Guess the error refers to the path format on Windows OS.
Currently, no filetype is set for a previewed filed. Setting the ft would enable syntax highlighting.
I didn't made any implementation test yet, so my theoretical assumptionion on how this could be solved: It might be possible to directly retrieve the filetype when opening the preview. If not, it might be worth the tradeoff to additionally save ft = vim.bo.ft
on bookmark creation.
Screenshot, manually setting the ft in a previewed file after opening the window.
Might be related to #13 (edit: didn't read through the issue properly. No relation afaik.)
Thanks for your excellent work which eases my work a lot.
After using it for a while, I have a small suggestion. It would be cool if the plugin supports grouping bookmarks into different workspaces. Currently, all bookmarks, even those belonging to different projects, will be presented together.
One possible solution may be to add a new switchable tab showing the name of the current workspace in the leftmost column.
Plugin is great any plans to integrate it with telescope for easy search.
Most of the time, through the preview of the telescope, users can already know the content marked by the bookmark, so wondering if an option can be added to skip the description.
When bookmarking a markdown file I get a treesitter error every time I open my bookmark view, the error in question is 'no parser for "md" language', I tried recreating this with other plugins that use a preview window ( like telescope ) but it only appears in this plugin ( see attachment for full error message )
error message:
error.log
is seem that data.bufp
will be nil when reopen neovim.
so I add a judgement,the error gone.
but it still has some problen, it will auto add a null split window and a empty buffer in neovim when reopen neovim:
how to fixed it?
wow, excellent plugins, I love it so much
Feature propose.
Thanks for developing such a good plugin, I wanna use bookmarks because I need to read a large project, understand how data transfer from one method to another, maybe many files in different folders. Saving bookmarks to different pwd makes hard to search.
For me, I use coc.vim to auto complete so, it has vim.g.WorkspaceFolders
to help me locate the root path of my project. Also, nvim.fn.find_root_directory(start_directory, marker_file)
can help us find the root path without lsp, they are similar by the way.
local root_directory = nvim.fn.find_root_directory(cwd, ".git")
Maybe this is better for searching?
Hi and big thanks for this plugin!
Im missing icons and I suspect its caused by missing fonts.
What fonts is bookmarks.nvim expect me to have installed?
virt_pattern is limited to five items. In the file bookmarks.nvim/lua/bookmarks/config.lua, tables are being copied item by item. This makes sense for keymap and hl. They have defined membership.
virt_pattern is open ended.
Changing line bookmarks.nvim/lua/bookmarks/config.lua#35 to:
if type(dv) ~= "table" or dk == 'virt_pattern' then
copies all items.
Related to #18.
In window.lua, it's assumed that the file extension is a valid treesitter filetype (for syntax highlighting) - which doesn't hold.
Consequently, if preview_ext_enable = true
and the file with bookmarks doesn't have an extension, the following error occurs upon spawning the bookmarks window, as well as scrolling to different items (J
or K
), deleting bookmarks (dd
), (non-exhaustive list) once every time.
Error detected while processing CursorMoved Autocommands for "<buffer=10>":
Error executing lua callback: ...local/share/nvim/lazy/bookmarks/lua/bookmarks/window.lua:180: E474: Invalid argument
stack traceback:
[C]: in function 'nvim_buf_set_option'
...local/share/nvim/lazy/bookmarks/lua/bookmarks/window.lua:180: in function 'preview_bookmark'
...local/share/nvim/lazy/bookmarks/lua/bookmarks/window.lua:32: in function <...local/share/nvim/lazy/bookmarks/lua/bookmarks/window.lua:17>
Also, if the extension doesn't match the treesitter filetype (e.g. with py
and python
), the preview window won't be highlighted (though I think you've already accounted for this).
I'm not sure what the best way to go about this would be; quoting @tobealive from #18,
[...] it might be worth the tradeoff to additionally save
ft = vim.bo.ft
on bookmark creation
is an interesting idea. Or, the way neo-tree have done previews might be interesting - I don't notice a performance loss there personally.
I wish I could offer more information or help, but I'm fairly new to lua 😅
Bookmark are realized by storing the file name and line number where the bookmark is added.
If the buf changes, the line number where the bookmark content is located may not match the real situation, the bookmark still points to the old one. Some time ago, I recorded the hash value of the line text where the bookmark is located. When the buf is saved, it will traverse all the bookmarks of the current buf, relative to the change of the total number of lines in the buf, look up or down for the line content equal to the bookmark hash value, and update the bookmark position, which works somewhat, but often fails. The fix_enable option is set to false by defalut.
I'm thinking of a better way to do it. 🤔
Ideas welcome. 🥳
Why not anchor bookmarks to a tree-sitter query?
Maybe as an optional requirement since I guess not everyone would want a bookmark plugin depending on tree-sitter
As mentioned in the title, I want to set the location where the bookmark information is stored, instead of the default .local/share/nvim/bookmarks
From my use of other plugins, I find it more intuitive to indicate which file types I don't want the virtual mark to be enabled in, rather than having to list all the extensions I want the virtual mark to appear in.
Is there a way to always display bookmark's description as virtual text?
It would be great to set a text (annotation) for a bookmark and display it as virtual text.
If you toggle the bookmarks view, and then issue :close<cr>
. The cursor will return to the buffer under the floating window, but the floating window will remain. If you toggle the bookmarks view again, a new one is overlaid on top of the previous floating window, and toggling it closed will close itself, and only the right side of the original floating window.
I think this is counter-intuitive. Most libraries that use floating windows allow the window to be closed by normal means. The fact that the only way to close the floating window once you accidentally deviate from the toggle-to-close and use :close
, is to restart neovim, should make this a high priority simple fix.
Thank you for the wonderful library by the way. I appreciate all your work!
之前提过一个issue发现项目的工作路径(cwd)一直变化,原来是mhinz/vim-startify.git"
这款插件的问题,会把打开的文件所在的路径自动变为当前的工作路径,但是neo-tree等其实都是按照项目根目录来渲染的(向上寻找.git目录等)。
所以是不是可以加个选项,允许优先基于lsp返回的项目根路径创建书签集合会更好?
main...onns:bookmarks.nvim:main
然后lazy.nvim的默认定位跳转是ctrl i/ ctril o,查了一下tab在历史上输入和shift i是等效的,所以就会导致一个问题,如果用<tab><tab>
做快捷键,会顶掉代码跳转的快捷键,在tmux场景下会失效。
and 给你发邮件木有回,感谢提供此插件!
Apologies if this is available and I didn't RTFM correctly but would love if there was an option for global bookmarks that could be postpended to the local ones. I often need to jump to specific locations without wanting to switch workspaces (e.g. add a hotkey while working on another file). Global bookmarks (ideally enabled via separate hotkey) would be brilliant.
Thanks a ton for the amazing plugin!
You can use nvim_buf_get_extmarks to get those changed line numbers and get the new line location, no need for hash I think.
How can I:
Great plugin! Like how it works and how it is made 🙂
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.