Closed Jimbly closed 10 years ago
The quick toggle seems simple enough, will do :)
As for the "next bookmark" - how does it work? In what order do you consider the "next" bookmark? Is it the nearest line? or some other metric?
Unsaved buffer is not really tricky, but requires a slight hack.
Also, your code seems neater than mine - you seem to be writing python idiomatically unlike my code - which is more C style tbh. I'd love it if you helped restructure my code a little bit.
Do you mind if I got around to it tomorrow? I have a test setup for tomorrow. I can code this after xD
Thanks! ~bollu
EDIT - hey, just implemented toggle - but I did not test it all that well. Could you test it out for me? Please? :)
If not, I'll do some rigorous testing tomorrow.
Thanks! ~bollu
Also , how do you handle scratch buffers seeing as thy have no file path? Do you not save the scartch buffer bookmarks? Also, how do you handle multiple scratch buffers ?
Sorry for the typos,typing on my mobile.
You can identify views/buffers by their ID. Since bookmarks are actually buffer-related, I recommend using view.buffer_id()
, because this will also work easily when you cloned a view. It won't work when you close the scratch buffers obviously, since they will not get that id again. And you need to adjust when restarting ST because they view will have another id then but they bookmark regions itself are preserved. You can use the view's settings to let ST save view/buffer-related data for unsaved files across sessions.
Ah, cool. thanks for the info!
Thanks for the compliment on my code, the only Python I've ever touched is these couple plugins for Sublime, and I feel like I'm stumbling in the dark when writing it, though my background is mostly plain C so I tend to aim for simple and readable ;).
For "next bookmark", the exact order isn't particularly important, as long as hitting next over and over again always gets through everything =). My order is just by file and then, I think, by order added in the file, unless object properties are implicitly sorted when enumerated in Python or something. I think mine has a slight annoyance (which, admittedly, is present in Visual Studio too), where if you go to the 3rd bookmark, remove it, then goto next bookmark, it effectively skips what was previously the 4th one.
As for marks in scratch buffers, apparently my plugin lets me set marks in the buffers, but goto next skips them/ignores them (since they're not saved and not in my list of global bookmarks), so that's kind of useless! Apparently I must not have actually used that feature, so it's probably fine to ignore that, though with FichtFoll's advice, maybe it's easy =).
I'll try out your changes this afternoon and take a look at your code.
Just a quick heads up - the code is little more than spaghetti at this point. The addition of group handling REALLY messed it up. I have to redactor it hard...
shall I close this? I merged the pull requests. It works flawlessly. Thanks a lot!
Yep, by engaging me in conversation you have managed to trick me into implementing the features I requested ;). Closed!
Hi! I have an old (and, until recently, unpublished) bookmark plugin (https://github.com/Jimbly/SublimeGlobalBookmark) which provides a similar set of features, and when trying to add it to the package control (wbond/package_control_channel/pull/2641), was pointed at your plugin which has some of the same features (primarily, global bookmarks across all files and persisted between sessions).
There are a couple minor features which are provided by the default sublime bookmarks (and my plugin, which was designed to behave like Visual Studio's bookmarks which I was used to), which, if added, would completely remove any need for my plugin =).
Specifically commands (to be bound to keys) to:
One other thing that would be handy (which I currently use from time to time, but not very often) would be to be able to set bookmarks in un-saved buffers (e.g. newly created files, or find results). Obviously these wouldn't persist between sessions.
I tend to use bookmarks a lot while doing refactoring or auditing some code behavior - I'll start by doing a search, looking through the results and bookmarking any I need to come back to, and maybe on each of those searching for who calls those lines of code and leaving bookmarks there, removing the bookmarks as I finish dealing with a section of code. I don't need naming (though having the line of code the bookmark is on in the menu is great!), just want to quickly be able to set and remove marks =).
Anyway, if these two features seem reasonable, and if they'd be easy for you to do, that'd be awesome, I'll cancel my (stalled) pull request and we can have one less library! If not something your interested in, I might be able to look at adding it in and sending a pull request, though not sure I'll get around to it any time soon.