From a9d0a2cda68be68d51d4ef291224f59f95b93ee1 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Tue, 29 Oct 2019 01:04:10 +0100 Subject: [PATCH 1/2] Completion for Midnight Commander (`mc' command) --- src/_mc | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/_mc diff --git a/src/_mc b/src/_mc new file mode 100644 index 0000000..c289abd --- /dev/null +++ b/src/_mc @@ -0,0 +1,42 @@ +#compdef mc +# Copyright (c) 2019 Sebastian Gniazdowski + +setopt localoptions warncreateglobal typesetsilent + +local -a opts +opts=( + {-h,--help}'[show help on options]' + --help-all'[show help on all options]' + --help-terminal'[terminal options help]' + --help-color'[color options help]' + {-x,--xterm}'[forces xterm features]' + {-X,--no-x11}'[disable X11 support]' + {-g,--oldmouse}'[tries to use an old highlight mouse tracking]' + {-d,--nomouse}'[disable mouse support in text version]' + {-t,--termcap}'[tries to use termcap instead of terminfo]' + {-s,--slow}'[to run on slow terminals]' + {-a,--stickchars}'[use stickchars to draw]' + {-k,--resetsoft}'[resets soft keys on HP terminals]' + {-K,--keymap=}'[load definitions of key bindings from specified file]' + --nokeymap'[dont load definitions of key bindings from file, use defaults]' + --colors'[KEYWORD={FORE},{BACK},{ATTR}:KEYWORD2=...]' + {-b,--nocolor}'[requests to run in black and white]' + {-c,--color}'[request to run in color mode]' + {-C,--colors}'[specifies a color configuration]' + {-S,--skin}'[show mc with specified skin]' + {-V,--version}'[displays the current version]' + {-f,--datadir}'[print data directory]' + {-F,--datadir-info}'[print extended info about used data directories]' + --configure-options'[print configure options]' + {-P,--printwd=}'[print last working directory to specified file]' + {-U,--subshell}'[enables subshell support (default)]' + {-u,--nosubshell}'[disables subshell support]' + {-l,--ftplog=}'[log ftp dialog to specified file]' + {-v,--view=}'[launches the file viewer on a file]' + {-e,--edit=}'[edit files]' + '*:pane directory:_directories' +) + +_arguments -s $opts + +# Return value passes through From c65ddb662146a0761f134c4db080a60ed52ec14d Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Mon, 25 May 2020 20:44:45 +0900 Subject: [PATCH 2/2] Improve mc completion - Add license header - improve file completions - update new options --- src/_mc | 78 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 22 deletions(-) diff --git a/src/_mc b/src/_mc index c289abd..721bf4a 100644 --- a/src/_mc +++ b/src/_mc @@ -1,5 +1,31 @@ #compdef mc +# ------------------------------------------------------------------------------ # Copyright (c) 2019 Sebastian Gniazdowski +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Sebastian Gniazdowski (https://github.com/psprint) +# ------------------------------------------------------------------------------ setopt localoptions warncreateglobal typesetsilent @@ -9,34 +35,42 @@ opts=( --help-all'[show help on all options]' --help-terminal'[terminal options help]' --help-color'[color options help]' - {-x,--xterm}'[forces xterm features]' - {-X,--no-x11}'[disable X11 support]' - {-g,--oldmouse}'[tries to use an old highlight mouse tracking]' - {-d,--nomouse}'[disable mouse support in text version]' - {-t,--termcap}'[tries to use termcap instead of terminfo]' - {-s,--slow}'[to run on slow terminals]' {-a,--stickchars}'[use stickchars to draw]' - {-k,--resetsoft}'[resets soft keys on HP terminals]' - {-K,--keymap=}'[load definitions of key bindings from specified file]' - --nokeymap'[dont load definitions of key bindings from file, use defaults]' - --colors'[KEYWORD={FORE},{BACK},{ATTR}:KEYWORD2=...]' - {-b,--nocolor}'[requests to run in black and white]' - {-c,--color}'[request to run in color mode]' - {-C,--colors}'[specifies a color configuration]' - {-S,--skin}'[show mc with specified skin]' - {-V,--version}'[displays the current version]' + '(-c --color -b --nocolor)'{-b,--nocolor}'[requests to run in black and white]' + '(-b --nocolor -c --color)'{-c,--color}'[request to run in color mode]' + {-C,--colors=}'[specifies a color configuration]:arg:' + --configure-options'[print configure options]' + {-d,--nomouse}'[disable mouse support in text version]' + {-d,--debuglevel=}'[save the debug level for SMB VFS]:debug level:(0 1 2 3 4 5 6 7 8 9 10)' + {-e,--edit=}'[edit files]:file:_files' {-f,--datadir}'[print data directory]' {-F,--datadir-info}'[print extended info about used data directories]' - --configure-options'[print configure options]' - {-P,--printwd=}'[print last working directory to specified file]' - {-U,--subshell}'[enables subshell support (default)]' - {-u,--nosubshell}'[disables subshell support]' - {-l,--ftplog=}'[log ftp dialog to specified file]' - {-v,--view=}'[launches the file viewer on a file]' - {-e,--edit=}'[edit files]' + {-g,--oldmouse}'[tries to use an old highlight mouse tracking]' + {-k,--resetsoft}'[resets soft keys on HP terminals]' + {-K,--keymap=}'[load definitions of key bindings from specified file]:file:_files' + {-l,--ftplog=}'[log ftp dialog to specified file]:file:_files' + --nokeymap'[dont load definitions of key bindings from file, use defaults]' + {-P,--printwd=}'[print last working directory to specified file]:file:_files' + {-s,--slow}'[to run on slow terminals]' + {-S,--skin=}'[show mc with specified skin]:skin:' + {-t,--termcap}'[tries to use termcap instead of terminfo]' + '(-U --subshell -u --nosubshell)'{-u,--nosubshell}'[disables subshell support]' + '(-u --nosubshell -U --subshell)'{-U,--subshell}'[enables subshell support (default)]' + {-v,--view=}'[launches the file viewer on a file]:file:_files' + {-V,--version}'[displays the current version]' + {-x,--xterm}'[forces xterm features]' + {-X,--no-x11}'[disable X11 support]' '*:pane directory:_directories' ) _arguments -s $opts # Return value passes through + +# 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