4 ms·
Not as fancy as other tips here, but I bet this is really time saving in the long run for most developers. My core work is alway around ~10 directories, which
by niyazpk 8y ago
Not as fancy as other tips here, but I bet this is really time saving in the long run for most developers.
My core work is alway around ~10 directories, which are mostly code packages. As soon as I start working on a project/team, I create aliases for directories. They take the form:
alias agg="cd /ws/ProjectName/src/PackageName/ &&
echo -n -e '\033]0;PackageName\007' &&
tab-color-devil-blue"
The first part of course navigates to the directory. The second part sets the tabName of my iTerm to the package name. The last part sets the background color of the tab to something unique for the package. This makes it easy to spot the right tab when I have like 10 iTerm tabs open.
In case you want to see the definition of the last part:
set_tab_color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
echo -ne "\033]6;1;bg;blue;brightness;$3\a"
}
tab-color-devil-blue() { set_tab_color 34 112 147 }
Tested only in iTerm.
- wingerlang 8y agoIn my previous setup, I had a function that displayed a menu when I started bash, listing all my "main" directories. So each time you started a session you just had to press 1-7 to go where you wanted.
- niyazpk 8y agoThat is a great idea. Thank you!
- wingerlang 8y agoDefinitely save me some time and effort. The only issue I had was that sometimes when I wanted to use bash from, like, another app it would start the menu so it wouldn't work to use it from them. I'm sure it can be worked around but it was never a real issue so I didn't work on it. Here is the code I had https://gist.github.com/jontelang/c6317bf14c527d2a89f1efd5d0558f73 https://gist.github.com/jontelang/c6317bf14c527d2a89f1efd5d0... and I put this straight into my .bash_profile and it runs automatically when the shell starts.