-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add manpage Adds a basic manpage that was autogenerated with `help2man` and then slightly adjusted with information from the README.md and better formatting. * 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 README.md. Also tweaked the current readme a slight bit because the build section was structured in a slightly confusing way.
- Loading branch information
1 parent
7f2b398
commit f298ebb
Showing
4 changed files
with
199 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#/usr/bin/env bash | ||
|
||
# Load completion function | ||
complete -F _alacritty alacritty | ||
|
||
# Completion function | ||
_alacritty() | ||
{ | ||
local cur prev prevprev opts | ||
COMPREPLY=() | ||
cur="${COMP_WORDS[COMP_CWORD]}" | ||
prev="${COMP_WORDS[COMP_CWORD-1]}" | ||
prevprev="${COMP_WORDS[COMP_CWORD-2]}" | ||
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))" ]] | ||
then | ||
return 0 | ||
fi | ||
done | ||
|
||
# Make sure the Y dimension isn't completed | ||
if [[ "${prevprev}" == "--dimensions" ]] || [[ "${prevprev}" == "-d" ]]; then | ||
return 0 | ||
fi | ||
|
||
# Match the previous word | ||
case "${prev}" in | ||
--command | -e) | ||
# Complete all commands in $PATH | ||
COMPREPLY=( $(compgen -c -- "${cur}") ) | ||
return 0;; | ||
--config-file) | ||
# 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;; | ||
--working-directory) | ||
# Directory completion | ||
local IFS=$'\n' | ||
compopt -o filenames | ||
COMPREPLY=( $(compgen -d -- "${cur}") ) | ||
return 0;; | ||
esac | ||
|
||
# Show all flags if there was no previous word | ||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.5. | ||
.TH ALACRITTY "1" "March 2018" "alacritty 0.1.0" "User Commands" | ||
.SH NAME | ||
alacritty \- a cross-platform, gpu-accelerated terminal emulator | ||
.SH "SYNOPSIS" | ||
alacritty [FLAGS] [OPTIONS] | ||
.SH DESCRIPTION | ||
Alacritty is focused on simplicity and performance. | ||
.TP | ||
The performance goal means it should be faster than any other terminal emulator available. | ||
.TP | ||
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. | ||
.SH "FLAGS" | ||
.TP | ||
\fB\-h\fR, \fB\-\-help\fR | ||
Prints help information | ||
.TP | ||
\fB\-\-live\-config\-reload\fR | ||
Enable automatic config reloading | ||
.TP | ||
\fB\-\-no\-live\-config\-reload\fR | ||
Disable automatic config reloading | ||
.HP | ||
\fB\-\-print\-events\fR | ||
.TP | ||
\fB\-q\fR | ||
Reduces the level of verbosity (the min level is \fB\-qq\fR) | ||
.TP | ||
\fB\-\-ref\-test\fR | ||
Generates ref test | ||
.TP | ||
\fB\-v\fR | ||
Increases the level of verbosity (the max level is \fB\-vvv\fR) | ||
.TP | ||
\fB\-V\fR, \fB\-\-version\fR | ||
Prints version information | ||
.SH "OPTIONS" | ||
.TP | ||
\fB\-e\fR, \fB\-\-command\fR <command>... | ||
Command and args to execute (must be last argument) | ||
.HP | ||
\fB\-\-config\-file\fR <config\-file> | ||
.IP | ||
Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml] | ||
.HP | ||
\fB\-d\fR, \fB\-\-dimensions\fR <columns> <lines> | ||
.IP | ||
Defines the window dimensions. Falls back to size specified by window manager if set to 0x0 [default: 80x24] | ||
.TP | ||
\fB\-t\fR, \fB\-\-title\fR <title> | ||
Defines the window title [default: Alacritty] | ||
.TP | ||
\fB\-\-working\-directory\fR <working\-directory> | ||
Start the shell in the specified working directory | ||
.SH "SEE ALSO" | ||
See the alacritty github repository at https://github.com/jwilm/alacritty for the full documentation. | ||
.SH "BUGS" | ||
Found a bug? Please report it at https://github.com/jwilm/alacritty/issues. | ||
.SH "AUTHORS" | ||
Maintainers: | ||
.sp | ||
.RS 4 | ||
.ie n \{\ | ||
\h'-04'\(bu\h'+03'\c | ||
.\} | ||
.el \{\ | ||
.sp -1 | ||
.IP \(bu 2.3 | ||
.\} | ||
Joe Wilm <joe@jwilm.com> |