| Bram Moolenaar | fead3ac | 2016-03-28 21:26:47 +0200 | [diff] [blame] | 1 | " When you're writing shell scripts and you are in doubt which test to use, |
| 2 | " which shell environment variables are defined, what the syntax of the case |
| 3 | " statement is, and you need to invoke 'man sh'? |
| 4 | " |
| 5 | " Your problems are over now! |
| 6 | " |
| 7 | " Attached is a Vim script file for turning gvim into a shell script editor. |
| 8 | " It may also be used as an example how to use menus in Vim. |
| 9 | " |
| Bram Moolenaar | 92f645b | 2022-02-11 13:29:40 +0000 | [diff] [blame] | 10 | " Maintainer: Ada (Haowen) Yu <me@yuhaowen.com> |
| 11 | " Original author: Lennart Schultz <les@dmi.min.dk> (mail unreachable) |
| Bram Moolenaar | fead3ac | 2016-03-28 21:26:47 +0200 | [diff] [blame] | 12 | |
| Bram Moolenaar | 92f645b | 2022-02-11 13:29:40 +0000 | [diff] [blame] | 13 | " Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise |
| 14 | " <CR> would not be recognized. See ":help 'cpoptions'". |
| 15 | let s:cpo_save = &cpo |
| 16 | set cpo&vim |
| 17 | |
| Bram Moolenaar | b529cfb | 2022-07-25 15:42:07 +0100 | [diff] [blame^] | 18 | imenu ShellMenu.Statements.for for in <CR>do<CR><CR>done<esc>ki <esc>kk0elli |
| 19 | imenu ShellMenu.Statements.case case in<CR>) ;;<CR>esac<esc>bki <esc>k0elli |
| 20 | imenu ShellMenu.Statements.if if <CR>then<CR><CR>fi<esc>ki <esc>kk0elli |
| 21 | imenu ShellMenu.Statements.if-else if <CR>then<CR><CR>else<CR><CR>fi<esc>ki <esc>kki <esc>kk0elli |
| 22 | imenu ShellMenu.Statements.elif elif <CR>then<CR><CR><esc>ki <esc>kk0elli |
| 23 | imenu ShellMenu.Statements.while while do<CR><CR>done<esc>ki <esc>kk0elli |
| 24 | imenu ShellMenu.Statements.break break |
| 25 | imenu ShellMenu.Statements.continue continue |
| 26 | imenu ShellMenu.Statements.function () {<CR><CR>}<esc>ki <esc>k0i |
| 27 | imenu ShellMenu.Statements.return return |
| 28 | imenu ShellMenu.Statements.return-true return 0 |
| 29 | imenu ShellMenu.Statements.return-false return 1 |
| 30 | imenu ShellMenu.Statements.exit exit |
| 31 | imenu ShellMenu.Statements.shift shift |
| 32 | imenu ShellMenu.Statements.trap trap |
| 33 | imenu ShellMenu.Test.Existence [ -e ]<esc>hi |
| 34 | imenu ShellMenu.Test.Existence\ -\ file [ -f ]<esc>hi |
| 35 | imenu ShellMenu.Test.Existence\ -\ file\ (not\ empty) [ -s ]<esc>hi |
| 36 | imenu ShellMenu.Test.Existence\ -\ directory [ -d ]<esc>hi |
| 37 | imenu ShellMenu.Test.Existence\ -\ executable [ -x ]<esc>hi |
| 38 | imenu ShellMenu.Test.Existence\ -\ readable [ -r ]<esc>hi |
| 39 | imenu ShellMenu.Test.Existence\ -\ writable [ -w ]<esc>hi |
| 40 | imenu ShellMenu.Test.String\ is\ empty [ x = "x$" ]<esc>hhi |
| 41 | imenu ShellMenu.Test.String\ is\ not\ empty [ x != "x$" ]<esc>hhi |
| 42 | imenu ShellMenu.Test.Strings\ are\ equal [ "" = "" ]<esc>hhhhhhhi |
| 43 | imenu ShellMenu.Test.Strings\ are\ not\ equal [ "" != "" ]<esc>hhhhhhhhi |
| 44 | imenu ShellMenu.Test.Value\ is\ greater\ than [ -gt ]<esc>hhhhhhi |
| 45 | imenu ShellMenu.Test.Value\ is\ greater\ equal [ -ge ]<esc>hhhhhhi |
| 46 | imenu ShellMenu.Test.Values\ are\ equal [ -eq ]<esc>hhhhhhi |
| 47 | imenu ShellMenu.Test.Values\ are\ not\ equal [ -ne ]<esc>hhhhhhi |
| 48 | imenu ShellMenu.Test.Value\ is\ less\ than [ -lt ]<esc>hhhhhhi |
| 49 | imenu ShellMenu.Test.Value\ is\ less\ equal [ -le ]<esc>hhhhhhi |
| 50 | imenu ShellMenu.ParmSub.Substitute\ word\ if\ parm\ not\ set ${:-}<esc>hhi |
| 51 | imenu ShellMenu.ParmSub.Set\ parm\ to\ word\ if\ not\ set ${:=}<esc>hhi |
| 52 | imenu ShellMenu.ParmSub.Substitute\ word\ if\ parm\ set\ else\ nothing ${:+}<esc>hhi |
| 53 | imenu ShellMenu.ParmSub.If\ parm\ not\ set\ print\ word\ and\ exit ${:?}<esc>hhi |
| 54 | imenu ShellMenu.SpShVars.Number\ of\ positional\ parameters ${#} |
| 55 | imenu ShellMenu.SpShVars.All\ positional\ parameters\ (quoted\ spaces) ${*} |
| 56 | imenu ShellMenu.SpShVars.All\ positional\ parameters\ (unquoted\ spaces) ${@} |
| 57 | imenu ShellMenu.SpShVars.Flags\ set ${-} |
| 58 | imenu ShellMenu.SpShVars.Return\ code\ of\ last\ command ${?} |
| 59 | imenu ShellMenu.SpShVars.Process\ number\ of\ this\ shell ${$} |
| 60 | imenu ShellMenu.SpShVars.Process\ number\ of\ last\ background\ command ${!} |
| 61 | imenu ShellMenu.Environ.HOME ${HOME} |
| 62 | imenu ShellMenu.Environ.PATH ${PATH} |
| 63 | imenu ShellMenu.Environ.CDPATH ${CDPATH} |
| 64 | imenu ShellMenu.Environ.MAIL ${MAIL} |
| 65 | imenu ShellMenu.Environ.MAILCHECK ${MAILCHECK} |
| 66 | imenu ShellMenu.Environ.PS1 ${PS1} |
| 67 | imenu ShellMenu.Environ.PS2 ${PS2} |
| 68 | imenu ShellMenu.Environ.IFS ${IFS} |
| 69 | imenu ShellMenu.Environ.SHACCT ${SHACCT} |
| 70 | imenu ShellMenu.Environ.SHELL ${SHELL} |
| 71 | imenu ShellMenu.Environ.LC_CTYPE ${LC_CTYPE} |
| 72 | imenu ShellMenu.Environ.LC_MESSAGES ${LC_MESSAGES} |
| 73 | imenu ShellMenu.Builtins.cd cd |
| 74 | imenu ShellMenu.Builtins.echo echo |
| 75 | imenu ShellMenu.Builtins.eval eval |
| 76 | imenu ShellMenu.Builtins.exec exec |
| 77 | imenu ShellMenu.Builtins.export export |
| 78 | imenu ShellMenu.Builtins.getopts getopts |
| 79 | imenu ShellMenu.Builtins.hash hash |
| 80 | imenu ShellMenu.Builtins.newgrp newgrp |
| 81 | imenu ShellMenu.Builtins.pwd pwd |
| 82 | imenu ShellMenu.Builtins.read read |
| 83 | imenu ShellMenu.Builtins.readonly readonly |
| 84 | imenu ShellMenu.Builtins.return return |
| 85 | imenu ShellMenu.Builtins.times times |
| 86 | imenu ShellMenu.Builtins.type type |
| 87 | imenu ShellMenu.Builtins.umask umask |
| 88 | imenu ShellMenu.Builtins.wait wait |
| 89 | imenu ShellMenu.Set.set set |
| 90 | imenu ShellMenu.Set.unset unset |
| 91 | imenu ShellMenu.Set.Mark\ created\ or\ modified\ variables\ for\ export set -a |
| 92 | imenu ShellMenu.Set.Exit\ when\ command\ returns\ non-zero\ status set -e |
| 93 | imenu ShellMenu.Set.Disable\ file\ name\ expansion set -f |
| 94 | imenu ShellMenu.Set.Locate\ and\ remember\ commands\ when\ being\ looked\ up set -h |
| 95 | imenu ShellMenu.Set.All\ assignment\ statements\ are\ placed\ in\ the\ environment\ for\ a\ command set -k |
| 96 | imenu ShellMenu.Set.Read\ commands\ but\ do\ not\ execute\ them set -n |
| 97 | imenu ShellMenu.Set.Exit\ after\ reading\ and\ executing\ one\ command set -t |
| 98 | imenu ShellMenu.Set.Treat\ unset\ variables\ as\ an\ error\ when\ substituting set -u |
| 99 | imenu ShellMenu.Set.Print\ shell\ input\ lines\ as\ they\ are\ read set -v |
| 100 | imenu ShellMenu.Set.Print\ commands\ and\ their\ arguments\ as\ they\ are\ executed set -x |
| Bram Moolenaar | 92f645b | 2022-02-11 13:29:40 +0000 | [diff] [blame] | 101 | |
| 102 | " Restore the previous value of 'cpoptions'. |
| 103 | let &cpo = s:cpo_save |
| 104 | unlet s:cpo_save |