diff options
author | William Carroll <wpcarro@gmail.com> | 2019-05-14T16·00+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2019-05-14T16·00+0100 |
commit | a7c72adb2ebec1e497fc040eaf3551d564d61a5b (patch) | |
tree | ba5a9ea7c19a7fcbaafe2f2188ba77d670bccd6e /configs/shared | |
parent | 01b985fdd9d2d2798c428c3c86942ca3e6289273 (diff) |
Support functions for navigating Google3
I had `tbz`, which toggles between a project directory and it's associated blaze-bin. I added three functions which support navigating to blaze-bin, blaze-genfiles, and to the project root.
Diffstat (limited to 'configs/shared')
-rw-r--r-- | configs/shared/zsh/functions.zsh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/configs/shared/zsh/functions.zsh b/configs/shared/zsh/functions.zsh index 4eede030466c..9a02b1b947c8 100644 --- a/configs/shared/zsh/functions.zsh +++ b/configs/shared/zsh/functions.zsh @@ -42,6 +42,29 @@ fv() { [[ -n "$file" ]] && vim "$file" } +project_root() { + # Changes to the directory of the project root. + if [[ "$(pwd)" =~ '(.*)/blaze-bin(.*)' ]]; then + cd "${match[1]}${match[2]}" + elif [[ "$(pwd)" =~ '(.*)/blaze-genfiles(.*)' ]]; then + cd "${match[1]}${match[2]}" + fi +} + +blaze_bin() { + # Changes to the blaze-bin directory. + # Depends: + # - project_root + project_root && cd "${PWD/\/google3//google3/blaze-bin}" +} + +blaze_genfiles() { + # Changes to the blaze-genfiles directory. + # Depends: + # - project_root + project_root && cd "${PWD/\/google3//google3/blaze-genfiles}" +} + tbz() { # Toggle between blaze-bin and your source. # Useful if you like to cd into the dir where your source lives. |