Compare commits

...

6 Commits

Author SHA1 Message Date
yosh 74ce120a23 vim: some qol 2023-09-12 23:41:17 -04:00
yosh f4b4edeb66 mimix: use editor for empty files 2023-08-23 17:32:31 -04:00
yosh a262ec6780 mpv.conf: remove carriage returns 2023-08-23 17:32:02 -04:00
yosh 181764c9dd vimrc: pandoc syntax thingy 2023-08-23 17:24:17 -04:00
yosh e0b292f4f8 Merge commit '837ac35f35e36ad5f89c40090f5df80e99e6c9c7' as '.config/vim/pack/plugins/start/vim-pandoc-syntax' 2023-08-23 17:22:31 -04:00
yosh 837ac35f35 Squashed '.config/vim/pack/plugins/start/vim-pandoc-syntax/' content from commit 4268535
git-subtree-dir: .config/vim/pack/plugins/start/vim-pandoc-syntax
git-subtree-split: 4268535e1d33117a680a91160d845cd3833dfe28
2023-08-23 17:22:31 -04:00
24 changed files with 1574 additions and 858 deletions

View File

@ -3,6 +3,7 @@ TERMINAL: urxvtc
MENU: dmenu -c -l 20 -bw 4
text/: $TERMINAL -e $VISUAL --
inode/x-empty: $TERMINAL -e $VISUAL --
audio/: mpv --player-operation-mode=pseudo-gui --
video/: mpv --player-operation-mode=pseudo-gui --
image/: nsxiv-rifle --

View File

@ -1,46 +1,46 @@
# screenshots
screenshot-format=png
screenshot-high-bit-depth=yes
screenshot-png-compression=7
screenshot-directory=~/pics/screenshots
screenshot-template="%tY-%tm-%td_%tH-%tM-%tS-mpvshot-%F"
# uhhhhh video and audio shit
video-sync=display-resample
volume=90
vo=gpu
#gpu-api=vulkan
# subtitles
sub-auto=fuzzy
slang=en,ja,live_chat,rechat
sub-font-size=48
no-sub-visibility
# player behavior
keep-open
volume-max=200
no-border
geometry=50%:50%
autofit-larger=1920x900
autofit-smaller=500x500
# OSD shit
# osc=no
# osd-font="X11 Fixed"
osd-font-size=20
# osd-bar=no
cursor-autohide=2000
osd-on-seek=msg-bar
# online shit
ytdl-format=bestvideo[height<=?1080][vcodec!*=?vp9]+bestaudio/best
ytdl-raw-options=ignore-config=,sub-lang="en,ja,live_chat,rechat",write-subs=,write-auto-subs=,yes-playlist=
hls-bitrate=max
[twitch]
profile-cond=get("path", ""):find("^https://www.twitch.tv/videos/") ~= nil
profile-restore=copy-equal
sub-font-size=30
sub-align-x=right
sub-align-y=top
# screenshots
screenshot-format=png
screenshot-high-bit-depth=yes
screenshot-png-compression=7
screenshot-directory=~/pics/screenshots
screenshot-template="%tY-%tm-%td_%tH-%tM-%tS-mpvshot-%F"
# uhhhhh video and audio shit
video-sync=display-resample
volume=90
vo=gpu
#gpu-api=vulkan
# subtitles
sub-auto=fuzzy
slang=en,ja,live_chat,rechat
sub-font-size=48
no-sub-visibility
# player behavior
keep-open
volume-max=200
no-border
geometry=50%:50%
autofit-larger=1920x900
autofit-smaller=500x500
# OSD shit
# osc=no
# osd-font="X11 Fixed"
osd-font-size=20
# osd-bar=no
cursor-autohide=2000
osd-on-seek=msg-bar
# online shit
ytdl-format=bv*[height<=1080]+ba/b*
ytdl-raw-options=ignore-config=,sub-lang="en,ja,live_chat,rechat",write-subs=,write-auto-subs=,yes-playlist=
hls-bitrate=max
[twitch]
profile-cond=get("path", ""):find("^https://www.twitch.tv/videos/") ~= nil
profile-restore=copy-equal
sub-font-size=30
sub-align-x=right
sub-align-y=top

View File

@ -0,0 +1,16 @@
name: Vint
on: [push, pull_request]
jobs:
vint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Setup dependencies
run: pip install vim-vint
- name: Run Vimscript Linter
run: vint .

View File

@ -0,0 +1,5 @@
*.html
*.pdf
*.swp
tags
doc/tags

View File

@ -0,0 +1,5 @@
cmdargs:
severity: style_problem
color: true
env:
neovim: false

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2013-2019 vim-pandoc-syntax contributors
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.

View File

