diff options
Diffstat (limited to 'autoload/filetype')
| -rw-r--r-- | autoload/filetype/execline.kak | 333 |
1 files changed, 333 insertions, 0 deletions
diff --git a/autoload/filetype/execline.kak b/autoload/filetype/execline.kak new file mode 100644 index 0000000..8ba4d17 --- /dev/null +++ b/autoload/filetype/execline.kak @@ -0,0 +1,333 @@ +provide-module execline %& + add-highlighter shared/execline regions + + add-highlighter shared/execline/ region '#' '\n' fill comment + + add-highlighter shared/execline/sqstring region \' \' group + add-highlighter shared/execline/sqstring/ fill string + + add-highlighter shared/execline/dqstring region '"' '"' group + add-highlighter shared/execline/dqstring/ fill string + add-highlighter shared/execline/dqstring/ \ + regex (\\[\\abefhnrtv\n])|(\\.) 1:keyword 2:Error + add-highlighter shared/execline/dqstring/ \ + regex (\$\{.*?\}) 0:variable + + add-highlighter shared/execline/code default-region group + add-highlighter shared/execline/code/value \ + regex (\$\{.*?\}) 0:variable + + evaluate-commands %sh{ + # Grammar + # Generated with `compgen -k` in bash + keywords="" + s6=" + s6-accessrules-cdb-from-fs + s6-accessrules-fs-from-cdb + s6-applyuidgid + s6-cleanfifodir + s6-connlimit + s6-envdir + s6-envuidgid + s6-fdholderd + s6-fdholder-daemon + s6-fdholder-delete + s6-fdholder-getdump + s6-fdholder-list + s6-fdholder-retrieve + s6-fdholder-setdump + s6-fdholder-store + s6-fdholder-transferdump + s6-fghack + s6-ftrig-listen + s6-ftrig-listen1 + s6-ftrig-notify + s6-ftrigrd + s6-ftrig-wait + s6-instance-control + s6-instance-create + s6-instance-delete + s6-instance-list + s6-instance-maker + s6-instance-status + s6-ioconnect + s6-ipcclient + s6-ipcserver + s6-ipcserver-access + s6-ipcserverd + s6-ipcserver-socketbinder + s6-log + s6-mkfifodir + s6-notifyoncheck + s6-permafailon + s6-setlock + s6-setsid + s6-setuidgid + s6-socklog + s6-softlimit + s6-sudo + s6-sudoc + s6-sudod + s6-supervise + s6-svc + s6-svdt + s6-svdt-clear + s6-svlink + s6-svlisten + s6-svlisten1 + s6-svok + s6-svperms + s6-svscan + s6-svscanctl + s6-svstat + s6-svunlink + s6-svwait + s6-tai64n + s6-tai64nlocal + s6-usertree-maker + " + s6rc=" + s6-rc + s6-rc-bundle + s6-rc-compile + s6-rc-db + s6-rc-dryrun + s6-rc-fdholder-filler + s6-rc-format-upgrade + s6-rc-init + s6-rc-oneshot-run + s6-rc-update + " + posix=" + admin + alias + ar + asa + at + awk + basename + batch + bc + bg + c17 + cal + cat + cd + cflow + chgrp + chmod + chown + cksum + cmp + comm + command + compress + cp + crontab + csplit + ctags + cut + cxref + date + dd + delta + df + diff + dirname + du + echo + ed + env + ex + expand + expr + false + fc + fg + file + find + fold + fuser + gencat + get + getconf + getopts + gettext + grep + hash + head + iconv + id + ipcrm + ipcs + jobs + join + kill + lex + link + ln + locale + localedef + logger + logname + lp + ls + m4 + mailx + make + man + mesg + mkdir + mkfifo + more + msgfmt + mv + newgrp + ngettext + nice + nl + nm + nohup + od + paste + patch + pathchk + pax + pr + printf + prs + ps + pwd + read + readlink + realpath + renice + rm + rmdel + rmdir + sact + sccs + sed + sh + sleep + sort + split + strings + strip + stty + tabs + tail + talk + tee + test + time + timeout + touch + tput + tr + true + tsort + tty + type + ulimit + umask + unalias + uname + uncompress + unexpand + unget + uniq + unlink + uucp + uudecode + uuencode + uustat + uux + val + vi + wait + wc + what + who + write + xargs + xgettext + yacc + zcat + " + execline=" + background + backtick + case + define + dollarat + elgetopt + elgetpositionals + elglob + eltest + emptyenv + envfile + exec + execlineb + execline-cd + execline-umask + exit + export + export-array + fdblock + fdclose + fdmove + fdreserve + fdswap + forbacktickx + foreground + forstdin + forx + getcwd + getpid + heredoc + homeof + if + ifelse + ifte + ifthenelse + importas + loopwhilex + multidefine + multisubstitute + pipeline + piperw + posix-cd + posix-umask + redirfd + runblock + shift + trap + tryexec + unexport + wait + withstdinas + " + + join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; } + + # Add the language's grammar to the static completion list + printf %s\\n "declare-option str-list sh_static_words $(join "${keywords}" ' ') $(join "${execline}" ' ') $(join "${s6}" ' ') $(join "${s6rc}" ' ') $(join "${posix}" ' ')" + + # Highlight keywords + printf %s\\n "add-highlighter shared/execline/code/ regex (?<!-)\b($(join "${keywords}" '|')|$(join "${s6}" '|')|$(join "${s6rc}" '|')|$(join "${posix}" '|'))\b(?!-) 0:keyword" + + # Highlight builtins + printf %s "add-highlighter shared/execline/code/builtin regex (?<!-)\b($(join "${execline}" '|'))\b(?!-) 0:builtin" + } +& + +hook global WinSetOption filetype=execline %{ + require-module execline + + add-highlighter window/execline ref execline + + hook -once -always window WinSetOption filetype=.* %{ + remove-highlighter window/execline + } +} |
