Recipe for "on-the-fly" contexts #2755
sdondley
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I like to have a shell dedicated to each shell process. Project A in process A, Probject B in process B, etc.
This is presently not possible since the context is determined by the rc file.
However, there is a simple workaround:
For each shell, simply set $FLEXIBLE_CONTEXT.
But it gets better. If you have a lot of projects, you don't want the hassle of creating a separate context manually for each project. These 3 functions work together to automate things for you:
Just do:
tc <project_name>
This will automatically switch you over to a context filtered by project. If the project doesn't exist, a context will be crated for you with the same name as the project.
The _tc function provides tab completion for project names. This is for zsh completion. I'm not sure if it's the same for bash. Be sure to add
compdef _tc tc
to the .zshrc file to get it working and start a new shell process.The tcc() function clears the context for you.
Beta Was this translation helpful? Give feedback.
All reactions