add completion for kitty 0.14.0 (https://sw.kovidgoyal.net/kitty)
This commit is contained in:
parent
cf565254e2
commit
d1c0b5d50d
|
@ -0,0 +1,232 @@
|
|||
#compdef kitty
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for kitty 0.14.0 (https://sw.kovidgoyal.net/kitty).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
_kitty() {
|
||||
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'(- 1 *)'{-h,--help}'[show help options]' \
|
||||
'(- 1 *)'{-v,--version}'[the current kitty version]' \
|
||||
'--class[set the class part of the WM_CLASS window property]:window class' \
|
||||
'--name[set the name part of the WM_CLASS property]:window class name' \
|
||||
'(-T --title)'{-T,--title}'[set the window title]:window title' \
|
||||
'*'{-c,--config}'[specify a path to the configuration file(s) to use]:configuration file:_files -g "*.conf"' \
|
||||
'*'{-o,--override}'[override individual configuration options]: :_kitty_overrides' \
|
||||
'(-d --directory)'{-d,--directory}'[change to the specified directory when launching]: :_files -/' \
|
||||
'--detach[detach from the controlling terminal, if any]' \
|
||||
'--session[path to a file containing the startup session (tabs, windows, layout, programs)]:session file:_files' \
|
||||
'--hold[remain open after child process exits]' \
|
||||
'(-1 --single-instance)'{-1,--single-instance}'[if specified only a single instance of kitty will run]' \
|
||||
'--instance-group[used in combination with the --single-instance option, all kitty invocations with the same --instance-group will result in new windows being created in the first kitty instance within that group]:instance group' \
|
||||
'--wait-for-single-instance-window-close[normally, when using --single-instance, kitty will open a new window in an existing instance and quit immediately. With this option, it will not quit till the newly opened window is closed]' \
|
||||
'--listen-on[tell kitty to listen on the specified address for control messages]: :_kitty_sockets' \
|
||||
'--start-as[control how the initial kitty window is created]:start mode:(minimized fullscreen normal maximized)' \
|
||||
'--dump-commands[output commands received from child process to stdout]' \
|
||||
'--replay-commands[replay previously dumped commands]:dumped commands file:_files' \
|
||||
'--dump-bytes[path to file in which to store the raw bytes received from the child process]' \
|
||||
'--debug-gl[debug OpenGL commands]' \
|
||||
'--debug-keyboard[print out key events as they are received]' \
|
||||
'--debug-font-fallback[print out information about the selection of fallback fonts for characters not present in the main font]' \
|
||||
'--debug-config[print out information about the system and kitty configuration]'
|
||||
}
|
||||
|
||||
(( $+functions[_kitty_overrides] )) ||
|
||||
_kitty_overrides() {
|
||||
local ret=1
|
||||
if compset -P '*='; then
|
||||
_kitty_config_values ${IPREFIX%=} && ret=0
|
||||
else
|
||||
_kitty_config_keys -qS= && ret=0
|
||||
fi
|
||||
return ret
|
||||
}
|
||||
|
||||
(( $+functions[_kitty_config_keys] )) ||
|
||||
_kitty_config_keys() {
|
||||
local font_options=(
|
||||
'font_family:default value "monospace"'
|
||||
'bold_font:default value "auto"'
|
||||
'italic_font:default value "auto"'
|
||||
'bold_italic_font:default value "auto"'
|
||||
'font_size:default value "11.0"'
|
||||
'adjust_line_height:default value "0"'
|
||||
'adjust_column_width:default value "0"'
|
||||
'symbol_map:default value "U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols"'
|
||||
'disable_ligatures:default value "never"'
|
||||
'box_drawing_scale:default value "0.001, 1, 1.5, 2"'
|
||||
)
|
||||
local cursor_options=(
|
||||
'cursor:default value "#cccccc"'
|
||||
'cursor_text_color:default value "#111111"'
|
||||
'cursor_shape:default value "block"'
|
||||
'cursor_blink_interval:default value "-1"'
|
||||
'cursor_stop_blinking_after:default value "15.0"'
|
||||
)
|
||||
local scrollback_options=(
|
||||
'scrollback_lines:default value "2000"'
|
||||
'scrollback_pager:default value "less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER"'
|
||||
'scrollback_pager_history_size:default value "0"'
|
||||
'wheel_scroll_multiplier:default value "5.0"'
|
||||
'touch_scroll_multiplier:default value "1.0"'
|
||||
)
|
||||
local mouse_options=(
|
||||
'mouse_hide_wait:default value "3.0"'
|
||||
'url_color:default value "#0087bd"'
|
||||
'url_style:default value "curly"'
|
||||
'open_url_modifiers:default value "kitty_mod"'
|
||||
'open_url_with:default value "default"'
|
||||
'copy_on_select:default value "no"'
|
||||
'strip_trailing_spaces:default value "never"'
|
||||
'rectangle_select_modifiers:default value "ctrl+alt"'
|
||||
'select_by_word_characters:default value ":@-./_~?&=%+#"'
|
||||
'click_interval:default value "-1.0"'
|
||||
'focus_follows_mouse:default value "no"'
|
||||
)
|
||||
local performance_options=(
|
||||
'repaint_delay:default value "10"'
|
||||
'input_delay:default value "3"'
|
||||
'sync_to_monitor:default value "yes"'
|
||||
)
|
||||
local bell_options=(
|
||||
'enable_audio_bell:default value "yes"'
|
||||
'visual_bell_duration:default value "0.0"'
|
||||
'window_alert_on_bell:default value "yes"'
|
||||
'bell_on_tab:default value "yes"'
|
||||
)
|
||||
local layout_options=(
|
||||
'remember_window_size:default value "yes"'
|
||||
'initial_window_width:default value "640"'
|
||||
'initial_window_height:default value "400"'
|
||||
'enabled_layouts:default value "*"'
|
||||
'window_resize_step_cells:default value "2"'
|
||||
'window_resize_step_lines:default value "2"'
|
||||
'window_border_width:default value "1.0"'
|
||||
'draw_minimal_borders:default value "yes"'
|
||||
'window_margin_width:default value "0.0"'
|
||||
'single_window_margin_width:default value "-1000.0"'
|
||||
'window_padding_width:default value "0.0"'
|
||||
'active_border_color:default value "#00ff00"'
|
||||
'inactive_border_color:default value "#cccccc"'
|
||||
'bell_border_color:default value "#ff5a00"'
|
||||
'inactive_text_alpha:default value "1.0"'
|
||||
'hide_window_decorations:default value "no"'
|
||||
'resize_debounce_time:default value "0.1"'
|
||||
'resize_draw_strategy:default value "static"'
|
||||
)
|
||||
local tab_options=(
|
||||
'tab_bar_edge:default value "bottom"'
|
||||
'tab_bar_margin_width:default value "0.0"'
|
||||
'tab_bar_style:default value "fade"'
|
||||
'tab_bar_min_tabs:default value "2"'
|
||||
'tab_switch_strategy:default value "previous"'
|
||||
'tab_fade:default value "0.25 0.5 0.75 1"'
|
||||
'tab_separator:default value "" ┇""'
|
||||
'tab_title_template:default value "{title}"'
|
||||
'active_tab_foreground:default value "#000"'
|
||||
'active_tab_background:default value "#eee"'
|
||||
'active_tab_font_style:default value "bold-italic"'
|
||||
'inactive_tab_foreground:default value "#444"'
|
||||
'inactive_tab_background:default value "#999"'
|
||||
'inactive_tab_font_style:default value "normal"'
|
||||
)
|
||||
local color_options=(
|
||||
'foreground:default value "#dddddd"'
|
||||
'background:default value "#000000"'
|
||||
'background_opacity:default value "1.0"'
|
||||
'dynamic_background_opacity:default value "no"'
|
||||
'dim_opacity:default value "0.75"'
|
||||
'selection_foreground:default value "#000000"'
|
||||
'selection_background:default value "#fffacd"'
|
||||
'color0:default value "#000000"'
|
||||
'color8:default value "#767676"'
|
||||
'color1:default value "#cc0403"'
|
||||
'color9:default value "#f2201f"'
|
||||
'color2:default value "#19cb00"'
|
||||
'color10:default value "#23fd00"'
|
||||
'color3:default value "#cecb00"'
|
||||
'color11:default value "#fffd00"'
|
||||
'color4:default value "#0d73cc"'
|
||||
'color12:default value "#1a8fff"'
|
||||
'color5:default value "#cb1ed1"'
|
||||
'color13:default value "#fd28ff"'
|
||||
'color6:default value "#0dcdcd"'
|
||||
'color14:default value "#14ffff"'
|
||||
'color7:default value "#dddddd"'
|
||||
'color15:default value "#ffffff"'
|
||||
)
|
||||
local advanced_options=(
|
||||
'shell:default value "."'
|
||||
'editor:default value "."'
|
||||
'close_on_child_death:default value "no"'
|
||||
'allow_remote_control:default value "no"'
|
||||
'env:default value ""'
|
||||
'update_check_interval:default value "24"'
|
||||
'startup_session:default value "none"'
|
||||
'clipboard_control:default value "write-clipboard write-primary"'
|
||||
'term:default value "xterm-kitty"'
|
||||
)
|
||||
local macos_options=(
|
||||
'macos_titlebar_color:default value "system"'
|
||||
'macos_option_as_alt:default value "no"'
|
||||
'macos_hide_from_tasks:default value "no"'
|
||||
'macos_quit_when_last_window_closed:default value "no"'
|
||||
'macos_window_resizable:default value "yes"'
|
||||
'macos_thicken_font:default value "0"'
|
||||
'macos_traditional_fullscreen:default value "no"'
|
||||
'macos_show_window_title_in_menubar:default value "yes"'
|
||||
'macos_custom_beam_cursor:default value "no"'
|
||||
)
|
||||
local keybind_options=(
|
||||
'kitty_mod:default value "ctrl+shift"'
|
||||
'clear_all_shortcuts:default value "no"'
|
||||
'map:define a key binding'
|
||||
)
|
||||
_describe -t font-config-key 'font options' font_options "$@"
|
||||
_describe -t cursor-config-key 'cursor options' cursor_options "$@"
|
||||
_describe -t scrollback-config-key 'scrollback options' scrollback_options "$@"
|
||||
_describe -t mouse-config-key 'mouse options' mouse_options "$@"
|
||||
_describe -t performance-config-key 'performance options' performance_options "$@"
|
||||
_describe -t bell-config-key 'bell options' bell_options "$@"
|
||||
_describe -t layout-config-key 'layout options' layout_options "$@"
|
||||
_describe -t tab-config-key 'tab options' tab_options "$@"
|
||||
_describe -t color-config-key 'color options' color_options "$@"
|
||||
_describe -t advanced-config-key 'advanced options' advanced_options "$@"
|
||||
_describe -t macos-config-key 'Mac OS options' macos_options "$@"
|
||||
_describe -t keybind-config-key 'keybind options' keybind_options "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_kitty_config_values] )) ||
|
||||
_kitty_config_values() {
|
||||
_guard '[^\-]#' 'config value'
|
||||
}
|
||||
|
||||
(( $+functions[_kitty_sockets] )) ||
|
||||
_kitty_sockets() {
|
||||
# TODO should support "unix:socket" and "tcp:host:port"
|
||||
_files -g "*(-=)"
|
||||
}
|
||||
|
||||
_kitty "$@"
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
Loading…
Reference in New Issue