This project allows you to move your cursor in your terminal by bisecting the current command left or right with a single keystroke. Currently the keybinding is set to alt+left arrow and alt+right arrow, which are the ^[[1;3D and ^[[1;3C keycodes, respectively.
bisect.mp4
Clone this repository into your $ZSH/custom/plugins directory. Then go into your ~/.zshrc file and add the following:
export ZSH=$HOME/
export ZSH_CUSTOM="$ZSH/custom
plugins=(
line-bisect <--- this line, or add the plugins array if you don't have it already
)
Also, you might need to add this line AFTER the loading of plugins in your .zshrc file, ideally at the very end, but for some reason my ZSH installation doesn't have this file so only put it if you do have it:
source $ZSH/oh-my-zsh.sh
You might also need to add this line to your ~/.zshrc file if the plugin isn't getting found:
source $ZSH_CUSTOM/plugins/line-bisect/line-bisect.plugin.zsh
Change the file location above to be where you installed the plugin.
If you want to change that keybinding, you currently would have to change the plugin through the following process.
- In your terminal, enter the
catcommand, then press the single keystroke you wish to use with the left bisect, such as CMD+[, or something similar. This will print out the keycode that gets sent when you press that keystroke. Copy that keycode. - Open the line-bisect.plugin.zsh file and change the keycode that comes after the first
bindkeyinside of the quotation marks. - Repeat step 1 for the right bisect keystroke.
- In line-bisect.plugin.zsh, change the keycode that comes after the second
bindkeyinside the quotation marks. - Save line-bisect.plugin.zsh and restart ZSH. Make sure you have the line-bisect plugin included in your plugin array in the
.zshrcfile!