Unverified Commit f298ebb2 authored by Christian Duerr's avatar Christian Duerr Committed by GitHub

Add shell completions and manpage

* Add manpage

Adds a basic manpage that was autogenerated with `help2man` and then
slightly adjusted with information from the README.md and better

* Add zsh completions

Add completions for the zsh shell. These should be complete and even
allow completion of the command inside `--command` and `-e`.

* Add bash completions

The bash completions are almost on the same level as the zsh
completions. The only little thing the bash completions do not do is
complete inside of `--command` and `-e`, instead bash just stops
completion after these options.

* Update readme with manpage and completions

Added the install instructions for the manpage and completions to the

Also tweaked the current readme a slight bit because the build section
was structured in a slightly confusing way.
parent 7f2b398a
......@@ -213,6 +213,11 @@ filling in this section of the README.
### Building
**BEFORE YOU RUN IT:** Install the config file as described below; otherwise,
many things (such as arrow keys) will not work.
#### Linux
Once all the prerequisites are installed, compiling Alacritty should be easy:
......@@ -220,10 +225,8 @@ cargo build --release
If all goes well, this should place a binary at `target/release/alacritty`.
**BEFORE YOU RUN IT:** Install the config file as described below; otherwise,
many things (such as arrow keys) will not work.
### Desktop Entry
##### Desktop Entry
Many linux distributions support desktop entries for adding applications to
system menus. To install the desktop entry for Alacritty, run
......@@ -233,6 +236,8 @@ sudo cp target/release/alacritty /usr/local/bin # or anywhere else in $PATH
cp Alacritty.desktop ~/.local/share/applications
#### MacOS
To build an application for macOS, run
......@@ -240,6 +245,46 @@ make app
cp -r target/release/osx/Alacritty.app /Applications/
## Manual Page
Installing the manual page requires the additional dependency `gzip`.
To install the manual page, run
sudo mkdir -p /usr/local/share/man/man1
gzip -c alacritty.man | sudo tee /usr/local/share/man/man1/alacritty.1.gz > /dev/null
## Shell completions
To get automatic completions for alacritty's flags and arguments you can install the provided shell completions.
### Zsh
To install the completions for zsh, run
sudo cp alacritty-completions.zsh /usr/share/zsh/functions/Completion/X/_alacritty
### Bash
To install the completions for bash, you can `source` the `alacritty-completions.bash` in your `~/.bashrc` file.
If you do not plan to delete the source folder of alacritty, you can run
echo "source $(pwd)/alacritty-completions.bash" >> ~/.bashrc
Otherwise you can copy it to the `~/.bash_completion` folder and source it from there:
mkdir -p ~/.bash_completion
cp alacritty-completions.bash ~/.bash_completion/alacritty
echo "source ~/.bash_completion/alacritty" >> ~/.bashrc
## Configuration
Although it's possible the default configuration would work on your system,
#/usr/bin/env bash
# Load completion function
complete -F _alacritty alacritty
# Completion function
local cur prev prevprev opts
opts="-h --help -V --version --live-config-reload --no-live-config-reload --print-events -q -qq -v -vv -vvv --ref-test -e --command --config-file -d --dimensions -t --title --working-directory"
# If `--command` or `-e` is used, stop completing
for i in "${!COMP_WORDS[@]}"; do
echo "${COMP_WORDS[i]}" >> ./testfile
if [[ "${COMP_WORDS[i]}" == "--command" ]] \
|| [[ "${COMP_WORDS[i]}" == "-e" ]] \
&& [[ "${#COMP_WORDS[@]}" -gt "$(($i + 2))" ]]
return 0
# Make sure the Y dimension isn't completed
if [[ "${prevprev}" == "--dimensions" ]] || [[ "${prevprev}" == "-d" ]]; then
return 0
# Match the previous word
case "${prev}" in
--command | -e)
# Complete all commands in $PATH
COMPREPLY=( $(compgen -c -- "${cur}") )
return 0;;
# Path based completion
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- "${cur}") )
return 0;;
--dimensions | -d | --title | -t)
# Don't complete here
return 0;;
# Directory completion
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -d -- "${cur}") )
return 0;;
# Show all flags if there was no previous word
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
#compdef alacritty
_alacritty() {
local context curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
"(-h --help)"{-h,--help}"[Prints help information]" \
"(-V --version)"{-V,--version}"[Prints version information]" \
"(--no-live-config-reload)--live-config-reload[Enable automatic config reloading]" \
"(--live-config-reload)--no-live-config-reload[Disable automatic config reloading]" \
"--print-events[Print all events to stdout]" \
{-q,-qq}"[Reduces the level of verbosity (min is -qq)]" \
{-v,-vv,-vvv}"[Increases the level of verbosity (max is -vvv)]" \
"--ref-test[Generates ref test]" \
"--config-file[Specify an alternative config file]:file:_files" \
"(-d --dimensions)"{-d,--dimensions}"[Window dimensions]:dimensions:_guard '<->' width: :_guard '<->' length" \
"--title[Defines the window title]:title:" \
"--working-directory[Start shell in specified directory]:directory:_dir_list" \
"(-e --command)"{-e,--command}"[Execute command (must be last arg)]:program: _command_names -e:*::program arguments: _normal"
_alacritty "$@"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.5.
.TH ALACRITTY "1" "March 2018" "alacritty 0.1.0" "User Commands"
alacritty \- a cross-platform, gpu-accelerated terminal emulator
alacritty [FLAGS] [OPTIONS]
Alacritty is focused on simplicity and performance.
The performance goal means it should be faster than any other terminal emulator available.
The simplicity goal means that it doesn't have features such as tabs or splits (which can be better provided by a window manager or terminal multiplexer) nor niceties like a GUI config editor.
\fB\-h\fR, \fB\-\-help\fR
Prints help information
Enable automatic config reloading
Disable automatic config reloading
Reduces the level of verbosity (the min level is \fB\-qq\fR)
Generates ref test
Increases the level of verbosity (the max level is \fB\-vvv\fR)
\fB\-V\fR, \fB\-\-version\fR
Prints version information
\fB\-e\fR, \fB\-\-command\fR <command>...
Command and args to execute (must be last argument)
\fB\-\-config\-file\fR <config\-file>
Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml]
\fB\-d\fR, \fB\-\-dimensions\fR <columns> <lines>
Defines the window dimensions. Falls back to size specified by window manager if set to 0x0 [default: 80x24]
\fB\-t\fR, \fB\-\-title\fR <title>
Defines the window title [default: Alacritty]
\fB\-\-working\-directory\fR <working\-directory>
Start the shell in the specified working directory
See the alacritty github repository at https://github.com/jwilm/alacritty for the full documentation.
Found a bug? Please report it at https://github.com/jwilm/alacritty/issues.
.RS 4
.ie n \{\
.el \{\
.sp -1
.IP \(bu 2.3
Joe Wilm <joe@jwilm.com>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment