New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Workspace" in location mode #643

Closed
xiaq opened this Issue Mar 16, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@xiaq
Member

xiaq commented Mar 16, 2018

I actually do not know how common this is, but I often need to work with multiple "workspace" directories that have almost identical layouts. In fact they are just clones of the same repo.

The location mode is less useful when I need to constantly switch between workspaces. Assume that I am a Linux kernel guru who keeps multiple clones of kernel in /usr/src/linux. I have been in /usr/src/linux/repo1/foo/bar/quux and it is easy for me to go there; but I still cannot go to /usr/src/linux/repo2/foo/bar/quux quickly.

There is a quite simple (at least API-wise) solution to the problem. Allow users to define multiple workspace patterns, each associated with a workspace type. The configuration can look like edit:location:workspace-patterns = [&linux-ws='/usr/src/linux/[^/]+' &freebsd-ws='/usr/src/freebsd/[^/]+']

The pattern affect the behavior of the location mode in two ways:

  • When recording directory history: if the directory is in a workspace, then in additional to the full path of the directory, also record a version by substituting the workspace part with the type of the workspace. For instance, if I go to /usr/src/linux/repo1/foo/bar/quux, two entries are written to the directory history: the full absolute path, and linux-ws/foo/bar/quux.

  • When starting location mode: if the current directory is in a workspace, then find out its type, and show entries with the same workspace type. For instance, if I am in /usr/src/linux/repo100/lorem, then all linux-ws/ entries are shown. Entries for other workspaces are not shown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment