MLFlexer / smart_workspace_switcher.wezterm

A smart wezterm workspace switcher plugin inspired by joshmedeski/t-smart-tmux-session-manager
MIT License
70 stars 5 forks source link

fuzzy find tabs and paths #24

Closed chuan2984 closed 6 months ago

chuan2984 commented 7 months ago

Hello there, I went looking for this once I saw SESH. I'm glad it exists. I have configured it, and only see workspaces. I have a few questions hoping you can answer:

  1. Is there a way to configure to show paths like you have in the demo?
  2. Is there an intention to add support for tabs in a workspace? or should I start changing my tabs into workspaces?
  3. Do you think you could add an option to disable default bindings or just leave default binding out? I may be bad at this, but taking a binding out is not the easiest, and will break if default binding changes
MLFlexer commented 7 months ago

Hi! 😄

  1. The paths I have in the demo comes from the zoxide query -l command which shows you the paths which zoxide has "saved". So it should show the same paths as the ones you have when you run the command in your terminal.

  2. Tabs are handled by Wezterm and should persist for a workspace "session" the default keybinds to open a tab in Wezterm is CTRL+SHIFT + t

  3. If you want to change the default keybindings, then you should replace the line:

    workspace_switcher.apply_to_config(config)

    With the following lines as per the readme

    config.keys = {
    -- ...
    -- your other keybindings
    {
    key = "s", -- whatever key you want
    mods = "ALT", -- whatever modifier you like
    action = workspace_switcher.switch_workspace(),
    }
    }

Hope this helps, otherwise feel free to make follow up questions

chuan2984 commented 7 months ago
  1. Gotcha, i misconfigured my zxoide path, hence I couldn't see the extra paths.
  2. sorry, I should have elaborated a little more. When I do .switch_workspace(), I only see he paths and the workspaces but not the tabs inside the workspaces. I would like to be able to jump to a tab directly inside a workspace. For example, I have a dotfile workspace, and have a tab named nvim, another named wezterm. I now only can pick dotfile(workspace) but not which tab it would open with. It'd be nice to be able to jump to an existing tab directly
  3. if I do workspace_switcher.apply_to_config(config). it would insert the default alt-s keybinding in there, right? Even if i modified it like you point it by reassigning it to a different key, i would have that keybinding and alt-s, both for switch_worskapce(), right? Again, thanks for taking the time to answer these questions!
MLFlexer commented 7 months ago

2: I'm a bit confused as to what you are looking for here 😃

3: If you dont want the default keybindings, then you can just remove the workspace_switcher.apply_to_config(config) line from your config, as the only thing it does is add the default keybinding.

chuan2984 commented 7 months ago

If you dont want the default keybindings, then you can just remove the workspace_switcher.apply_to_config(config) line from your config, as the only thing it does is add the default keybinding.

thanks for the quick response. I didn't realize that apply_to_config(config) only does keybinding, but it might still be a good idea to have a way to disable default keybindings in the future in case you add more default configs to .apply_to_config.

or do you want to pick a tab within a workspace using the fuzzy finder? If this is more what you are looking for, then it might be possible to do so, but it would also clutter the fuzzy finding list as you would have n copies of the paths if you have n tabs

Yeah, this is pretty close to what I had in mind. As I'm starting to use it more and more, I feel like it would be great to have something like, if the path exists already in a tab, take me there as opposed to creating a new workspace set to that path. Or have a list of Aworkspace, Bworkspace, Cworkspace, Atab, Btab, Ctab, Dtab, then the zoxide query paths. I haven't thought this out too much, I might play around a bit and see what I can add. I don't know how to extract this so that it can fit other people's workflows. I probably need to checkout Sesh a bit more to see how Josh handles it

MLFlexer commented 6 months ago

Sorry for the very late response, I have been busy with exams... :sweat_smile:

The paths are for workspaces and for panes. I don't think there is a way to define a path for a tab, so what you are suggesting might be a bit hard with the way Wezterm configures the paths. You are however welcome to make a PR or try and work something out!

If you have used Sesh a bit more and have a suggestion for something to add, then I would love to hear it in a separate issue, but I am closing this one as for now if there are not any specific requests :smile: