Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cal2195/q
q - vim like macro registers for your bash and zsh shell!
https://github.com/cal2195/q
bash bashrc bookmarks directories registers shell vim zsh zshrc
Last synced: about 1 month ago
JSON representation
q - vim like macro registers for your bash and zsh shell!
- Host: GitHub
- URL: https://github.com/cal2195/q
- Owner: cal2195
- License: mit
- Created: 2018-03-12T18:57:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-29T10:08:39.000Z (over 4 years ago)
- Last Synced: 2024-08-13T07:15:51.165Z (5 months ago)
- Topics: bash, bashrc, bookmarks, directories, registers, shell, vim, zsh, zshrc
- Language: Shell
- Homepage:
- Size: 23.4 KB
- Stars: 69
- Watchers: 4
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - cal2195/q - q - vim like macro registers for your bash and zsh shell! (Shell)
README
# q - registers for your bash and zsh shell
**q** implements vim like macro registers in your bash and zsh shell![![asciicast](https://asciinema.org/a/aIMmhJ2ayudv65d7eDWJZtSmi.png)](https://asciinema.org/a/aIMmhJ2ayudv65d7eDWJZtSmi)
*Dynamic Terminal Aliases and Bookmarks On The Go!*
## Maintainers
:small_orange_diamond: [Cal Martin](https://github.com/cal2195) - Initial implemenation
:small_orange_diamond: [Oisin Johnston](https://github.com/DaJuice) - Reconfigurable key bindings :)
## Installation
### Bash
#### Manual
Download `q.sh` to somewhere, and place this line in your `.bashrc`:
```
source /path/to/q.sh
```### ZSH
#### Antigen
Simply place this line in your `.antigenrc`:
```
antigen bundle cal2195/q
```**NB:** if you use `zsh-users/zsh-syntax-highlighting`, make sure you place `antigen bundle cal2195/q` below it! :)
#### Manual
Download `q.plugin.zsh` to somewhere and place this line in your `.zshrc`:
```
source /path/to/q.plugin.zsh
```## Usage
**q** commands start with the prefix Q for setting registers, q for executing registers, and U for unsetting registers.
Register names can be any alphanumeric string! Command that already exist in your `$PATH` take priority:
```
> Qutebrowser
Sorry, "qutebrowser" already exists in your $PATH! :(
```### Saving directories
To set a register, navigate to the directory and use the command Q:
```
> cd ~/fyp/experiments
> Qfe
Register fe set to /home/cal/fyp/experiments
```To then `cd` to that directory, just use q:
```
> qfe
cd /home/cal/fyp/experiments
```### Saving commands
To save a command to a register, just add it after the register:
```
> Qi3c vim ~/.config/i3/config
Register i3c set to vim ~/.config/i3/config
```Then you can call up vim using q:
```
> qi3c
vim ~/.config/i3/config
```You can also add arguments!
```
> Qv vim
Register v set to vim
> qv .zsh/alias.zsh
vim .zsh/alias.zsh
```Useful for longer commands:
```
> Qy yaourt -Syyu
Register y set to yaourt -Syyu
> qy
yaourt -Syyu
:: Synchronising package databases...
...
```### Listing register contents
To see what registers you have set and their contents, just type q:
```
> q
q - registers for zshUsage: q[register] [args]
Q[register] [command]
U[register]Setting Registers:
Q[register] Set register [register] to current directory
Q[register] [command] Set register [register] to [command]Unsetting Registers:
U[register] Unset register [register]Running Registers:
q[register] Run command or cd to directory in register [register]
q[register] [args] Run command in register [register] with [args]Registers:
c: cd /home/cal/.config
f: cd /home/cal/data/college/fyp
g: cd /home/cal/data/git
x: cd /home/cal/data/college/fyp/experiments
```### Unsetting Registers
To unset a register, simply use the U command:
```
> Uh
Unset register h.
```### Setting Custom Commands
To change the default commands (Q,q,U) to something else just set three variables in .zshrc/.bashrc before sourcing the script:
```
Q_SET=''
Q_RUN=''
Q_UNSET=''
```### Usage Help
```
q - registers for zshUsage: q[register] [args]
Q[register] [command]
U[register]Setting Registers:
Q[register] Set register [register] to current directory
Q[register] [command] Set register [register] to [command]Unsetting Registers:
U[register] Unset register [register]Running Registers:
q[register] Run command or cd to directory in register [register]
q[register] [args] Run command in register [register] with [args]Registers:
c: cd /home/cal/.config
f: cd /home/cal/data/college/fyp
g: cd /home/cal/data/git
x: cd /home/cal/data/college/fyp/experiments
```