Closed ryansch closed 2 years ago
Hi!
I think option 1 is the best and most straightforward option. I can work on it this weekend, unless you were wanting to add the feature.
@natecraddock Great! I'll defer to you for this weekend, otherwise I can take it on soonish.
I created a branch https://github.com/natecraddock/workspaces.nvim/tree/last-opened where you can test this.
I chose to use ISO 8601 for the timestamps. Access the last opened date with the last_opened
field of the workspace table. If a workspace has not been opened since this update, the last_opened
field will be nil
. Let me know if this works, but no rush!
If everything works out, I will document and merge the feature soon.
how can i use this pls?
@sibouras currently this is in a feature branch last-opened
. As @ryansch seems busy (that's totally okay! no rush), I think I will just merge this in with a new config option. I'll let you know when I do that, and how it works.
thanks 🤗
I ran into issues when integrating with telescope.nvim as it's a bit of a beast. This feature seems to work as discussed!
@sibouras I pushed a new config option mru_sort
. It requires that the sort
option is also true, and when mru_sort
is true, then the list of workspaces will be presented sorted.
when i :Telescope workspaces
i get this error
Error executing Lua callback: ...ack\packer\start\workspaces.nvim/lua/workspaces/init.lua:56: invalid order function for sorting
stack traceback:
[C]: in function 'sort'
...ack\packer\start\workspaces.nvim/lua/workspaces/init.lua:56: in function 'get'
...workspaces.nvim/lua/telescope/_extensions/workspaces.lua:15: in function 'workspaces_picker'
...workspaces.nvim/lua/telescope/_extensions/workspaces.lua:87: in function <...workspaces.nvim/lua/telescope/_extensions/workspaces.lua:86>
...ck\packer\start\telescope.nvim/lua/telescope/command.lua:193: in function 'run_command'
...ck\packer\start\telescope.nvim/lua/telescope/command.lua:253: in function 'load_command'
...te\pack\packer\start\telescope.nvim\plugin\telescope.lua:109: in function <...te\pack\packer\start\telescope.nvim\plugin\telescope.lua:108>
also i get errors for :WorkspacesAdd
and other workspace commands even with empty setup function
E5108: Error executing lua ...ack\packer\start\workspaces.nvim/lua/workspaces/init.lua:56: invalid order function for sorting
stack traceback:
[C]: in function 'sort'
...ack\packer\start\workspaces.nvim/lua/workspaces/init.lua:56: in function 'load_workspaces'
...ack\packer\start\workspaces.nvim/lua/workspaces/init.lua:241: in function 'list'
[string ":lua"]:1: in main chunk
@sibouras I was unable to replicate (I know the cause though), and I believe I have fixed the error. Let me know if it works now!
yess it works! thank you so much!!
I'm working on a plugin that wraps your workspaces.nvim and sessions.nvim: https://github.com/ryansch/habitats.nvim
I'd like to add the ability to sort the list by most recently used and I think I have three options:
Would you be interested in either of options 1 or 2?