@ -0,0 +1,68 @@
# vim-pandoc-syntax
[![Vint](https://github.com/vim-pandoc/vim-pandoc-syntax/workflows/Vint/badge.svg)](https://github.com/vim-pandoc/vim-pandoc-syntax/actions?workflow=Vint)
Standalone pandoc syntax module, to be used alongside
[vim-pandoc](http://github.com/vim-pandoc/vim-pandoc).
Forked from the version provided by `fmoralesc/vim-pantondoc`, in turn taken
from `vim-pandoc/vim-pandoc`.
## Requirements
* A vim version with `+conceal`
* [vim-pandoc](http://github.com/vim-pandoc/vim-pandoc), to set the
`pandoc` filetype (otherwise you'll have to set it up yourself).
## Installation
The repository follows the usual bundle structure, so it's easy to install it
using [pathogen](https://github.com/tpope/vim-pathogen),
[Vundle](https://github.com/gmarik/vundle) or NeoBundle.
For Vundle users, it should be enough to add
Plugin 'vim-pandoc/vim-pandoc-syntax'
to `.vimrc`, and then run `:PluginInstall`.
For those who need it, a tarball is available from
[here](https://github.com/vim-pandoc/vim-pandoc-syntax/archive/master.zip).
### Standalone
If you want to use `vim-pandoc-syntax` without vim-pandoc, you'll need to tell
Vim to load it for certain files. Just add something like this to your vimrc:
~~~ vim
augroup pandoc_syntax
au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
augroup END
~~~
For vimwiki users, use
~~~ vim
augroup pandoc_syntax
autocmd! FileType vimwiki set syntax=markdown.pandoc
augroup END
~~~
## Features
* Supports most (if not all) pandoc's markdown features, including tables,
delimited codeblocks, references, etc.
* Can handle multiple embedded languages (LaTeX, YAML headers, many languages
in delimited codeblocks). Some commands are provided to help with this (see
`:help pandoc-syntax-commands`)
* Pretty display using `conceal` (optional).
* Configurable (see `:help pandoc-syntax-configuration` for an overview of the
options).
## Screenshots
![img1](http://i.imgur.com/UKXbG2V.png)
![img2](http://i.imgur.com/z8FpxRP.png)
![img3](http://i.imgur.com/ziNjQiE.png)
![img4](http://i.imgur.com/UKoOxzP.png)

View File

@ -0,0 +1,134 @@
" vim: set fdm=marker :
"
" file: autoload/pandoc/syntax/color.vim
" author: Felipe Morales
" version: 0.1
" description: functions to manipulate color
" Conversion: {{{1
"
" color conversion algorithms adapted from http://www.cs.rit.edu/~ncs/color/t_convert.html
function! s:RGB2HSV(r, g, b) abort "{{{2
let rp = a:r/255.0
let gp = a:g/255.0
let bp = a:b/255.0
let cmax = max([float2nr(rp*100.0), float2nr(gp*100.0), float2nr(bp*100.0)])/100.0
let cmin = min([float2nr(rp*100.0), float2nr(gp*100.0), float2nr(bp*100.0)])/100.0
let delta = cmax - cmin
let v = cmax
if cmax == 0.0
let s = 0.0
let h = -1.0
else
let s = delta/cmax
if rp == cmax
let h = (gp - bp)/ delta
elseif gp == cmax
let h = (2.0 + (bp - rp))/delta
else
let h = (4.0 + (rp - gp))/delta
endif
let h = h * 60.0
if h < 0.0
let h = h+ 360.0
endif
endif
return [h, s, v]
endfunction
function! s:HSV2RGB(h, s, v) abort "{{{2
if a:s == 0 "achromatic
return [a:v, a:v, a:v]
endif
let h = a:h/60 " sector 0 to 5
let i = floor(h)
let f = h - i
let p = a:v * ( 1 - a:s)
let q = a:v * ( 1 - a:s * f)
let t = a:v * ( 1 - a:s * (1 - f))
if i == 0
let r = a:v
let g = t
let b = p
elseif i == 1
let r = q
let g = a:v
let b = p
elseif i == 2
let r = p
let g = a:v
let b = t
elseif i == 3
let r = p
let g = q
let b = a:v
elseif i == 4
let r = t
let g = p
let b = a:v
else
let r = a:v
let g = p
let b = q
endif
return [float2nr(r*255), float2nr(g*255), float2nr(b*255)]
endfunction
function! s:Hex2RGB(hex) abort "{{{2
let hex = split(a:hex, '\zs')
let h_r = '0x'.join(hex[:1], '')
let h_g = '0x'.join(hex[2:3], '')
let h_b = '0x'.join(hex[4:6], '')
return map([h_r, h_g, h_b], 'eval(v:val)')
endfunction
function! s:RGB2Hex(r, g, b) abort "{{{2
let h_r = printf('%02x', a:r)
let h_g = printf('%02x', a:g)
let h_b = printf('%02x', a:b)
return join([h_r, h_g, h_b], '')
endfunction
" Instrospection: {{{1
function! pandoc#syntax#color#Instrospect(group) abort
redir => hi_output
exe 'silent hi '. a:group
redir END
let hi_output = split(hi_output, '\n')[0]
let parts = split(hi_output, '\s\+')[2:]
if parts[0] ==# 'links'
let info = Hi_Info(parts[2])
let info['linked_to'] = parts[2]
else
let info = {}
for i in parts
let data = split(i, '=')
let info[data[0]] = data[1]
endfor
endif
return info
endfunction
" Palette: {{{1
function! pandoc#syntax#color#SaturationPalette(hex, partitions) abort
let rgb = s:Hex2RGB(a:hex)
let hsv = s:RGB2HSV(rgb[0], rgb[1], rgb[2])
let hsv_palette = []
for i in range(1, a:partitions)
let s = 1.0/a:partitions * i " linear
call add(hsv_palette, [hsv[0], s, hsv[2]])
endfor
let rgb_palette = []
for hsv in hsv_palette
call add(rgb_palette, s:HSV2RGB(hsv[0], hsv[1], hsv[2]))
endfor
let hex_palette = []
for rgb in rgb_palette
call add(hex_palette, s:RGB2Hex(rgb[0], rgb[1], rgb[2]))
endfor
return hex_palette
endfunction

View File

@ -0,0 +1,138 @@
*vim-pandoc-syntax*
*pandoc-syntax*
OVERVIEW
vim-pandoc-syntax is a standalone syntax file for highlighting pandoc flavored
markdown documents, to be used alongside vim-pandoc (see |pandoc|). It is
based on the version once provided by vim-pandoc-legacy, which it obsoletes.
The project resides at http://www.github.com/vim-pandoc/vim-pandoc-syntax. You
are welcome to help, suggest ideas, report bugs or contribute code.
CONFIGURATION *vim-pandoc-syntax-configuration*
+ *g:pandoc#syntax#conceal#use*
Use |conceal| for pretty highlighting. Default is 1 for vim version > 7.3
+ *g:pandoc#syntax#conceal#blacklist* A list of rules |conceal| should not be
used with. Works as a blacklist, and defaults to [] (use conceal everywhere).
This is a list of the rules wich can be used here:
- titleblock
- image
- block
- subscript
- superscript
- strikeout
- atx
- codeblock_start
- codeblock_delim
- footnote
- definition
- list
- newline
- dashes
- ellipses
- quotes
- inlinecode
- inlinemath
To review what are the rules for, look for the call to |s:WithConceal| in
syntax/pandoc.vim that takes the corresponding rulename as first argument.
+ *g:pandoc#syntax#conceal#cchar_overrides*
A dictionary of what characters should be used in conceal rules. These
override the defaults (see those in |s:cchars|). For example, if you prefer
to mark footnotes with the `*` symbol:
let g:pandoc#syntax#conceal#cchar_overrides = {"footnote" : "*"}
+ *g:pandoc#syntax#conceal#urls*
Conceal the urls in links.
+ *g:pandoc#syntax#codeblocks#ignore*
Prevent highlighting specific codeblock types so that they remain Normal.
Codeblock types include 'definition' for codeblocks inside definition blocks
and 'delimited' for delimited codeblocks. Default = []
+ *g:pandoc#syntax#codeblocks#embeds#use*
Use embedded highlighting for delimited codeblocks where a language is
specified. Default = 1
+ *g:pandoc#syntax#codeblocks#embeds#langs*
For what languages and using what syntax files to highlight embeds. This is
a list of language names. When the language pandoc and vim use don't match,
you can use the "PANDOC=VIM" syntax. For example:
let g:pandoc#syntax#codeblocks#embeds#langs = ["ruby",
"literatehaskell=lhaskell", "bash=sh"]
+ *g:pandoc#syntax#style#emphases*
Use italics and strong in emphases. Default = 1
0 will add "block" to |g:pandoc#syntax#conceal#blacklist|, because otherwise
you couldn't tell where the styles are applied.
+ *g:pandoc#syntax#style#underline_special*
Underline subscript, superscript and strikeout text styles. Default = 1
+ *g:pandoc#syntax#style#use_definition_lists*
Detect and highlight definition lists. Disabling this can improve
performance. Default = 1 (i.e., enabled by default)
COMMANDS *pandoc-syntax-commands*
+ *:PandocHighlight* LANG
Enable embedded highlighting for language LANG in codeblocks. Uses the
syntax for items in |g:pandoc#syntax#codeblocks#embeds#langs|.
+ *:PandocUnhighlight* LANG
Disable embedded highlighting for language LANG in codeblocks.
FUNCTIONS *pandoc-syntax-functions*
+ *EnableEmbedsForCodeblocksWithLang(langname)*
As |:PandocHighlight|.
+ *DisableEmbedsForCodeblocksWithLang(langname)*
As |:PandocUnhighlight|.
+ *s:WithConceal(RULE_GROUP,RULE,CONCEAL_RULE)*
Executes a |:syntax| command RULE, which could incorporate conceal rules
(CONCEAL_RULE) if conceals are enabled. The rule gets named RULE_GROUP,
as used in |g:pandoc#syntax#conceal#blacklist|.
For example, if conceals are enabled
call s:WithConceal("atx", 'syn match AtxStart /#/ contained
containedin=pandocAtxHeader', 'conceal cchar='.s:cchars["atx"])
will execute
syn match AtxStart /#/ contained containedin=pandocAtxHeader conceal cchar=§
and
syn match AtxStart /#/ contained containedin=pandocAtxHeader
otherwise.
TODO
This is a list of know stuff missing from the syntax file.
1. Highlight code within verbatim text when a language is specified in the attrib,
like in
hey, `print 1 + 3`.{python} is no longer valid in python 3.
MISC
The plugin sets a global variable, *g:vim_pandoc_syntax_exists* to indicate its
existence. This is currently used by vim-pandoc to switch between syntax
assisted and basic folding rules.

View File

@ -0,0 +1 @@
let g:vim_pandoc_syntax_exists = 1

View File

@ -0,0 +1,5 @@
" vim: set fdm=marker:
" Pandoc: {{{1
" load vim-pandoc-syntax {{{2
runtime syntax/pandoc.vim

View File

@ -0,0 +1,714 @@
scriptencoding utf-8
" vim: set fdm=marker foldlevel=0:
"
" Vim syntax file
"
" Language: Pandoc (superset of Markdown)
" Maintainer: Felipe Morales <hel.sheep@gmail.com>
" Maintainer: Caleb Maclennan <caleb@alerque.com>
" Contributor: David Sanson <dsanson@gmail.com>
" Contributor: Jorge Israel Peña <jorge.israel.p@gmail.com>
" OriginalAuthor: Jeremy Schultz <taozhyn@gmail.com>
" Version: 5.0
" Configuration: {{{1
"
" use conceal? {{{2
if !exists('g:pandoc#syntax#conceal#use')
if v:version < 703
let g:pandoc#syntax#conceal#use = 0
else
let g:pandoc#syntax#conceal#use = 1
endif
else
" exists, but we cannot use it, disable anyway
if v:version < 703
let g:pandoc#syntax#conceal#use = 0
endif
endif
"}}}2
" what groups not to use conceal in. works as a blacklist {{{2
if !exists('g:pandoc#syntax#conceal#blacklist')
let g:pandoc#syntax#conceal#blacklist = []
endif
" }}}2
" cchars used in conceal rules {{{2
" utf-8 defaults (preferred)
if &encoding ==# 'utf-8'
let s:cchars = {
\'newline': '↵',
\'image': '▨',
\'super': 'ⁿ',
\'sub': 'ₙ',
\'strike': 'x̶',
\'atx': '§',
\'codelang': 'λ',
\'codeend': '—',
\'abbrev': '→',
\'footnote': '†',
\'definition': ' ',
\'li': '•',
\'html_c_s': '',
\'html_c_e': '',
\'quote_s': '“',
\'quote_e': '”'}
else
" ascii defaults
let s:cchars = {
\'newline': ' ',
\'image': 'i',
\'super': '^',
\'sub': '_',
\'strike': '~',
\'atx': '#',
\'codelang': 'l',
\'codeend': '-',
\'abbrev': 'a',
\'footnote': 'f',
\'definition': ' ',
\'li': '*',
\'html_c_s': '+',
\'html_c_e': '+'}
endif
" }}}2
" if the user has a dictionary with replacements for the default cchars, use those {{{2
if exists('g:pandoc#syntax#conceal#cchar_overrides')
let s:cchars = extend(s:cchars, g:pandoc#syntax#conceal#cchar_overrides)
endif
" }}}2
"should the urls in links be concealed? {{{2
if !exists('g:pandoc#syntax#conceal#urls')
let g:pandoc#syntax#conceal#urls = 0
endif
" should backslashes in escapes be concealed? {{{2
if !exists('g:pandoc#syntax#conceal#backslash')
let g:pandoc#syntax#conceal#backslash = 0
endif
" }}}2
" leave specified codeblocks as Normal (i.e. 'unhighlighted') {{{2
if !exists('g:pandoc#syntax#codeblocks#ignore')
let g:pandoc#syntax#codeblocks#ignore = []
endif
" }}}2
" use embedded highlighting for delimited codeblocks where a language is specifed. {{{2
if !exists('g:pandoc#syntax#codeblocks#embeds#use')
let g:pandoc#syntax#codeblocks#embeds#use = 1
endif
" }}}2
" for what languages and using what vim syntax files highlight those embeds. {{{2
" defaults to None.
if !exists('g:pandoc#syntax#codeblocks#embeds#langs')
let g:pandoc#syntax#codeblocks#embeds#langs = []
endif
" }}}2
" use italics ? {{{2
if !exists('g:pandoc#syntax#style#emphases')
let g:pandoc#syntax#style#emphases = 1
endif
" if 0, we don't conceal the emphasis marks, otherwise there wouldn't be a way
" to tell where the styles apply.
if g:pandoc#syntax#style#emphases == 0
call add(g:pandoc#syntax#conceal#blacklist, 'block')
endif
" }}}2
" underline subscript, superscript and strikeout? {{{2
if !exists('g:pandoc#syntax#style#underline_special')
let g:pandoc#syntax#style#underline_special = 1
endif
" }}}2
" protect code blocks? {{{2
if !exists('g:pandoc#syntax#protect#codeblocks')
let g:pandoc#syntax#protect#codeblocks = 1
endif
" }}}2
" use color column? {{{2
if !exists('g:pandoc#syntax#colorcolumn')
let g:pandoc#syntax#colorcolumn = 0
endif
" }}}2
" highlight new lines? {{{2
if !exists('g:pandoc#syntax#newlines')
let g:pandoc#syntax#newlines = 1
endif
" }}}
" detect roman-numeral list items? {{{2
if !exists('g:pandoc#syntax#roman_lists')
let g:pandoc#syntax#roman_lists = 0
endif
" }}}2
" disable syntax highlighting for definition lists? (better performances) {{{2
if !exists('g:pandoc#syntax#use_definition_lists')
let g:pandoc#syntax#use_definition_lists = 1
endif
" }}}2
" }}}1
" Functions: {{{1
" EnableEmbedsforCodeblocksWithLang {{{2
function! EnableEmbedsforCodeblocksWithLang(entry)
" prevent embedded language syntaxes from changing 'foldmethod'
if has('folding')
let s:foldmethod = &l:foldmethod
let s:foldtext = &l:foldtext
endif
try
let s:langname = matchstr(a:entry, '^[^=]*')
let s:langsyntaxfile = matchstr(a:entry, '[^=]*$')
unlet! b:current_syntax
exe 'syn include @'.toupper(s:langname).' syntax/'.s:langsyntaxfile.'.vim'
" We might have just turned off spellchecking by including the file,
" so we turn it back on here.
exe 'syntax spell toplevel'
exe 'syn region pandocDelimitedCodeBlock_' . s:langname . ' start=/\(\_^\( \+\|\t\)\=\(`\{3,}`*\|\~\{3,}\~*\)\s*\%({[^.]*\.\)\=' . s:langname . '\>.*\n\)\@<=\_^/' .
\' end=/\_$\n\(\( \+\|\t\)\=\(`\{3,}`*\|\~\{3,}\~*\)\_$\n\_$\)\@=/ contained containedin=pandocDelimitedCodeBlock' .
\' contains=@' . toupper(s:langname)
exe 'syn region pandocDelimitedCodeBlockinBlockQuote_' . s:langname . ' start=/>\s\(`\{3,}`*\|\~\{3,}\~*\)\s*\%({[^.]*\.\)\=' . s:langname . '\>/' .
\ ' end=/\(`\{3,}`*\|\~\{3,}\~*\)/ contained containedin=pandocDelimitedCodeBlock' .
\' contains=@' . toupper(s:langname) .
\',pandocDelimitedCodeBlockStart,pandocDelimitedCodeBlockEnd,pandodDelimitedCodeblockLang,pandocBlockQuoteinDelimitedCodeBlock'
catch /E484/
echo "No syntax file found for '" . s:langsyntaxfile . "'"
endtry
if exists('s:foldmethod') && s:foldmethod !=# &l:foldmethod
let &l:foldmethod = s:foldmethod
endif
if exists('s:foldtext') && s:foldtext !=# &l:foldtext
let &l:foldtext = s:foldtext
endif
endfunction
" }}}2
" DisableEmbedsforCodeblocksWithLang {{{2
function! DisableEmbedsforCodeblocksWithLang(langname)
try
exe 'syn clear pandocDelimitedCodeBlock_'.a:langname
exe 'syn clear pandocDelimitedCodeBlockinBlockQuote_'.a:langname
catch /E28/
echo "No existing highlight definitions found for '" . a:langname . "'"
endtry
endfunction
" }}}2
" WithConceal {{{2
function! s:WithConceal(rule_group, rule, conceal_rule)
let l:rule_tail = ''
if g:pandoc#syntax#conceal#use != 0
if index(g:pandoc#syntax#conceal#blacklist, a:rule_group) == -1
let l:rule_tail = ' ' . a:conceal_rule
endif
endif
execute a:rule . l:rule_tail
endfunction
" }}}2
" }}}1
" Commands: {{{1
command! -buffer -nargs=1 -complete=syntax PandocHighlight call EnableEmbedsforCodeblocksWithLang(<f-args>)
command! -buffer -nargs=1 -complete=syntax PandocUnhighlight call DisableEmbedsforCodeblocksWithLang(<f-args>)
" }}}1
" BASE:
syntax clear
syntax spell toplevel
" apply extra settings: {{{1
if g:pandoc#syntax#colorcolumn == 1
exe 'setlocal colorcolumn='.string(&textwidth+5)
elseif g:pandoc#syntax#colorcolumn == 2
exe 'setlocal colorcolumn='.join(range(&textwidth+5, 2*&columns), ',')
endif
if g:pandoc#syntax#conceal#use != 0
setlocal conceallevel=2
endif
" }}}1
" Syntax Rules: {{{1
" Embeds: {{{2
" prevent embedded language syntaxes from changing 'foldmethod'
if has('folding')
let s:foldmethod = &l:foldmethod
endif
" HTML: {{{3
" Set embedded HTML highlighting
syn include @HTML syntax/html.vim
syn match pandocHTML /<\/\?\a\_.\{-}>/ contains=@HTML
" Support HTML multi line comments
syn region pandocHTMLComment start=/<!--\s\=/ end=/\s\=-->/ keepend contains=pandocHTMLCommentStart,pandocHTMLCommentEnd
call s:WithConceal('html_c_s', 'syn match pandocHTMLCommentStart /<!--/ contained', 'conceal cchar='.s:cchars['html_c_s'])
call s:WithConceal('html_c_e', 'syn match pandocHTMLCommentEnd /-->/ contained', 'conceal cchar='.s:cchars['html_c_e'])
" }}}3
" LaTeX: {{{3
" Set embedded LaTex (pandoc extension) highlighting
" Unset current_syntax so the 2nd include will work
unlet b:current_syntax
syn include @LATEX syntax/tex.vim
if index(g:pandoc#syntax#conceal#blacklist, 'inlinemath') == -1
" Can't use WithConceal here because it will mess up all other conceals
" when dollar signs are used normally. It must be skipped entirely if
" inlinemath is blacklisted
syn region pandocLaTeXInlineMath start=/\v\\@<!\$\S@=/ end=/\v\\@<!\$\d@!/ keepend contains=@LATEX
syn region pandocLaTeXInlineMath start=/\\\@<!\\(/ end=/\\\@<!\\)/ keepend contains=@LATEX
endif
syn match pandocEscapedDollar /\\\$/ conceal cchar=$
syn match pandocProtectedFromInlineLaTeX /\\\@<!\${.*}\(\(\s\|[[:punct:]]\)\([^$]*\|.*\(\\\$.*\)\{2}\)\n\n\|$\)\@=/ display
" contains=@LATEX
syn region pandocLaTeXMathBlock start=/\$\$/ end=/\$\$/ keepend contains=@LATEX
syn region pandocLaTeXMathBlock start=/\\\@<!\\\[/ end=/\\\@<!\\\]/ keepend contains=@LATEX
syn match pandocLaTeXCommand /\\[[:alpha:]]\+\(\({.\{-}}\)\=\(\[.\{-}\]\)\=\)*/ contains=@LATEX
syn region pandocLaTeXRegion start=/\\begin{\z(.\{-}\)}/ end=/\\end{\z1}/ keepend contains=@LATEX
" we rehighlight sectioning commands, because otherwise tex.vim captures all text until EOF or a new sectioning command
syn region pandocLaTexSection start=/\\\(part\|chapter\|\(sub\)\{,2}section\|\(sub\)\=paragraph\)\*\=\(\[.*\]\)\={/ end=/\}/ keepend
syn match pandocLaTexSectionCmd /\\\(part\|chapter\|\(sub\)\{,2}section\|\(sub\)\=paragraph\)/ contained containedin=pandocLaTexSection
syn match pandocLaTeXDelimiter /[[\]{}]/ contained containedin=pandocLaTexSection
" }}}3
if exists('s:foldmethod') && s:foldmethod !=# &l:foldmethod
let &l:foldmethod = s:foldmethod
endif
" }}}2
" Titleblock: {{{2
syn region pandocTitleBlock start=/\%^%/ end=/\n\n/ contains=pandocReferenceLabel,pandocReferenceURL,pandocNewLine
call s:WithConceal('titleblock', 'syn match pandocTitleBlockMark /%\ / contained containedin=pandocTitleBlock,pandocTitleBlockTitle', 'conceal')
syn match pandocTitleBlockTitle /\%^%.*\n/ contained containedin=pandocTitleBlock
" }}}2
" Blockquotes: {{{2
syn match pandocBlockQuote /^\s\{,3}>.*\n\(.*\n\@1<!\n\)*/ contains=@Spell,pandocEmphasis,pandocStrong,pandocPCite,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocUListItem,pandocNoFormatted,pandocAmpersandEscape,pandocLaTeXInlineMath,pandocEscapedDollar,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXRegion skipnl
syn match pandocBlockQuoteMark /\_^\s\{,3}>/ contained containedin=pandocEmphasis,pandocStrong,pandocPCite,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocUListItem,pandocNoFormatted
" }}}2
" Code Blocks: {{{2
if g:pandoc#syntax#protect#codeblocks == 1
syn match pandocCodeblock /\([ ]\{4}\|\t\).*$/
endif
syn region pandocCodeBlockInsideIndent start=/\(\(\d\|\a\|*\).*\n\)\@<!\(^\(\s\{8,}\|\t\+\)\).*\n/ end=/.\(\n^\s*\n\)\@=/ contained
" }}}2
" Links: {{{2
" Base: {{{3
syn region pandocReferenceLabel matchgroup=pandocOperator start=/!\{,1}\\\@<!\^\@<!\[/ skip=/\(\\\@<!\]\]\@=\|`.*\\\@<!].*`\)/ end=/\\\@<!\]/ keepend display
if g:pandoc#syntax#conceal#urls == 1
syn region pandocReferenceURL matchgroup=pandocOperator start=/\]\@1<=(/ end=/)/ keepend conceal
else
syn region pandocReferenceURL matchgroup=pandocOperator start=/\]\@1<=(/ end=/)/ keepend
endif
" let's not consider "a [label] a" as a label, remove formatting - Note: breaks implicit links
syn match pandocNoLabel /\]\@1<!\(\s\{,3}\|^\)\[[^\[\]]\{-}\]\(\s\+\|$\)[\[(]\@!/ contains=pandocPCite
syn match pandocLinkTip /\s*".\{-}"/ contained containedin=pandocReferenceURL contains=@Spell,pandocAmpersandEscape display
call s:WithConceal('image', 'syn match pandocImageIcon /!\[\@=/ display', 'conceal cchar='. s:cchars['image'])
" }}}3
" Definitions: {{{3
syn region pandocReferenceDefinition start=/\[.\{-}\]:/ end=/\(\n\s*".*"$\|$\)/ keepend
syn match pandocReferenceDefinitionLabel /\[\zs.\{-}\ze\]:/ contained containedin=pandocReferenceDefinition display
syn match pandocReferenceDefinitionAddress /:\s*\zs.*/ contained containedin=pandocReferenceDefinition
syn match pandocReferenceDefinitionTip /\s*".\{-}"/ contained containedin=pandocReferenceDefinition,pandocReferenceDefinitionAddress contains=@Spell,pandocAmpersandEscape
" }}}3
" Automatic_links: {{{3
syn match pandocAutomaticLink /<\(https\{0,1}.\{-}\|[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~.]\{-}@[A-Za-z0-9\-]\{-}\.\w\{-}\)>/ contains=NONE
" }}}3
" }}}2
" Citations: {{{2
" parenthetical citations
syn match pandocPCite "\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*.\{-}\]" contains=pandocEmphasis,pandocStrong,pandocLatex,pandocCiteKey,@Spell,pandocAmpersandEscape display
" in-text citations with location
syn match pandocICite "@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\s\[.\{-1,}\]" contains=pandocCiteKey,@Spell display
" cite keys
syn match pandocCiteKey /\(-\=@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\)/ containedin=pandocPCite,pandocICite contains=@NoSpell display
syn match pandocCiteAnchor /[-@]/ contained containedin=pandocCiteKey display
syn match pandocCiteLocator /[\[\]]/ contained containedin=pandocPCite,pandocICite
" }}}2
" Text Styles: {{{2
" Emphasis: {{{3
call s:WithConceal('block', 'syn region pandocEmphasis matchgroup=pandocOperator start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\*\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell,pandocNoFormattedInEmphasis,pandocLatexInlineMath,pandocAmpersandEscape', 'concealends')
call s:WithConceal('block', 'syn region pandocEmphasis matchgroup=pandocOperator start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@1<=_\([[:punct:]]\|\s\|\_$\)\@=/ contains=@Spell,pandocNoFormattedInEmphasis,pandocLatexInlineMath,pandocAmpersandEscape', 'concealends')
" }}}3
" Strong: {{{3
call s:WithConceal('block', 'syn region pandocStrong matchgroup=pandocOperator start=/\(\\\@<!\*\)\{2}/ end=/\(\\\@<!\*\)\{2}/ contains=@Spell,pandocNoFormattedInStrong,pandocLatexInlineMath,pandocAmpersandEscape', 'concealends')
call s:WithConceal('block', 'syn region pandocStrong matchgroup=pandocOperator start=/__/ end=/__/ contains=@Spell,pandocNoFormattedInStrong,pandocLatexInlineMath,pandocAmpersandEscape', 'concealends')
" }}}3
" Strong Emphasis: {{{3
call s:WithConceal('block', 'syn region pandocStrongEmphasis matchgroup=pandocOperator start=/\*\{3}\(\S[^*]*\(\*\S\|\n[^*]*\*\S\)\)\@=/ end=/\S\@<=\*\{3}/ contains=@Spell,pandocAmpersandEscape', 'concealends')
call s:WithConceal('block', 'syn region pandocStrongEmphasis matchgroup=pandocOperator start=/\(___\)\S\@=/ end=/\S\@<=___/ contains=@Spell,pandocAmpersandEscape', 'concealends')
" }}}3
" Mixed: {{{3
call s:WithConceal('block', 'syn region pandocStrongInEmphasis matchgroup=pandocOperator start=/\*\*/ end=/\*\*/ contained containedin=pandocEmphasis contains=@Spell,pandocAmpersandEscape', 'concealends')
call s:WithConceal('block', 'syn region pandocStrongInEmphasis matchgroup=pandocOperator start=/__/ end=/__/ contained containedin=pandocEmphasis contains=@Spell,pandocAmpersandEscape', 'concealends')
call s:WithConceal('block', 'syn region pandocEmphasisInStrong matchgroup=pandocOperator start=/\\\@1<!\(\_^\|\s\|[[:punct:]]\)\@<=\*\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=\*\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=pandocStrong contains=@Spell,pandocAmpersandEscape', 'concealends')
call s:WithConceal('block', 'syn region pandocEmphasisInStrong matchgroup=pandocOperator start=/\\\@<!\(\_^\|\s\|[[:punct:]]\)\@<=_\S\@=/ skip=/\(\*\*\|__\)/ end=/\S\@<=_\([[:punct:]]\|\s\|\_$\)\@=/ contained containedin=pandocStrong contains=@Spell,pandocAmpersandEscape', 'concealends')
" }}}3
" Inline Code: {{{3
" Using single back ticks
call s:WithConceal('inlinecode', 'syn region pandocNoFormatted matchgroup=pandocOperator start=/\\\@<!`/ end=/\\\@<!`/ nextgroup=pandocNoFormattedAttrs', 'concealends')
call s:WithConceal('inlinecode', 'syn region pandocNoFormattedInEmphasis matchgroup=pandocOperator start=/\\\@<!`/ end=/\\\@<!`/ nextgroup=pandocNoFormattedAttrs contained', 'concealends')
call s:WithConceal('inlinecode', 'syn region pandocNoFormattedInStrong matchgroup=pandocOperator start=/\\\@<!`/ end=/\\\@<!`/ nextgroup=pandocNoFormattedAttrs contained', 'concealends')
" Using double back ticks
call s:WithConceal('inlinecode', 'syn region pandocNoFormatted matchgroup=pandocOperator start=/\\\@<!``/ end=/\\\@<!``/ nextgroup=pandocNoFormattedAttrs', 'concealends')
call s:WithConceal('inlinecode', 'syn region pandocNoFormattedInEmphasis matchgroup=pandocOperator start=/\\\@<!``/ end=/\\\@<!``/ nextgroup=pandocNoFormattedAttrs contained', 'concealends')
call s:WithConceal('inlinecode', 'syn region pandocNoFormattedInStrong matchgroup=pandocOperator start=/\\\@<!``/ end=/\\\@<!``/ nextgroup=pandocNoFormattedAttrs contained', 'concealends')
syn match pandocNoFormattedAttrs /{.\{-}}/ contained
" }}}3
" Subscripts: {{{3
syn region pandocSubscript start=/\~\(\([[:graph:]]\(\\ \)\=\)\{-}\~\)\@=/ end=/\~/ keepend
call s:WithConceal('subscript', 'syn match pandocSubscriptMark /\~/ contained containedin=pandocSubscript', 'conceal cchar='.s:cchars['sub'])
" }}}3
" Superscript: {{{3
syn region pandocSuperscript start=/\^\(\([[:graph:]]\(\\ \)\=\)\{-}\^\)\@=/ skip=/\\ / end=/\^/ keepend
call s:WithConceal('superscript', 'syn match pandocSuperscriptMark /\^/ contained containedin=pandocSuperscript', 'conceal cchar='.s:cchars['super'])
" }}}3
" Strikeout: {{{3
syn region pandocStrikeout start=/\~\~/ end=/\~\~/ contains=@Spell,pandocAmpersandEscape keepend
call s:WithConceal('strikeout', 'syn match pandocStrikeoutMark /\~\~/ contained containedin=pandocStrikeout', 'conceal cchar='.s:cchars['strike'])
" }}}3
" }}}2
" Headers: {{{2
syn match pandocAtxHeader /\(\%^\|<.\+>.*\n\|^\s*\n\)\@<=#\{1,6}.*\n/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape,pandocReferenceLabel,pandocReferenceURL display
syn match pandocAtxHeaderMark /\(^#\{1,6}\|\\\@<!#\+\(\s*.*$\)\@=\)/ contained containedin=pandocAtxHeader
call s:WithConceal('atx', 'syn match pandocAtxStart /#/ contained containedin=pandocAtxHeaderMark', 'conceal cchar='.s:cchars['atx'])
syn match pandocSetexHeader /^.\+\n[=]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape
syn match pandocSetexHeader /^.\+\n[-]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,@Spell,pandocAmpersandEscape
syn match pandocHeaderAttr /{.*}/ contained containedin=pandocAtxHeader,pandocSetexHeader
syn match pandocHeaderID /#[-_:.[:lower:][:upper:]]*/ contained containedin=pandocHeaderAttr
" }}}2
" Line Blocks: {{{2
syn region pandocLineBlock start=/^|/ end=/\(^|\(.*\n|\@!\)\@=.*\)\@<=\n/ transparent
syn match pandocLineBlockDelimiter /^|/ contained containedin=pandocLineBlock
" }}}2
" Tables: {{{2
" Simple: {{{3
syn region pandocSimpleTable start=/\%#=2\(^.*[[:graph:]].*\n\)\@<!\(^.*[[:graph:]].*\n\)\(-\{2,}\s*\)\+\n\n\@!/ end=/\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocDelimitedCodeBlockStart,pandocYAMLHeader keepend
syn match pandocSimpleTableDelims /\-/ contained containedin=pandocSimpleTable
syn match pandocSimpleTableHeader /\%#=2\(^.*[[:graph:]].*\n\)\@<!\(^.*[[:graph:]].*\n\)/ contained containedin=pandocSimpleTable
syn region pandocTable start=/\%#=2^\(-\{2,}\s*\)\+\n\n\@!/ end=/\%#=2^\(-\{2,}\s*\)\+\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend
syn match pandocTableDelims /\-/ contained containedin=pandocTable
syn region pandocTableMultilineHeader start=/\%#=2\(^-\{2,}\n\)\@<=./ end=/\%#=2\n-\@=/ contained containedin=pandocTable
" }}}3
" Grid: {{{3
syn region pandocGridTable start=/\%#=2\n\@1<=+-/ end=/+\n\n/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend
syn match pandocGridTableDelims /[\|=]/ contained containedin=pandocGridTable
syn match pandocGridTableDelims /\%#=2\([\-+][\-+=]\@=\|[\-+=]\@1<=[\-+]\)/ contained containedin=pandocGridTable
syn match pandocGridTableHeader /\%#=2\(^.*\n\)\(+=.*\)\@=/ contained containedin=pandocGridTable
" }}}3
" Pipe: {{{3
" with beginning and end pipes
syn region pandocPipeTable start=/\%#=2\([+|]\n\)\@<!\n\@1<=|\(.*|\)\@=/ end=/|.*\n\(\n\|{\)/ containedin=ALLBUT,pandocDelimitedCodeBlock,pandocYAMLHeader keepend
" without beginning and end pipes
syn region pandocPipeTable start=/\%#=2^.*\n-.\{-}|/ end=/|.*\n\n/ keepend
syn match pandocPipeTableDelims /[\|\-:+]/ contained containedin=pandocPipeTable
syn match pandocPipeTableHeader /\(^.*\n\)\(|-\)\@=/ contained containedin=pandocPipeTable
syn match pandocPipeTableHeader /\(^.*\n\)\(-\)\@=/ contained containedin=pandocPipeTable
" }}}3
syn match pandocTableHeaderWord /\<.\{-}\>/ contained containedin=pandocGridTableHeader,pandocPipeTableHeader contains=@Spell
" }}}2
" Delimited Code Blocks: {{{2
" this is here because we can override strikeouts and subscripts
syn region pandocDelimitedCodeBlock start=/^\(>\s\)\?\z(\([ ]\+\|\t\)\=\~\{3,}\~*\)/ end=/^\z1\~*/ skipnl contains=pandocDelimitedCodeBlockStart,pandocDelimitedCodeBlockEnd keepend
syn region pandocDelimitedCodeBlock start=/^\(>\s\)\?\z(\([ ]\+\|\t\)\=`\{3,}`*\)/ end=/^\z1`*/ skipnl contains=pandocDelimitedCodeBlockStart,pandocDelimitedCodeBlockEnd keepend
call s:WithConceal('codeblock_start', 'syn match pandocDelimitedCodeBlockStart /\(\(\_^\n\_^\|\%^\)\(>\s\)\?\( \+\|\t\)\=\)\@<=\(\~\{3,}\~*\|`\{3,}`*\)/ contained containedin=pandocDelimitedCodeBlock nextgroup=pandocDelimitedCodeBlockLanguage', 'conceal cchar='.s:cchars['codelang'])
syn match pandocDelimitedCodeBlockLanguage /\(\s\?\)\@<=.\+\(\_$\)\@=/ contained
call s:WithConceal('codeblock_delim', 'syn match pandocDelimitedCodeBlockEnd /\(`\{3,}`*\|\~\{3,}\~*\)\(\_$\n\(>\s\)\?\_$\)\@=/ contained containedin=pandocDelimitedCodeBlock', 'conceal cchar='.s:cchars['codeend'])
syn match pandocBlockQuoteinDelimitedCodeBlock '^>' contained containedin=pandocDelimitedCodeBlock
syn match pandocCodePre /<pre>.\{-}<\/pre>/ skipnl
syn match pandocCodePre /<code>.\{-}<\/code>/ skipnl
" enable highlighting for embedded region in codeblocks if there exists a
" g:pandoc#syntax#codeblocks#embeds#langs *list*.
"
" entries in this list are the language code interpreted by pandoc,
" if this differs from the name of the vim syntax file, append =vimname
" e.g. let g:pandoc#syntax#codeblocks#embeds#langs = ["haskell", "literatehaskell=lhaskell"]
"
if g:pandoc#syntax#codeblocks#embeds#use != 0
for l in g:pandoc#syntax#codeblocks#embeds#langs
call EnableEmbedsforCodeblocksWithLang(l)
endfor
endif
" }}}2
" Abbreviations: {{{2
syn region pandocAbbreviationDefinition start=/^\*\[.\{-}\]:\s*/ end='$' contains=pandocNoFormatted,@Spell,pandocAmpersandEscape
call s:WithConceal('abbrev', 'syn match pandocAbbreviationSeparator /:/ contained containedin=pandocAbbreviationDefinition', 'conceal cchar='.s:cchars['abbrev'])
syn match pandocAbbreviation /\*\[.\{-}\]/ contained containedin=pandocAbbreviationDefinition
call s:WithConceal('abbrev', 'syn match pandocAbbreviationHead /\*\[/ contained containedin=pandocAbbreviation', 'conceal')
call s:WithConceal('abbrev', 'syn match pandocAbbreviationTail /\]/ contained containedin=pandocAbbreviation', 'conceal')
" }}}2
" Footnotes: {{{2
" we put these here not to interfere with superscripts.
syn match pandocFootnoteID /\[\^[^\]]\+\]/ nextgroup=pandocFootnoteDef
" Inline footnotes
syn region pandocFootnoteDef start=/\^\[/ skip=/\[.\{-}]/ end=/\]/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocStrongEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocEllipses,pandocBeginQuote,pandocEndQuote,@Spell,pandocAmpersandEscape skipnl keepend
call s:WithConceal('footnote', 'syn match pandocFootnoteDefHead /\^\[/ contained containedin=pandocFootnoteDef', 'conceal cchar='.s:cchars['footnote'])
call s:WithConceal('footnote', 'syn match pandocFootnoteDefTail /\]/ contained containedin=pandocFootnoteDef', 'conceal')
" regular footnotes
syn region pandocFootnoteBlock start=/\[\^.\{-}\]:\s*\n*/ end=/^\n^\s\@!/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocNewLine,pandocStrongEmphasis,pandocEllipses,pandocBeginQuote,pandocEndQuote,pandocLaTeXInlineMath,pandocEscapedDollar,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXRegion,pandocAmpersandEscape,@Spell skipnl
syn match pandocFootnoteBlockSeparator /:/ contained containedin=pandocFootnoteBlock
syn match pandocFootnoteID /\[\^.\{-}\]/ contained containedin=pandocFootnoteBlock
call s:WithConceal('footnote', 'syn match pandocFootnoteIDHead /\[\^/ contained containedin=pandocFootnoteID', 'conceal cchar='.s:cchars['footnote'])
call s:WithConceal('footnote', 'syn match pandocFootnoteIDTail /\]/ contained containedin=pandocFootnoteID', 'conceal')
" }}}2
" List Items: {{{2
" Unordered lists
syn match pandocUListItem /^>\=\s*[*+-]\s\+-\@!.*$/ nextgroup=pandocUListItem,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation contains=@Spell,pandocEmphasis,pandocStrong,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocStrongEmphasis,pandocStrongEmphasis,pandocPCite,pandocICite,pandocCiteKey,pandocReferenceLabel,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocReferenceURL,pandocAutomaticLink,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID,pandocAmpersandEscape skipempty display
call s:WithConceal('list', 'syn match pandocUListItemBullet /^>\=\s*\zs[*+-]/ contained containedin=pandocUListItem', 'conceal cchar='.s:cchars['li'])
" Ordered lists
syn match pandocListItem /^\s*(\?\(\d\+\|\l\|\#\|@\)[.)].*$/ nextgroup=pandocListItem,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation contains=@Spell,pandocEmphasis,pandocStrong,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocStrongEmphasis,pandocStrongEmphasis,pandocPCite,pandocICite,pandocCiteKey,pandocReferenceLabel,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocAutomaticLink,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID,pandocAmpersandEscape skipempty display
" support for roman numerals up to 'c'
if g:pandoc#syntax#roman_lists != 0
syn match pandocListItem /^\s*(\?x\=l\=\(i\{,3}[vx]\=\)\{,3}c\{,3}[.)].*$/ nextgroup=pandocListItem,pandocMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation,pandocAutomaticLink skipempty display
endif
syn match pandocListItemBullet /^(\?.\{-}[.)]/ contained containedin=pandocListItem
syn match pandocListItemBulletId /\(\d\+\|\l\|\#\|@.\{-}\|x\=l\=\(i\{,3}[vx]\=\)\{,3}c\{,3}\)/ contained containedin=pandocListItemBullet
syn match pandocListItemContinuation /^\s\+\([-+*]\s\+\|(\?.\+[).]\)\@<!\([[:upper:][:lower:]_"[]\|\*\S\)\@=.*$/ nextgroup=pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation,pandocListItem contains=@Spell,pandocEmphasis,pandocStrong,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocStrongEmphasis,pandocStrongEmphasis,pandocPCite,pandocICite,pandocCiteKey,pandocReferenceLabel,pandocReferenceURL,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocAutomaticLink,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID,pandocAmpersandEscape contained skipempty display
" }}}2
" Definitions: {{{2
if g:pandoc#syntax#use_definition_lists == 1
syn region pandocDefinitionBlock start=/^\%(\_^\s*\([`~]\)\1\{2,}\)\@!.*\n\(^\s*\n\)\=\s\{0,2}\([:~]\)\(\3\{2,}\3*\)\@!/ skip=/\n\n\zs\s/ end=/\n\n/ contains=pandocDefinitionBlockMark,pandocDefinitionBlockTerm,pandocCodeBlockInsideIndent,pandocEmphasis,pandocStrong,pandocStrongEmphasis,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocFootnoteID,pandocReferenceURL,pandocReferenceLabel,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocAutomaticLink,pandocEmDash,pandocEnDash,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID
syn match pandocDefinitionBlockTerm /^.*\n\(^\s*\n\)\=\(\s*[:~]\)\@=/ contained contains=pandocNoFormatted,pandocEmphasis,pandocStrong,pandocLaTeXInlineMath,pandocEscapedDollar,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID nextgroup=pandocDefinitionBlockMark
call s:WithConceal('definition', 'syn match pandocDefinitionBlockMark /^\s*[:~]/ contained', 'conceal cchar='.s:cchars['definition'])
endif
" }}}2
" Special: {{{2
" New_lines: {{{3
if g:pandoc#syntax#newlines == 1
call s:WithConceal('newline', 'syn match pandocNewLine /\%(\%(\S\)\@<= \{2,}\|\\\)$/ display containedin=pandocEmphasis,pandocStrong,pandocStrongEmphasis,pandocStrongInEmphasis,pandocEmphasisInStrong', 'conceal cchar='.s:cchars['newline'])
endif
" }}}3
" Emdashes: {{{3
if &encoding ==# 'utf-8'
call s:WithConceal('emdashes', 'syn match pandocEllipses /\([^-]\)\@<=---\([^-]\)\@=/ display', 'conceal cchar=—')
endif
" }}}3
" Endashes: {{{3
if &encoding ==# 'utf-8'
call s:WithConceal('endashes', 'syn match pandocEllipses /\([^-]\)\@<=--\([^-]\)\@=/ display', 'conceal cchar=')
endif
" }}}3
" Ellipses: {{{3
if &encoding ==# 'utf-8'
call s:WithConceal('ellipses', 'syn match pandocEllipses /\.\.\./ display', 'conceal cchar=…')
endif
" }}}3
" Quotes: {{{3
if &encoding ==# 'utf-8'
call s:WithConceal('quotes', 'syn match pandocBeginQuote /"\</ containedin=pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar='.s:cchars['quote_s'])
call s:WithConceal('quotes', 'syn match pandocEndQuote /\(\>[[:punct:]]*\)\@<="[[:blank:][:punct:]\n]\@=/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar='.s:cchars['quote_e'])
endif
" }}}3
" Hrule: {{{3
syn match pandocHRule /^\s*\([*\-_]\)\s*\%(\1\s*\)\{2,}$/ display
" }}}3
" Backslashes: {{{3
if g:pandoc#syntax#conceal#backslash == 1
syn match pandocBackslash /\v\\@<!\\((re)?newcommand)@!/ containedin=ALLBUT,pandocCodeblock,pandocCodeBlockInsideIndent,pandocNoFormatted,pandocNoFormattedInEmphasis,pandocNoFormattedInStrong,pandocDelimitedCodeBlock,pandocLineBlock,pandocYAMLHeader conceal
endif
" }}}3
" &-escaped Special Characters: {{{3
syn match pandocAmpersandEscape /\v\&(#\d+|#x\x+|[[:alnum:]]+)\;/ contains=NoSpell
" }}}3
" YAML: {{{2
try
unlet! b:current_syntax
syn include @YAML syntax/yaml.vim
catch /E484/
endtry
syn region pandocYAMLHeader start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^\([-.]\)\1\{2}$/ keepend contains=@YAML containedin=TOP
" }}}2
" }}}1
" Styling: {{{1
hi link pandocOperator Operator
" override this for consistency
hi pandocTitleBlock term=italic gui=italic
hi link pandocTitleBlockTitle Directory
hi link pandocAtxHeader Title
hi link pandocAtxStart Operator
hi link pandocSetexHeader Title
hi link pandocHeaderAttr Comment
hi link pandocHeaderID Identifier
hi link pandocLaTexSectionCmd texSection
hi link pandocLaTeXDelimiter texDelimiter
hi link pandocHTMLComment Comment
hi link pandocHTMLCommentStart Delimiter
hi link pandocHTMLCommentEnd Delimiter
hi link pandocBlockQuote Comment
hi link pandocBlockQuoteMark Comment
hi link pandocAmpersandEscape Special
" if the user sets g:pandoc#syntax#codeblocks#ignore to contain
" a codeblock type, don't highlight it so that it remains Normal
if index(g:pandoc#syntax#codeblocks#ignore, 'definition') == -1
hi link pandocCodeBlockInsideIndent String
endif
if index(g:pandoc#syntax#codeblocks#ignore, 'delimited') == -1
hi link pandocDelimitedCodeBlock Special
endif
hi link pandocDelimitedCodeBlockStart Delimiter
hi link pandocDelimitedCodeBlockEnd Delimiter
hi link pandocDelimitedCodeBlockLanguage Comment
hi link pandocBlockQuoteinDelimitedCodeBlock pandocBlockQuote
hi link pandocCodePre String
hi link pandocLineBlockDelimiter Delimiter
hi link pandocListItemBullet Operator
hi link pandocUListItemBullet Operator
hi link pandocListItemBulletId Identifier
hi link pandocReferenceLabel Label
hi link pandocReferenceURL Underlined
hi link pandocLinkTip Identifier
hi link pandocImageIcon Operator
hi link pandocReferenceDefinition Operator
hi link pandocReferenceDefinitionLabel Label
hi link pandocReferenceDefinitionAddress Underlined
hi link pandocReferenceDefinitionTip Identifier
hi link pandocAutomaticLink Underlined
hi link pandocDefinitionBlockTerm Identifier
hi link pandocDefinitionBlockMark Operator
hi link pandocSimpleTableDelims Delimiter
hi link pandocSimpleTableHeader pandocStrong
hi link pandocTableMultilineHeader pandocStrong
hi link pandocTableDelims Delimiter
hi link pandocGridTableDelims Delimiter
hi link pandocGridTableHeader Delimiter
hi link pandocPipeTableDelims Delimiter
hi link pandocPipeTableHeader Delimiter
hi link pandocTableHeaderWord pandocStrong
hi link pandocAbbreviationHead Type
hi link pandocAbbreviation Label
hi link pandocAbbreviationTail Type
hi link pandocAbbreviationSeparator Identifier
hi link pandocAbbreviationDefinition Comment
hi link pandocFootnoteID Label
hi link pandocFootnoteIDHead Type
hi link pandocFootnoteIDTail Type
hi link pandocFootnoteDef Comment
hi link pandocFootnoteDefHead Type
hi link pandocFootnoteDefTail Type
hi link pandocFootnoteBlock Comment
hi link pandocFootnoteBlockSeparator Operator
hi link pandocPCite Operator
hi link pandocICite Operator
hi link pandocCiteKey Label
hi link pandocCiteAnchor Operator
hi link pandocCiteLocator Operator
if g:pandoc#syntax#style#emphases == 1
hi pandocEmphasis gui=italic cterm=italic
hi pandocStrong gui=bold cterm=bold
hi pandocStrongEmphasis gui=bold,italic cterm=bold,italic
hi pandocStrongInEmphasis gui=bold,italic cterm=bold,italic
hi pandocEmphasisInStrong gui=bold,italic cterm=bold,italic
if !exists('s:hi_tail')
let s:fg = '' " Vint can't figure ou these get set dynamically
let s:bg = '' " so initialize them manually first
for s:i in ['fg', 'bg']
let s:tmp_val = synIDattr(synIDtrans(hlID('String')), s:i)
let s:tmp_ui = has('gui_running') || (has('termguicolors') && &termguicolors) ? 'gui' : 'cterm'
if !empty(s:tmp_val) && s:tmp_val != -1
exe 'let s:'.s:i . ' = "'.s:tmp_ui.s:i.'='.s:tmp_val.'"'
else
exe 'let s:'.s:i . ' = ""'
endif
endfor
let s:hi_tail = ' '.s:fg.' '.s:bg
endif
exe 'hi pandocNoFormattedInEmphasis gui=italic cterm=italic'.s:hi_tail
exe 'hi pandocNoFormattedInStrong gui=bold cterm=bold'.s:hi_tail
endif
hi link pandocNoFormatted String
hi link pandocNoFormattedAttrs Comment
hi link pandocSubscriptMark Operator
hi link pandocSuperscriptMark Operator
hi link pandocStrikeoutMark Operator
if g:pandoc#syntax#style#underline_special == 1
hi pandocSubscript gui=underline cterm=underline
hi pandocSuperscript gui=underline cterm=underline
hi pandocStrikeout gui=underline cterm=underline
endif
hi link pandocNewLine Error
hi link pandocHRule Delimiter
" }}}1
let b:current_syntax = 'pandoc'
syntax sync clear
syntax sync minlines=1000

View File

@ -0,0 +1,119 @@
# Block spans
this is a paragraph.
this is a long paragraph with *italics* and **bold** items.
this is a long paragraph where *an italicized section ends with a space *.
this is a *long paragraph that spans
two* lines.
this is a paragraph with *a span that is very very very very very very very very
very very very very very very very very very very very very very very very very
very very very very very very very* long.
this is a paragraph where _italics_ and __bold__ are set with underscores.
***this*** is a paragraph with ***strongly emphasized*** words, such as this
___one___.
# italics *in* titles
yes, we can.
# bold **in** titles
inline `code` in this paragraph. this is a ``test for this`` stuff.
superscripts ^are\ kinda^ cool (2^12^). subscripts can ~also~ be ~kinda\ lame~
(like drinking H~2~O). there's also sections with ~~striked out~~ text.
this ~= could be a problem if we allowed unscaped spaces.
a new line can be outputted for lines with a couple
of spaces.
# mix and match
oh no! mix and match *is **hard** stuff*, real hard.
mixing is **quite *the* problem**.
but... we ***kinda tackled it*** ;)
We once had problems with ***quite* the problem**, but not anymore.
# blockquotes
> this is a test block
> this is another *test*. block
a block
> less block
aaa block
no block.
# code blocks
def func(a):
return 1
no code
~~~python
def func(a):
return 1
~~~
~~~ {.python}
print("hi")
~~~
test
~~~haskell
test
~~~
```vim
:exe "cmd args"
```
> ``` c
> void (*signal(int sig, void (*disp)(int)))(int);
> ```
>
> If `signal()` is used, `disp` is the address of a signal handler, and `sig`
> is not `SIGILL`, `SIGTRAP`, or `SIGPWR`, the system first sets the signal's
> disposition to `SIG_DFL` before executing the signal handler.
# definitions
hello
: this is a definition.
`hello`
: this is a definition
# lists
* this
* this
* and this
+ and this
1) a
2) b
# smart punctuation
ellipses: ....
quote "signs". This only works at the beggining and end of words.
quote "signs."
issue #31:
"Foo"
*"Foo"*
**"Foo"**

View File

@ -0,0 +1,5 @@
- `blah`. aaaaaa (FIXED)
[[abc]](xxx) issue #55 vim-pandoc
[abc](xyz) `123`. (FIXED)

View File

@ -0,0 +1,37 @@
% headings test
% vim-pandoc-syntax
with multiple lines
# heading #
a
## heading with # in it ##
a
### heading
a
#### heading
a
##### heading
a
###### heading
test
heading
-------
aaaaa
heading
=======
aaaaa

View File

@ -0,0 +1,16 @@
CMake works fine with Visual Studio but there are a few things to consider. The
property for the working directory in the Debugging section should most likely
be set to `$(OutDir)`. Likewise, the start-up project must be set manually as
it's set to ALL_BUILD by default. ALL_BUILD is a project that builds all
projects and correctly triggers any scripts. ZERO_CHECK is a project that runs
and, if any CMake files have been changed, asks to reload Visual Studio.
Furthermore, if you're making a Windows application, you should add the WIN32
parameter to `add_executable` to instruct the compiler to use the `WinMain`
[entry-point](http://msdn.microsoft.com/en-us/library/f9t8842e.aspx) and
WINDOWS
[subsystem](http://msdn.microsoft.com/en-us/library/fcc1zstk%28v=vs.110%29.aspx):
possible regressions:
*test* test *test*. _ this

View File

@ -0,0 +1,33 @@
This is a paragraph with $\text{inline} \LaTeX$.
This is a paragraph with \(\text{inline} \LaTeX\) using the tex_math_single_backslash extension.
LaTeX: \(m\)
LaTeX: \(m\)1 (safe for decimal to follow)
\[
\frac{1}{2}
\]
This \$ is a dollar sign. $ this too. $30000 dollars are mentioned in pandoc's
Example. I don't have that amount.
$$
This is \LaTeX too. \sum a b
$$
\LaTeX
\newcommand{\tuple}[1]{\langle #1 \rangle}
\begin{tabular}{|l|l|}\hline
Age & Frequency \\ \hline
18--25 & 15 \\
26--35 & 33 \\
36--45 & 22 \\ \hline
\end{tabular}
# test
Unicode!
$α^i_i$
$a^{i}_i$
$a^i_{i}$
$a^{i}_{i}$

View File

@ -0,0 +1,65 @@
# this is a test for links, references and footnotes.
a link to [the example.com website](http://www.example.com "example")
well, [the example.com website](http://www.example.com)
testing footnotes[^footnote1]. this is kinda silly.^[another footnote.]
^superscrips^ are ok, but be careful to keep spaces between the inline
footnotes and the superscripts.^[inline footnotes-- *test*]
[^footnote1]: this is a footnote --.
[see @Lovejoy, pp. 12]
Mister @Lovejoy95, at [-@Lovejoy], cites @Lovejoy [pp. 12-12].
Some printable characters might not be matched (in @Krämer, `ä` caused
issues). @Krámer @Kraßmer @Kràmer
*[PCL]: P C L
[hello][welcome] aaaaaa this with [inline link](http://site.com) gets messed up
[hello][hello]aaaaaa this
[hello] [hello] this is a test.
[hello][]
[hello1]: www.google.com
[hello2]: www.google.com "pandoc"
[hello3]: www.google.com
"pandoc"
this is no longer part of the reference definition
![test](test.png)
![testimg][]
[testimg]: test.png
What follows are some notes on algorithms I've been reviewing from [Algorithms](http://amzn.com/032157351X) by Robert Sedgewick and Kevin Wayne, [The Algorithm Design Manual](http://amzn.com/1849967202) by Steven S. Skiena, and other sources around the Internet [^mit] [^umd] [^umgd]. I wanted to write some notes on the material so that I could easily look back on it, but mainly so that I could be sure that I understand the material --- since I have to understand it to explain it.
[Convolution](http://en.wikipedia.org/wiki/Convolution) is a mathematical
method of combining two signals to form a third signal. Passing the [Dirac
delta function](http://en.wikipedia.org/wiki/Dirac_delta_function) (unit
impulse) $\delta[n]$ through a linear system results in the impulse response
$h[n]$. The impulse response is simply the signal resulting from passing the
unit impulse (Dirac delta function) through a linear system.
# issue 25
[[abc]](xxx)
[[abc]][]
[[abc]]: x
# issue 107 (vim-pandoc)
[`]`](http://foo.com) foo
[Why isn't `ListT []`{.haskell} a monad](http://blog.sigfpe.com/2006/11/why-isnt-listt-monad.html)

View File

@ -0,0 +1,46 @@
i. a
ii. a
iii. a
iv. a
v. a
vi. a
vii. a
viii. a
ix. a
x. a
xi. a
xii. a
xiii. a
xiv. a
xv. a
xvi. a
xvii. a
xviii. a
xix. a
xx. a
xxi. a
xxii. a
xxx. a
xl. a
xliii. a
l. a
lx. a
lxix. a
xc. a
c. a
it breaks down at c, but maybe that's enough...
ci. a
cx. a
cxl. a
cl. a
cxc. a
cc. a
ccc. a
cd. a
d. a
cm. a
m. a

View File

@ -0,0 +1,82 @@
# Simple tables
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
error 2nd-order 10th-order
------ ----------- ------------
$\insample$ $0.029$ $10^{-5}$
$\outsample$ $0.120$ $7680$
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
------- ------ ---------- -------
# Mutiline tables
-------------------------------------------------------------
Centered Default Right Left
Header Aligned Aligned Aligned
----------- ------- --------------- -------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Here's another one. Note
the blank line between
rows.
-------------------------------------------------------------
----------- ------- --------------- -------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Here's another one. Note
the blank line between
rows.
----------- ------- --------------- -------------------------
# grid table
+---------------+---------------+--------------------+
| Fruit | Price | Advantages |
+===============+===============+====================+
| Bananas | $1.34 | - built-in wrapper |
| | | - bright color |
+---------------+---------------+--------------------+
| Oranges | $2.10 | - cures scurvy |
| | | - tasty |
+---------------+---------------+--------------------+
+----------------------+------------------+
| test | a |
+----------------------+------------------+
# pipe tables
| Right | Left | Default | Center |
|------:|:-----|---------|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
Right | Left | Default | Center
-----:|:-----|---------|:------:
12 | 12 | 12 | 12
123 | 123 | 123 | 123
1 | 1 | 1 | 1
fruit| price
-----|-----:
apple|2.05
pear|1.37
orange|3.09
| One | Two |
|-----+-------|
| my | table |
| is | nice |

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

View File

@ -0,0 +1,11 @@
---
title: Scala
published: October 12, 2013
excerpt: Promising mixture of OO and FP
comments: off
---
---
hello
-----

View File

@ -1,812 +0,0 @@
" Vim syntax file
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
" Last Change: Dec 20, 2022
" Version: 205
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) and heredoc fixes from Felipe Contreras
" quit when a syntax file was already loaded {{{1
if exists("b:current_syntax")
finish
endif
" If the shell script itself specifies which shell to use, use it
if getline(1) =~ '\<ksh\>'
let b:is_kornshell = 1
elseif getline(1) =~ '\<bash\>'
let b:is_bash = 1
elseif getline(1) =~ '\<dash\>'
let b:is_dash = 1
elseif !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh") && !exists("g:is_dash")
" user did not specify which shell to use, and
" the script itself does not specify which shell to use. FYI: /bin/sh is ambiguous.
" Assuming /bin/sh is executable, and if its a link, find out what it links to.
let s:shell = ""
if executable("/bin/sh")
let s:shell = resolve("/bin/sh")
elseif executable("/usr/bin/sh")
let s:shell = resolve("/usr/bin/sh")
endif
if s:shell =~ '\<ksh\>'
let b:is_kornshell= 1
elseif s:shell =~ '\<bash\>'
let b:is_bash = 1
elseif s:shell =~ '\<dash\>'
let b:is_dash = 1
endif
unlet s:shell
endif
" handling /bin/sh with is_kornshell/is_sh {{{1
" b:is_sh will be set when "#! /bin/sh" is found;
" However, it often is just a masquerade by bash (typically Linux)
" or kornshell (typically workstations with Posix "sh").
" So, when the user sets "g:is_bash", "g:is_kornshell",
" or "g:is_posix", a b:is_sh is converted into b:is_bash/b:is_kornshell,
" respectively.
if !exists("b:is_kornshell") && !exists("b:is_bash") && !exists("b:is_dash")
if exists("g:is_posix") && !exists("g:is_kornshell")
let g:is_kornshell= g:is_posix
endif
if exists("g:is_kornshell")
let b:is_kornshell= 1
if exists("b:is_sh")
unlet b:is_sh
endif
elseif exists("g:is_bash")
let b:is_bash= 1
if exists("b:is_sh")
unlet b:is_sh
endif
elseif exists("g:is_dash")
let b:is_dash= 1
if exists("b:is_sh")
unlet b:is_sh
endif
else
let b:is_sh= 1
endif
endif
" if b:is_dash, set b:is_posix too
if exists("b:is_dash")
let b:is_posix= 1
endif
" set up default g:sh_fold_enabled {{{1
" ================================
if !exists("g:sh_fold_enabled")
let g:sh_fold_enabled= 0
elseif g:sh_fold_enabled != 0 && !has("folding")
let g:sh_fold_enabled= 0
echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support"
endif
let s:sh_fold_functions= and(g:sh_fold_enabled,1)
let s:sh_fold_heredoc = and(g:sh_fold_enabled,2)
let s:sh_fold_ifdofor = and(g:sh_fold_enabled,4)
if g:sh_fold_enabled && &fdm == "manual"
" Given that the user provided g:sh_fold_enabled
" AND g:sh_fold_enabled is manual (usual default)
" implies a desire for syntax-based folding
setl fdm=syntax
endif
" set up the syntax-highlighting for iskeyword
if (v:version == 704 && has("patch-7.4.1142")) || v:version > 704
if !exists("g:sh_syntax_isk") || (exists("g:sh_syntax_isk") && g:sh_syntax_isk)
if exists("b:is_bash")
exe "syn iskeyword ".&iskeyword.",-,:"
else
exe "syn iskeyword ".&iskeyword.",-"
endif
endif
endif
" Set up folding commands for shell {{{1
" =================================
sil! delc ShFoldFunctions
sil! delc ShFoldHereDoc
sil! delc ShFoldIfDoFor
if s:sh_fold_functions
com! -nargs=* ShFoldFunctions <args> fold
else
com! -nargs=* ShFoldFunctions <args>
endif
if s:sh_fold_heredoc
com! -nargs=* ShFoldHereDoc <args> fold
else
com! -nargs=* ShFoldHereDoc <args>
endif
if s:sh_fold_ifdofor
com! -nargs=* ShFoldIfDoFor <args> fold
else
com! -nargs=* ShFoldIfDoFor <args>
endif
" sh syntax is case sensitive {{{1
syn case match
" Clusters: contains=@... clusters {{{1
"==================================
syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster ErrorList add=shDTestError
endif
syn cluster shArithParenList contains=shArithmetic,shArithParen,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shArithList contains=@shArithParenList,shParenError
syn cluster shCaseEsacList contains=shCaseStart,shCaseLabel,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDblBrace,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shCaseList add=shForPP
endif
syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
" COMBAK: removing shEscape from shDblQuoteList fails ksh04:43 -- Jun 09, 2022: I don't see the problem with ksh04, so am reinstating shEscape
syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ
syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS
syn cluster shDerefVarList contains=shDerefOffset,shDerefOp,shDerefVarArray,shDerefOpError
syn cluster shEchoList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shFunctionList add=shRepeat,shDblBrace,shDblParen,shForPP
syn cluster shDerefList add=shCommandSubList,shEchoDeref
endif
syn cluster shHereBeginList contains=@shCommandSubList
syn cluster shHereList contains=shBeginHere,shHerePayload
syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
syn cluster shIdList contains=shArithmetic,shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shIf,shOption,shSet,shTest,shTestOpr,shTouch
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shLoopoList add=shForPP
endif
syn cluster shPPSLeftList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm
syn cluster shSubShList contains=@shCommandSubList,shCommandSubBQ,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
syn cluster shTestList contains=shArithmetic,shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
syn cluster shNoZSList contains=shSpecialNoZS
syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shCommandSub,shCommandSubBQ,shArithmetic
" Echo: {{{1
" ====
" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
syn region shEchoDeref contained matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
syn region shEchoDeref contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
endif
syn match shEchoQuote contained '\%(\\\\\)*\\["`'()]'
" This must be after the strings, so that ... \" will be correct
syn region shEmbeddedEcho contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|`)]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=shNumber,shExSingleQuote,shSingleQuote,shDeref,shDerefSimple,shSpecialVar,shOperator,shExDoubleQuote,shDoubleQuote,shCharClass,shCtrlSeq
" Alias: {{{1
" =====
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
syn match shStatement "\<alias\>"
syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]*\)\@=" skip="\\$" end="\>\|`"
syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]*=\)\@=" skip="\\$" end="="
" syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+\)\@=" skip="\\$" end="\>\|`"
" syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="="
" Touch: {{{1
" =====
syn match shTouch '\<touch\>[^;#]*' skipwhite nextgroup=shComment contains=shTouchCmd,shDoubleQuote,shSingleQuote,shDeref,shDerefSimple
syn match shTouchCmd '\<touch\>' contained
endif
" Error Codes: {{{1
" ============
if !exists("g:sh_no_error")
syn match shDoError "\<done\>"
syn match shIfError "\<fi\>"
syn match shInError "\<in\>"
syn match shCaseError ";;"
syn match shEsacError "\<esac\>"
syn match shCurlyError "}"
syn match shParenError ")"
syn match shOK '\.\(done\|fi\|in\|esac\)'
if exists("b:is_kornshell") || exists("b:is_bash")
syn match shDTestError "]]"
endif
syn match shTestError "]"
endif
" Options: {{{1
" ====================
syn match shOption "\s\zs[-+][-_a-zA-Z#@]\+"
syn match shOption "\s\zs--[^ \t$=`'"|);]\+"
" File Redirection Highlighted As Operators: {{{1
"===========================================
syn match shRedir "\d\=>\(&[-0-9]\)\="
syn match shRedir "\d\=>>-\="
syn match shRedir "\d\=<\(&[-0-9]\)\="
syn match shRedir "\d<<-\="
" Operators: {{{1
" ==========
syn match shOperator "<<\|>>" contained
syn match shOperator "[!&;|]" contained
syn match shOperator "\[[[^:]\|\]]" contained
syn match shOperator "[-=/*+%]\==" skipwhite nextgroup=shPattern
syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shDeref
" Subshells: {{{1
" ==========
syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 nextgroup=shSpecialNxt
syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")" contains=@shSubShList nextgroup=shSpecialNxt
" Tests: {{{1
"=======
syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial
syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1
syn region shNoQuote start='\S' skip='\%(\\\\\)*\\.' end='\ze\s' end="\ze['"]" contained contains=shDerefSimple,shDeref
syn match shAstQuote contained '\*\ze"' nextgroup=shString
syn match shTestOpr contained '[^-+/%]\zs=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern
syn match shTestOpr contained "<=\|>=\|!=\|==\|=\~\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]"
syn match shTestPattern contained '\w\+'
syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' contains=shDeref,shDerefSimple,shDerefSpecial
syn match shTestSingleQuote contained '\\.' nextgroup=shTestSingleQuote
syn match shTestSingleQuote contained "'[^']*'"
if exists("b:is_kornshell") || exists("b:is_bash")
syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shAstQuote,shNoQuote,shComment
syn region shDblParen matchgroup=Delimiter start="((" skip=+\%(\\\\\)*\\$+ end="))" contains=@shTestList,shComment
endif
" Character Class In Range: {{{1
" =========================
syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]"
" Loops: do, if, while, until {{{1
" ======
ShFoldIfDoFor syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
ShFoldIfDoFor syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList
ShFoldIfDoFor syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
if exists("b:is_kornshell") || exists("b:is_bash")
ShFoldIfDoFor syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=@shForList
endif
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
syn cluster shCaseList add=shRepeat
syn cluster shFunctionList add=shRepeat
syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace
syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace
if !exists("b:is_posix")
syn region shCaseEsac matchgroup=shConditional start="\<select\s" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList
endif
else
syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<do\>"me=e-2 contains=@shLoopList
syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<do\>"me=e-2 contains=@shLoopList
endif
syn region shCurlyIn contained matchgroup=Delimiter start="{" end="}" contains=@shCurlyList
syn match shComma contained ","
" Case: case...esac {{{1
" ====
syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar
syn match shCaseLabel contained skipwhite "\%(\\.\|[-a-zA-Z0-9_*.]\)\+" contains=shCharClass
if exists("b:is_bash")
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end=";;&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
elseif exists("b:is_kornshell")
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
else
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
endif
ShFoldIfDoFor syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
if exists("b:is_bash") || exists("b:is_kornshell")
syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained
elseif !exists("g:sh_no_error")
syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
endif
syn region shCaseSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
syn region shCaseDoubleQuote matchgroup=shQuote start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained
if exists("b:is_bash")
syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+ contained contains=shCharClass
syn match shCharClass '\[:\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|word\|or\|xdigit\):\]' contained
else
syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+ contained
endif
" Misc: {{{1
"======
syn match shWrapLineOperator "\\$"
syn region shCommandSubBQ start="`" skip="\\\\\|\\." end="`" contains=shBQComment,@shCommandSubList
"COMBAK: see ksh13:50
"syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shSingleQuote,shDoubleQuote,shComment
"COMBAK: see sh11:27
syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment
"COMBAK: see ksh13:53
"syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.'
" $() and $(()): {{{1
" $(..) is not supported by sh (Bourne shell). However, apparently
" some systems (HP?) have as their /bin/sh a (link to) Korn shell
" (ie. Posix compliant shell). /bin/ksh should work for those
" systems too, however, so the following syntax will flag $(..) as
" an Error under /bin/sh. By consensus of vimdev'ers!
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
syn region shCommandSub matchgroup=shCmdSubRegion start="\$(\ze\([^(]\|$\)" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
syn match shSkipInitWS contained "^\s\+"
syn region shArithParen matchgroup=shArithRegion contained start="(" end=")" contains=@shArithParenList
elseif !exists("g:sh_no_error")
syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
endif
syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
if exists("b:is_bash")
syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
syn cluster shCaseList add=bashAdminStatement,bashStatement
syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ALIASES BASH_ARGC BASH_ARGC BASH_ARGV BASH_ARGV BASH_CMDS BASH_CMDS BASH_COMMAND BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_EXECUTION_STRING BASH_LINENO BASH_LINENO BASHOPTS BASHOPTS BASHPID BASHPID BASH_REMATCH BASH_REMATCH BASH_SOURCE BASH_SOURCE BASH_SUBSHELL BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD BASH_XTRACEFD CDPATH COLUMNS COLUMNS COMP_CWORD COMP_CWORD COMP_KEY COMP_KEY COMP_LINE COMP_LINE COMP_POINT COMP_POINT COMPREPLY COMPREPLY COMP_TYPE COMP_TYPE COMP_WORDBREAKS COMP_WORDBREAKS COMP_WORDS COMP_WORDS COPROC COPROC DIRSTACK EMACS EMACS ENV ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNAME FUNCNEST FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_NUMERIC LINENO LINES LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT POSIXLY_CORRECT PPID PROMPT_COMMAND PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_LINE READLINE_POINT READLINE_POINT REPLY SECONDS SHELL SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR TMPDIR UID
syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep head less ls mkdir mv rm rmdir rpm sed sleep sort strip tail
syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
syn keyword bashStatement command compgen
endif
if exists("b:is_kornshell") || exists("b:is_posix")
syn cluster shCommandSubList add=kshSpecialVariables,kshStatement
syn cluster shCaseList add=kshStatement
syn keyword kshSpecialVariables contained CDPATH COLUMNS EDITOR ENV ERRNO FCEDIT FPATH HISTFILE HISTSIZE HOME IFS LINENO LINES MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTIND PATH PPID PS1 PS2 PS3 PS4 PWD RANDOM REPLY SECONDS SHELL TMOUT VISUAL
syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep head killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail tput
syn keyword kshStatement command setgroups setsenv
endif
syn match shSource "^\.\s"
syn match shSource "\s\.\s"
"syn region shColon start="^\s*:" end="$" end="\s#"me=e-2 contains=@shColonList
"syn region shColon start="^\s*\zs:" end="$" end="\s#"me=e-2
if exists("b:is_kornshell") || exists("b:is_posix")
syn match shColon '^\s*\zs:'
endif
" String And Character Constants: {{{1
"================================
syn match shNumber "\<\d\+\>#\="
syn match shNumber "\<-\=\.\=\d\+\>#\="
syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained
if exists("b:is_bash") || exists("b:is_kornshell")
syn match shSpecial "[^\\]\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
syn match shSpecial "^\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial nextgroup=shSpecialNxt
syn region shExDoubleQuote matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,shSpecial nextgroup=shSpecialNxt
elseif !exists("g:sh_no_error")
syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial
syn region shExDoubleQuote matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial
endif
syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell nextgroup=shSpecialStart,shSpecialSQ
syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell nextgroup=shSpecialStart
syn match shStringSpecial "[^[:print:] \t]" contained
syn match shStringSpecial "[^\\]\zs\%(\\\\\)*\(\\[\\"'`$()#]\)\+" nextgroup=shComment
syn match shSpecialSQ "[^\\]\zs\%(\\\\\)*\(\\[\\"'`$()#]\)\+" contained nextgroup=shBkslshSnglQuote,@shNoZSList
syn match shSpecialDQ "[^\\]\zs\%(\\\\\)*\(\\[\\"'`$()#]\)\+" contained nextgroup=shBkslshDblQuote,@shNoZSList
syn match shSpecialStart "\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shBkslshSnglQuote,shBkslshDblQuote,@shNoZSList
syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]"
syn match shSpecialNoZS contained "\%(\\\\\)*\\[\\"'`$()#]"
syn match shSpecialNxt contained "\\[\\"'`$()#]"
"syn region shBkslshSnglQuote contained matchgroup=shQuote start=+'+ end=+'+ contains=@Spell nextgroup=shSpecialStart
"syn region shBkslshDblQuote contained matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell nextgroup=shSpecialStart
" Comments: {{{1
"==========
syn cluster shCommentGroup contains=shTodo,@Spell
if exists("b:is_bash")
syn match shTodo contained "\<\%(COMBAK\|FIXME\|TODO\|XXX\)\ze:\=\>"
else
syn keyword shTodo contained COMBAK FIXME TODO XXX
endif
syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup
syn match shComment "\s\zs#.*$" contains=@shCommentGroup
syn match shComment contained "#.*$" contains=@shCommentGroup
syn match shQuickComment contained "#.*$" contains=@shCommentGroup
syn match shBQComment contained "#.\{-}\ze`" contains=@shCommentGroup
" Here Documents: {{{1
" (modified by Felipe Contreras)
" =========================================
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc01 end="^\z1$" contains=@shDblQuoteList
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<-\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc02 end="^\s*\z1$" contains=@shDblQuoteList
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc03 end="^\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc04 end="^\s*\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^']\+\)'" matchgroup=shHereDoc05 end="^\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*'\z([^']\+\)'" matchgroup=shHereDoc06 end="^\s*\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\"\z([^"]\+\)\"" matchgroup=shHereDoc07 end="^\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<-\s*\"\z([^"]\+\)\"" matchgroup=shHereDoc08 end="^\s*\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc09 end="^\z1$" contains=@shDblQuoteList
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1$" contains=@shDblQuoteList
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc11 end="^\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc12 end="^\s*\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<\s*\\\_$\_s*'\z([^']\+\)'" matchgroup=shHereDoc13 end="^\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<-\s*\\\_$\_s*'\z([^']\+\)'" matchgroup=shHereDoc14 end="^\s*\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<\s*\\\_$\_s*\"\z([^"]\+\)\"" matchgroup=shHereDoc15 end="^\z1$"
ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\_$\_s*\"\z([^"]\+\)\"" matchgroup=shHereDoc16 end="^\s*\z1$"
" Here Strings: {{{1
" =============
" available for: bash; ksh (really should be ksh93 only) but not if its a posix
if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("b:is_posix"))
syn match shHereString "<<<" skipwhite nextgroup=shCmdParenRegion
endif
" Identifiers: {{{1
"=============
syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained
syn match shVariable "\<\h\w*\ze=" nextgroup=shVarAssign
syn match shVarAssign "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote,shVar
syn match shVar contained "\h\w*"
syn region shAtExpr contained start="@(" end=")" contains=@shIdList
if exists("b:is_bash")
syn match shSet "^\s*set\ze\s\+$"
syn region shSetList oneline matchgroup=shSet start="\<\%(declare\|local\|export\)\>\ze[/a-zA-Z_]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList
syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\)\>[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList nextgroup=shComment
elseif exists("b:is_kornshell") || exists("b:is_posix")
syn match shSet "^\s*set\ze\s\+$"
if exists("b:is_dash")
syn region shSetList oneline matchgroup=shSet start="\<\%(local\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
endif
syn region shSetList oneline matchgroup=shSet start="\<\(export\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\>\)\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList nextgroup=shComment
else
syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
endif
" KornShell namespace: {{{1
if exists("b:is_kornshell")
syn keyword shFunctionKey namespace skipwhite skipnl nextgroup=shFunctionTwo
endif
" Functions: {{{1
if !exists("b:is_posix")
syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo
endif
if exists("b:is_bash")
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
else
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
endif
" Parameter Dereferencing: {{{1
" ========================
" Note: sh04 failure with following line
"if !exists("g:sh_no_error") && !(exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix"))
if !exists("g:sh_no_error")
syn match shDerefWordError "[^}$[~]" contained
endif
syn match shDerefSimple "\$\%(\h\w*\|\d\)" nextgroup=@shNoZSList
syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray nextgroup=shSpecialStart
syn match shDerefSimple "\$[-#*@!?]" nextgroup=@shNoZSList
syn match shDerefSimple "\$\$" nextgroup=@shNoZSList
syn match shDerefSimple "\${\d}" nextgroup=@shNoZSList nextgroup=shSpecialStart
if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix")
syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS,shSpecialStart
syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS,shSpecialStart
endif
" ksh: ${.sh.*} variables: {{{1
" ========================================
if exists("b:is_kornshell")
" syn match shDerefVar contained "[.]*" nextgroup=@shDerefVarList
syn match shDerefVar contained "\.\+" nextgroup=@shDerefVarList
endif
" ksh: ${!var[*]} array index list syntax: {{{1
" ========================================
if exists("b:is_kornshell") || exists("b:is_posix")
syn region shDeref matchgroup=PreProc start="\${!" end="}" contains=@shDerefVarArray
endif
" bash: ${!prefix*} and ${#parameter}: {{{1
" ====================================
if exists("b:is_bash")
syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOffset
syn match shDerefVar contained "{\@<=!\h\w*" nextgroup=@shDerefVarList
endif
if exists("b:is_kornshell")
syn match shDerefVar contained "{\@<=!\h\w*[[:alnum:]_.]*" nextgroup=@shDerefVarList
endif
syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOffset,shDerefOpError
syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp
syn match shDerefVar contained "{\@<=\h\w*" nextgroup=@shDerefVarList
syn match shDerefVar contained '\d' nextgroup=@shDerefVarList
if exists("b:is_kornshell") || exists("b:is_posix")
syn match shDerefVar contained "{\@<=\h\w*[[:alnum:]_.]*" nextgroup=@shDerefVarList
endif
" sh ksh bash : ${var[... ]...} array reference: {{{1
syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError
" Special ${parameter OPERATOR word} handling: {{{1
" sh ksh bash : ${parameter:-word} word is default value
" sh ksh bash : ${parameter:=word} assign word as default value
" sh ksh bash : ${parameter:?word} display word if parameter is null
" sh ksh bash : ${parameter:+word} use word if parameter is not null, otherwise nothing
" ksh bash : ${parameter#pattern} remove small left pattern
" ksh bash : ${parameter##pattern} remove large left pattern
" ksh bash : ${parameter%pattern} remove small right pattern
" ksh bash : ${parameter%%pattern} remove large right pattern
" bash : ${parameter^pattern} Case modification
" bash : ${parameter^^pattern} Case modification
" bash : ${parameter,pattern} Case modification
" bash : ${parameter,,pattern} Case modification
" bash : ${@:start:qty} display command line arguments from start to start+qty-1 (inferred)
syn cluster shDerefPatternList contains=shDerefPattern,shDerefString
if !exists("g:sh_no_error")
syn match shDerefOpError contained ":[[:punct:]]"
endif
syn match shDerefOp contained ":\=[-=?]" nextgroup=@shDerefPatternList
syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList
if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix")
syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList
syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList
syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern
syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern
syn match shDerefEscape contained '\%(\\\\\)*\\.'
endif
if exists("b:is_bash")
syn match shDerefOp contained "[,^]\{1,2}" nextgroup=@shDerefPatternList
endif
syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial
syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial
syn match shDerefString contained "\\["']" nextgroup=shDerefPattern
if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix")
" bash ksh posix : ${parameter:offset}
" bash ksh posix : ${parameter:offset:length}
syn region shDerefOffset contained start=':[^-=?+]' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple
syn region shDerefOffset contained start=':\s-' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple
syn match shDerefLen contained ":[^}]\+" contains=shDeref,shDerefSimple,shArithmetic
endif
if exists("b:is_bash")
" bash : ${parameter//pattern/string}
" bash : ${parameter//pattern}
syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft
syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' end='"' nextgroup=shDerefPPSright contains=@shPPSLeftList
syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList
" bash : ${parameter/#substring/replacement}
syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft,shDoubleQuote,shSingleQuote
syn region shDerefPSRleft contained start='[^"']' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright
syn region shDerefPSRright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}'
endif
" Arithmetic Parenthesized Expressions: {{{1
"syn region shParen matchgroup=shArithRegion start='[^$]\zs(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
syn region shParen matchgroup=shArithRegion start='\$\@!(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
" Additional sh Keywords: {{{1
" ===================
syn keyword shStatement break cd chdir continue eval exec exit kill newgrp pwd read readonly return shift test trap ulimit umask wait
syn keyword shConditional contained elif else then
if !exists("g:sh_no_error")
syn keyword shCondError elif else then
endif
" Additional ksh Keywords and Aliases: {{{1
" ===================================
if exists("b:is_kornshell") || exists("b:is_posix")
syn keyword shStatement bg builtin disown enum export false fg getconf getopts hist jobs let printf sleep true unalias whence
syn keyword shStatement typeset skipwhite nextgroup=shSetOption
syn keyword shStatement autoload compound fc float functions hash history integer nameref nohup r redirect source stop suspend times type
if exists("b:is_posix")
syn keyword shStatement command
else
syn keyword shStatement time
endif
" Additional bash Keywords: {{{1
" =====================
elseif exists("b:is_bash")
syn keyword shStatement bg builtin disown export false fg getopts jobs let printf sleep true unalias
syn keyword shStatement typeset nextgroup=shSetOption
syn keyword shStatement fc hash history source suspend times type
syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help logout mapfile popd pushd readarray shopt source typeset
else
syn keyword shStatement login newgrp
endif
" Synchronization: {{{1
" ================
if !exists("g:sh_minlines")
let s:sh_minlines = 200
else
let s:sh_minlines= g:sh_minlines
endif
if !exists("g:sh_maxlines")
let s:sh_maxlines = 2*s:sh_minlines
if s:sh_maxlines < 25
let s:sh_maxlines= 25
endif
else
let s:sh_maxlines= g:sh_maxlines
endif
exec "syn sync minlines=" . s:sh_minlines . " maxlines=" . s:sh_maxlines
syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>"
syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>"
syn sync match shDoSync grouphere shDo "\<do\>"
syn sync match shDoSync groupthere shDo "\<done\>"
syn sync match shForSync grouphere shFor "\<for\>"
syn sync match shForSync groupthere shFor "\<in\>"
syn sync match shIfSync grouphere shIf "\<if\>"
syn sync match shIfSync groupthere shIf "\<fi\>"
syn sync match shUntilSync grouphere shRepeat "\<until\>"
syn sync match shWhileSync grouphere shRepeat "\<while\>"
" Default Highlighting: {{{1
" =====================
if !exists("skip_sh_syntax_inits")
hi def link shArithRegion shShellVariables
hi def link shAstQuote shDoubleQuote
hi def link shAtExpr shSetList
hi def link shBkslshSnglQuote shSingleQuote
hi def link shBkslshDblQuote shDOubleQuote
hi def link shBeginHere shRedir
hi def link shCaseBar shConditional
hi def link shCaseCommandSub shCommandSub
hi def link shCaseDoubleQuote shDoubleQuote
hi def link shCaseIn shConditional
hi def link shQuote shOperator
hi def link shCaseSingleQuote shSingleQuote
hi def link shCaseStart shConditional
hi def link shCmdSubRegion shShellVariables
hi def link shColon shComment
hi def link shDerefOp shOperator
hi def link shDerefPOL shDerefOp
hi def link shDerefPPS shDerefOp
hi def link shDerefPSR shDerefOp
hi def link shDeref shShellVariables
hi def link shDerefDelim shOperator
hi def link shDerefSimple shDeref
hi def link shDerefSpecial shDeref
hi def link shDerefString shDoubleQuote
hi def link shDerefVar shDeref
hi def link shDoubleQuote shString
hi def link shEcho shString
hi def link shEchoDelim shOperator
hi def link shEchoQuote shString
hi def link shForPP shLoop
hi def link shFunction Function
hi def link shEmbeddedEcho shString
hi def link shEscape shCommandSub
hi def link shExDoubleQuote shDoubleQuote
hi def link shExSingleQuote shSingleQuote
hi def link shHereDoc shString
hi def link shHereString shRedir
hi def link shHerePayload shHereDoc
hi def link shLoop shStatement
hi def link shSpecialNxt shSpecial
hi def link shNoQuote shDoubleQuote
hi def link shOption shCommandSub
hi def link shPattern shString
hi def link shParen shArithmetic
hi def link shPosnParm shShellVariables
hi def link shQuickComment shComment
hi def link shBQComment shComment
hi def link shRange shOperator
hi def link shRedir shOperator
hi def link shSetListDelim shOperator
hi def link shSetOption shOption
hi def link shSingleQuote shString
hi def link shSource shOperator
hi def link shStringSpecial shSpecial
hi def link shSpecialStart shSpecial
hi def link shSubShRegion shOperator
hi def link shTestOpr shConditional
hi def link shTestPattern shString
hi def link shTestDoubleQuote shString
hi def link shTestSingleQuote shString
hi def link shTouchCmd shStatement
hi def link shVariable shSetList
hi def link shWrapLineOperator shOperator
if exists("b:is_bash")
hi def link bashAdminStatement shStatement
hi def link bashSpecialVariables shShellVariables
hi def link bashStatement shStatement
hi def link shCharClass shSpecial
hi def link shDerefOffset shDerefOp
hi def link shDerefLen shDerefOffset
endif
if exists("b:is_kornshell") || exists("b:is_posix")
hi def link kshSpecialVariables shShellVariables
hi def link kshStatement shStatement
endif
if !exists("g:sh_no_error")
hi def link shCaseError Error
hi def link shCondError Error
hi def link shCurlyError Error
hi def link shDerefOpError Error
hi def link shDerefWordError Error
hi def link shDoError Error
hi def link shEsacError Error
hi def link shIfError Error
hi def link shInError Error
hi def link shParenError Error
hi def link shTestError Error
if exists("b:is_kornshell") || exists("b:is_posix")
hi def link shDTestError Error
endif
endif
hi def link shArithmetic Special
hi def link shCharClass Identifier
hi def link shSnglCase Statement
hi def link shCommandSub Special
hi def link shCommandSubBQ shCommandSub
hi def link shComment Comment
hi def link shConditional Conditional
hi def link shCtrlSeq Special
hi def link shExprRegion Delimiter
hi def link shFunctionKey Function
hi def link shFunctionName Function
hi def link shNumber Number
hi def link shOperator Operator
hi def link shRepeat Repeat
hi def link shSet Statement
hi def link shSetList Identifier
hi def link shShellVariables PreProc
hi def link shSpecial Special
hi def link shSpecialDQ Special
hi def link shSpecialSQ Special
hi def link shSpecialNoZS shSpecial
hi def link shStatement Statement
hi def link shString String
hi def link shTodo Todo
hi def link shAlias Identifier
hi def link shHereDoc01 shRedir
hi def link shHereDoc02 shRedir
hi def link shHereDoc03 shRedir
hi def link shHereDoc04 shRedir
hi def link shHereDoc05 shRedir
hi def link shHereDoc06 shRedir
hi def link shHereDoc07 shRedir
hi def link shHereDoc08 shRedir
hi def link shHereDoc09 shRedir
hi def link shHereDoc10 shRedir
hi def link shHereDoc11 shRedir
hi def link shHereDoc12 shRedir
hi def link shHereDoc13 shRedir
hi def link shHereDoc14 shRedir
hi def link shHereDoc15 shRedir
hi def link shHereDoc16 shRedir
endif
" Delete shell folding commands {{{1
" =============================
delc ShFoldFunctions
delc ShFoldHereDoc
delc ShFoldIfDoFor
" Set Current Syntax: {{{1
" ===================
if exists("b:is_bash")
let b:current_syntax = "bash"
elseif exists("b:is_kornshell")
let b:current_syntax = "ksh"
elseif exists("b:is_posix")
let b:current_syntax = "posix"
else
let b:current_syntax = "sh"
endif
" vim: ts=16 fdm=marker

View File

@ -84,6 +84,11 @@ set softtabstop=0
set shiftwidth=4
" quickfix for spelling
inoremap <C-l> <C-g>u<Esc>[s1z=`]a<C-g>u
" some emacs-esque keybinds in insert mode
inoremap <C-e> <End>
inoremap <C-a> <Home>
inoremap <C-f> <C-Right>
inoremap <C-b> <C-Left>
" }}}
" misc keybinds {{{
@ -148,4 +153,5 @@ autocmd FileType c,cpp,rust setlocal sw=8 ts=8
autocmd FileType rust,python setlocal noet pi
autocmd FileType haskell,tex setlocal et
autocmd FileType tex setlocal sw=2 sts=2 conceallevel=1
autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
" }}}