mirror of
https://github.com/zsh-users/zsh-completions.git
synced 2026-09-17 16:00:19 +00:00
Having a vim modeline or emacs local variable line somewhere in the middle of the file isn't really helpful. By default, vim will only check the first and last 5 lines of a file for a modeline (assuming the modeline option is enabled). Emacs is even more strict about the type of local variable line that was in use, it will only check the first line of the file or the second line if the first line specifies a script interpreter (which isn't the case here). Move the vim modeline to the end of the file so that it can actually be found by vim but is out of the way for editing. For emacs more work is required, convert that to the more verbose Local Variables syntax which emacs will look for starting 3000 characters from the end of the file. Also there is no zsh mode for emacs (according to zsh-users/zsh-completions#75), use the "Shell-Script" mode instead. This seems to automatically detect that the files are for zsh. I'm not an emacs user, so I haven't tested that portion much. But, this does at least improve the syntax highlighting there.
85 lines
2.4 KiB
Bash
85 lines
2.4 KiB
Bash
#compdef showoff
|
|
# ------------------------------------------------------------------------------
|
|
# Description
|
|
# -----------
|
|
#
|
|
# Completion script for Showoff (https://github.com/schacon/showoff).
|
|
#
|
|
# ------------------------------------------------------------------------------
|
|
# Authors
|
|
# -------
|
|
#
|
|
# * Bruno Michel (https://github.com/nono)
|
|
#
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
local curcontext="$curcontext" state line cmds ret=1
|
|
|
|
_arguments -C \
|
|
'1: :->cmds' \
|
|
'*: :->args' && ret=0
|
|
|
|
case $state in
|
|
cmds)
|
|
cmds=(
|
|
'add:Add a new slide at the end in a given dir'
|
|
'new:Add a new slide at the end in a given dir'
|
|
'create:Create new showoff presentation'
|
|
'init:Create new showoff presentation'
|
|
'help:Shows list of commands or help for one command'
|
|
'heroku:Setup your presentation to serve on Heroku'
|
|
'serve:Serves the showoff presentation in the current directory'
|
|
'static:Generate static version of presentation'
|
|
)
|
|
_describe -t commands 'showoff command' cmds && ret=0
|
|
;;
|
|
args)
|
|
case $line[1] in
|
|
(add|new)
|
|
_arguments \
|
|
'(-d --dir)'{-d,--dir}'=[Slide dir (where to put a new slide file)]:directory:_files' \
|
|
'(-n --name)'{-n,--name}'=[Slide name (name of the new slide file)]:basename' \
|
|
{-s,--source}'=[Include code from the given file as the slide body]:file:_files' \
|
|
'(-t --style --type)'{-t,--style,--type}'=[Slide Type/Style (default: title)]:style' \
|
|
'(-u --no-number)'{-u,--no-number}'[Dont number the slide, use the given name verbatim]' \
|
|
'1:title' && ret=0
|
|
;;
|
|
(create|init)
|
|
_arguments \
|
|
'(-d --slidedir)'{-d,--slidedir}'=[Sample slide directory name (default: one)]:arg' \
|
|
'(-n --nosamples)'{-n,--nosamples}'=[Dont create sample slides]' \
|
|
'1:dir_name' && ret=0
|
|
;;
|
|
help)
|
|
_values 'commands' add new create init help heroku serve static && ret=0
|
|
;;
|
|
heroku)
|
|
_message 'please entrer an heroku_name' && ret=0
|
|
;;
|
|
serve)
|
|
_arguments \
|
|
'(-h --host)'{-h,--host}'=[Host or ip to run on (default: localhost)]:host' \
|
|
'(-p --port)'{-p,--port}'=[Port on which to run (default: 9090)]:port' \
|
|
'1:title' && ret=0
|
|
;;
|
|
static)
|
|
_message 'please entrer a name' && ret=0
|
|
;;
|
|
*)
|
|
(( ret )) && _message 'no more arguments'
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
|
|
return ret
|
|
|
|
# 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
|