-
Notifications
You must be signed in to change notification settings - Fork 62
smart squotes and apostrophe #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
75f7a83
smart squotes and apostrophe
rwxrob 1f9d9f3
added quotes and apostrophe to blockquotes
rwxrob ef1b348
readme updates for forked
rwxrob 01f5048
ellipsis fix started en em
rwxrob fb9479e
nixed screenshots
rwxrob f08d1fe
vim syntax for Plug
rwxrob 203ca03
fixed vint
rwxrob 82c0165
die die die stupid wasteful action
rwxrob 7e430a6
fuck vint
rwxrob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,13 +3,14 @@ scriptencoding utf-8 | |
| " | ||
| " Vim syntax file | ||
| " | ||
| " Language: Pandoc (superset of Markdown) | ||
| " Maintainer: Felipe Morales <[email protected]> | ||
| " Maintainer: Caleb Maclennan <[email protected]> | ||
| " Language: Simplified Pandoc (superset of Markdown) | ||
| " Maintainer: Rob Muhlestein (twitch.tv/rwxrob) <[email protected]> | ||
| " Contributor: Felipe Morales <[email protected]> | ||
| " Contributor: Caleb Maclennan <[email protected]> | ||
| " Contributor: David Sanson <[email protected]> | ||
| " Contributor: Jorge Israel Peña <[email protected]> | ||
| " OriginalAuthor: Jeremy Schultz <[email protected]> | ||
| " Version: 5.0 | ||
| " Version: 5.1 | ||
|
|
||
| " Configuration: {{{1 | ||
| " | ||
|
|
@@ -223,6 +224,14 @@ endif | |
|
|
||
| " Syntax Rules: {{{1 | ||
|
|
||
| " corrects distracting conceal (ligature) background colors, blue makes | ||
| " it obvious that the character is a ligature instead of an actual Unicode | ||
| " character since both can exist in the same file | ||
| hi Conceal ctermbg=none ctermfg=Blue | ||
|
|
||
| " preferable link color to underlining | ||
| hi link pandocDelimitedCodeBlock pandocNoFormatted | ||
|
|
||
| " Embeds: {{{2 | ||
|
|
||
| " HTML: {{{3 | ||
|
|
@@ -264,7 +273,7 @@ syn match pandocTitleBlockTitle /\%^%.*\n/ contained containedin=pandocTitleBloc | |
| " }}}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 pandocBlockQuote /^\s\{,3}>.*\n\(.*\n\@1<!\n\)*/ contains=@Spell,pandocEmphasis,pandocStrong,pandocPCite,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocUListItem,pandocNoFormatted,pandocAmpersandEscape,pandocLaTeXInlineMath,pandocEscapedDollar,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXRegion,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe skipnl | ||
| syn match pandocBlockQuoteMark /\_^\s\{,3}>/ contained containedin=pandocEmphasis,pandocStrong,pandocPCite,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocUListItem,pandocNoFormatted | ||
| " }}}2 | ||
|
|
||
|
|
@@ -368,11 +377,11 @@ call s:WithConceal('strikeout', 'syn match pandocStrikeoutMark /\~\~/ contained | |
| " }}}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 pandocAtxHeader /\(\%^\|<.\+>.*\n\|^\s*\n\)\@<=#\{1,6}.*\n/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe,pandocEllipses,@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 pandocSetexHeader /^.\+\n[=]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe,pandocEllipses,@Spell,pandocAmpersandEscape | ||
| syn match pandocSetexHeader /^.\+\n[-]\+$/ contains=pandocEmphasis,pandocStrong,pandocNoFormatted,pandocLaTeXInlineMath,pandocEscapedDollar,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe,pandocEllipses,@Spell,pandocAmpersandEscape | ||
| syn match pandocHeaderAttr /{.*}/ contained containedin=pandocAtxHeader,pandocSetexHeader | ||
| syn match pandocHeaderID /#[-_:.[:lower:][:upper:]]*/ contained containedin=pandocHeaderAttr | ||
| " }}}2 | ||
|
|
@@ -452,12 +461,12 @@ call s:WithConceal('abbrev', 'syn match pandocAbbreviationTail /\]/ contained co | |
| 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 | ||
| syn region pandocFootnoteDef start=/\^\[/ skip=/\[.\{-}]/ end=/\]/ contains=pandocReferenceLabel,pandocReferenceURL,pandocLatex,pandocPCite,pandocCiteKey,pandocStrong,pandocEmphasis,pandocStrongEmphasis,pandocNoFormatted,pandocSuperscript,pandocSubscript,pandocStrikeout,pandocEnDash,pandocEmDash,pandocEllipses,pandocBeginQuote,pandocEndQuote,pandocBeginSQuote,pandocEndSQuote,pandocApostrophe,@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 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,pandocBeginSQuote,pandocEndSQuote,pandocApostophe,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']) | ||
|
|
@@ -500,19 +509,19 @@ endif | |
|
|
||
| " Emdashes: {{{3 | ||
| if &encoding ==# 'utf-8' | ||
| call s:WithConceal('emdashes', 'syn match pandocEllipses /\([^-]\)\@<=---\([^-]\)\@=/ display', 'conceal cchar=—') | ||
| call s:WithConceal('emdashes', 'syn match pandocEmdashes /---/ containedin=pandocSetexHeader,pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar=—') | ||
| endif | ||
| " }}}3 | ||
|
|
||
| " Endashes: {{{3 | ||
| if &encoding ==# 'utf-8' | ||
| call s:WithConceal('endashes', 'syn match pandocEllipses /\([^-]\)\@<=--\([^-]\)\@=/ display', 'conceal cchar=–') | ||
| call s:WithConceal('endashes', 'syn match pandocEndashes /\([^-]\)\@<=--\([^-]\)\@=/ display', 'conceal cchar=–') | ||
| endif | ||
| " }}}3 | ||
|
|
||
| " Ellipses: {{{3 | ||
| if &encoding ==# 'utf-8' | ||
| call s:WithConceal('ellipses', 'syn match pandocEllipses /\.\.\./ display', 'conceal cchar=…') | ||
| call s:WithConceal('ellipses', 'syn match pandocEllipses /\.\.\./ containedin=pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar=…') | ||
| endif | ||
| " }}}3 | ||
|
|
||
|
|
@@ -522,6 +531,19 @@ if &encoding ==# 'utf-8' | |
| call s:WithConceal('quotes', 'syn match pandocEndQuote /\(\>[[:punct:]]*\)\@<="[[:blank:][:punct:]\n]\@=/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar=”') | ||
| endif | ||
| " }}}3 | ||
| " | ||
| " Apostrophes: {{{3 | ||
| if &encoding ==# 'utf-8' | ||
| call s:WithConceal('apostrophes', 'syn match pandocApostrophe /[*~_\n[:space:]]\@<!''/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar=’') | ||
| endif | ||
| " }}}3 | ||
|
|
||
| " Single Quotes: {{{3 | ||
| if &encoding ==# 'utf-8' | ||
| call s:WithConceal('squotes', 'syn match pandocBeginSQuote /[_*\n[:space:]]\@<=''\</ containedin=pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar=‘') | ||
| call s:WithConceal('squotes', 'syn match pandocEndSQuote /\(\>[[:punct:]]*\)\@<=''[[:blank:][:punct:]\n]\@=/ containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar=’') | ||
| endif | ||
| " }}}3 | ||
|
|
||
| " Hrule: {{{3 | ||
| syn match pandocHRule /^\s*\([*\-_]\)\s*\%(\1\s*\)\{2,}$/ display | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # Smart Punctuation | ||
|
|
||
| # Ellipses ... | ||
|
|
||
| Ellipses ... | ||
| ---------- | ||
|
|
||
| Ellipses ... | ||
| ========== | ||
|
|
||
| And then there was ... | ||
|
|
||
| Blah ... blah. | ||
|
|
||
| ... and yet. | ||
| ...and yet. | ||
|
|
||
| * I'm in a bullet... | ||
|
|
||
| Endash -- | ||
| ---------- | ||
|
|
||
| Endash -- | ||
| ========== | ||
|
|
||
| And then there was -- | ||
|
|
||
| Blah--blah. | ||
| Blah -- blah. | ||
|
|
||
| -- and yet. | ||
| --and yet. | ||
|
|
||
| * I'm in a bullet... | ||
|
|
||
| Emdash --- | ||
| --------- | ||
|
|
||
| Emdash --- | ||
| ========== | ||
|
|
||
| And then there was --- | ||
|
|
||
| Blah---blah. | ||
| Blah --- blah. | ||
|
|
||
| --- and yet. | ||
| ---and yet. | ||
|
|
||
| # "Foo" is a thing | ||
|
|
||
| A "Foo" is a thing | ||
| ------------------ | ||
|
|
||
| A "Foo" is a thing | ||
| ================== | ||
|
|
||
| Just some "foo" here. | ||
| Are you a "foo"? | ||
|
|
||
| "Foo" | ||
| *"Foo"* | ||
| **"Foo"** | ||
| _"Foo"_ | ||
| __"Foo"__ | ||
| ~~"Foo"~~ | ||
|
|
||
| # 'Bar' | ||
|
|
||
| 'Bar' | ||
| ----- | ||
|
|
||
| 'Bar' | ||
| ===== | ||
|
|
||
| Just some 'bar' here. | ||
| Are you a 'bar'? | ||
|
|
||
| 'Bar' | ||
| *'Bar'* | ||
| **'Bar'** | ||
| _'Bar'_ | ||
| __'Bar'__ | ||
| ~~'Bar'~~ | ||
|
|
||
| # I'd Really Like to Know | ||
|
|
||
| I'd Really Like to Know | ||
| ----------------------- | ||
|
|
||
| I'd Really Like to Know | ||
| ======================= | ||
|
|
||
| I'd | ||
| 'cuz |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be linked to an existing highlight group of some sort rather than hard coding a color? That way it will play nice with themes.
Special,Macro, orCharactermight work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think this might be better left to color schemes entirely. I get that the vim defaults are pretty bad, but for any color scheme that does try to set the colors for
Concealhaving a plugin hard code an override for that is kind of rough luck. I think I'd rather see this bit contributed to whatever colorscheme you use and/or added to users' vim-rc file.