Re:Z – Jump Around
by wingerlang on Wednesday January 17, 2024 @10:48AM
(#39029328)
My lowtech solution was to make a function with an array of hardcoded paths, it would then present a menu where you could select 0-N and it would jump. It also started with Terminal.
[ Parent
| on HN ]
My lowtech solution was just a bunch of aliases for directories i use a lot. Like:
alias .a='cd ~/src/autosqueezer'
alias .g='cd ~/src/gcc-squeeze-plugin'
alias .u='cd ~/src/squeeze-utils'
etc. You have to manage them by hand, but that's easy, and makes the result much more predictable than anything based on history.I also have contextual companions to these, defined as functions, like:
.r() {
local project_root=$(somehow work out the root of the current project)
cd $project_root
}
.b() {
.r
cd build
}
Re:Z – Jump Around
by notawaytothink on Wednesday January 17, 2024 @08:07PM
(#39036112)
Are you aware of wd? (https://github.com/quackduck/WarpDrive)
``` cd ~/src/autosqueezer wd add a # later, somewhere else wd a ```
A slightly different take is available if you're a zsh user, as you can take advantage of named directories to replace the aliases. If you do this the directories you've added will show up in regular completions and be available as arguments to commands too. For example, `hash -d name=location` allows you to use `~name` for the path.
`run-help hash` for the basic interface, or zshexpn(1) for the gory details including fancy dynamic naming.