Syntax highlighting for textile
This commit is contained in:
parent
fdf5e69ba4
commit
6d2b695496
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -289,3 +289,6 @@
|
|||||||
[submodule "vim/bundle/briandoll-change-inside-surroundings"]
|
[submodule "vim/bundle/briandoll-change-inside-surroundings"]
|
||||||
path = vim/bundle/briandoll-change-inside-surroundings
|
path = vim/bundle/briandoll-change-inside-surroundings
|
||||||
url = https://github.com/briandoll/change-inside-surroundings.vim.git
|
url = https://github.com/briandoll/change-inside-surroundings.vim.git
|
||||||
|
[submodule "vim/bundle/timcharper-textile"]
|
||||||
|
path = vim/bundle/timcharper-textile
|
||||||
|
url = https://github.com/timcharper/textile.vim.git
|
||||||
|
2
vim/bundle/timcharper-textile/.gitignore
vendored
Normal file
2
vim/bundle/timcharper-textile/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
textile*.zip
|
||||||
|
*.swp
|
4
vim/bundle/timcharper-textile/README.textile
Normal file
4
vim/bundle/timcharper-textile/README.textile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
h1. A textile plugin for vim
|
||||||
|
|
||||||
|
"See the documentation":http://github.com/timcharper/textile.vim/raw/master/doc/textile.txt
|
||||||
|
|
66
vim/bundle/timcharper-textile/doc/textile.txt
Normal file
66
vim/bundle/timcharper-textile/doc/textile.txt
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
*textile.txt* Textile for Vim Last Change: November 3, 2008
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
REQUIREMENTS *textile-requirements*
|
||||||
|
|
||||||
|
- ruby - http://ruby-lang.org/ (seperate executable, not compiled in)
|
||||||
|
- RedCloth - http://redcloth.org/
|
||||||
|
|
||||||
|
Files with the extension *.textile will auto-detected. If editing a new file,
|
||||||
|
or otherwise, run ":setf textile" to enable textile commands.
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
CHANGELOG *textile-changelog*
|
||||||
|
|
||||||
|
0.3 - Fixed keymappings in the documentation
|
||||||
|
0.2 - Added multiple colors for headers, and alternating colors for list
|
||||||
|
items
|
||||||
|
- Fixed error in the vim script for TextileRenderBufferToFile
|
||||||
|
- Changed shortcut keys from \tp to \rp (render preview instead of
|
||||||
|
textile preview, since it's file-type specific anyways)
|
||||||
|
0.1 - Initial Release
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
COMMANDS *textile-commands*
|
||||||
|
|
||||||
|
:TextilePreview - Render the current buffer to a temp file, and open it in
|
||||||
|
your web browser (OSX only)
|
||||||
|
|
||||||
|
<Leader>rp
|
||||||
|
|
||||||
|
:TextileRenderTab - ... to a new tab
|
||||||
|
|
||||||
|
<Leader>rt
|
||||||
|
|
||||||
|
:TextileRenderFile - ... to a file
|
||||||
|
|
||||||
|
<Leader>rf
|
||||||
|
|
||||||
|
<Leader> is \ by default, so <Leader>rp == \rp
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
CONFIG *textile-config*
|
||||||
|
|
||||||
|
MAC OS X:
|
||||||
|
|
||||||
|
Optional:
|
||||||
|
set g:TextileBrowser="Google Chrome" - Open preview in "Google Chrome"
|
||||||
|
rather than Safari (optional)
|
||||||
|
|
||||||
|
Other:
|
||||||
|
|
||||||
|
Mandatory:
|
||||||
|
set g:TextileOS="Linux"
|
||||||
|
set g:TextileBrowser="/path/to/browser_bin"
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
CREDITS *textile-credits*
|
||||||
|
|
||||||
|
- "Dominic Mitchell":http://happygiraffe.net/: initial syntax highlighting
|
||||||
|
- "Aaron Bieber":http://blog.aaronbieber.com/: improved syntax highlighting
|
||||||
|
- "Tim Harper":http://tim.theenchanter.com/ : improved syntax highlighting,
|
||||||
|
plugin
|
||||||
|
|
||||||
|
vim:tw=78:noet:wrap:ts=2:expandtab:ft=help:norl:
|
8
vim/bundle/timcharper-textile/ftdetect/textile.vim
Normal file
8
vim/bundle/timcharper-textile/ftdetect/textile.vim
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
" textile.vim
|
||||||
|
"
|
||||||
|
" Tim Harper (tim.theenchanter.com)
|
||||||
|
|
||||||
|
" Force filetype to be textile even if already set
|
||||||
|
" This will override the system ftplugin/changelog
|
||||||
|
" set on some distros
|
||||||
|
au BufRead,BufNewFile *.textile set filetype=textile
|
59
vim/bundle/timcharper-textile/ftplugin/textile.vim
Normal file
59
vim/bundle/timcharper-textile/ftplugin/textile.vim
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
" textile.vim
|
||||||
|
"
|
||||||
|
" Tim Harper (tim.theenchanter.com)
|
||||||
|
|
||||||
|
command! -nargs=0 TextileRenderFile call TextileRenderBufferToFile()
|
||||||
|
command! -nargs=0 TextileRenderTab call TextileRenderBufferToTab()
|
||||||
|
command! -nargs=0 TextilePreview call TextileRenderBufferToPreview()
|
||||||
|
noremap <buffer> <Leader>rp :TextilePreview<CR>
|
||||||
|
noremap <buffer> <Leader>rf :TextileRenderFile<CR>
|
||||||
|
noremap <buffer> <Leader>rt :TextileRenderTab<CR>
|
||||||
|
setlocal ignorecase
|
||||||
|
setlocal wrap
|
||||||
|
setlocal lbr
|
||||||
|
|
||||||
|
function! TextileRender(lines)
|
||||||
|
if (system('which ruby') == "")
|
||||||
|
throw "Could not find ruby!"
|
||||||
|
end
|
||||||
|
|
||||||
|
let text = join(a:lines, "\n")
|
||||||
|
let html = system("ruby -e \"def e(msg); puts msg; exit 1; end; begin; require 'rubygems'; rescue LoadError; e('rubygems not found'); end; begin; require 'redcloth'; rescue LoadError; e('RedCloth gem not installed. Run this from the terminal: sudo gem install RedCloth'); end; puts(RedCloth.new(\\$stdin.read).to_html(:textile))\"", text)
|
||||||
|
return html
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! TextileRenderFile(lines, filename)
|
||||||
|
let html = TextileRender(getbufline(bufname("%"), 1, '$'))
|
||||||
|
let html = "<html><head><title>" . bufname("%") . "</title></head><body>\n" . html . "\n</body></html>"
|
||||||
|
return writefile(split(html, "\n"), a:filename)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! TextileRenderBufferToPreview()
|
||||||
|
let filename = "/tmp/textile-preview.html"
|
||||||
|
call TextileRenderFile(getbufline(bufname("%"), 1, '$'), filename)
|
||||||
|
" Verify if browser was set
|
||||||
|
if !exists("g:TextileBrowser")
|
||||||
|
let g:TextileBrowser='Safari'
|
||||||
|
endif
|
||||||
|
" call configured browser according OS
|
||||||
|
if !exists("g:TextileOS") || g:TextileOS == 'mac'
|
||||||
|
call system("open -a \"".g:TextileBrowser."\" ".filename)
|
||||||
|
else
|
||||||
|
echo g:TextileBrowser." ".filename
|
||||||
|
call system(g:TextileBrowser." ".filename)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! TextileRenderBufferToFile()
|
||||||
|
let filename = input("Filename:", substitute(bufname("%"), "textile$", "html", ""), "file")
|
||||||
|
call TextileRenderFile(getbufline(bufname("%"), 1, '$'), filename)
|
||||||
|
echo "Rendered to '" . filename . "'"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! TextileRenderBufferToTab()
|
||||||
|
let html = TextileRender(getbufline(bufname("%"), 1, '$'))
|
||||||
|
tabnew
|
||||||
|
call append("^", split(html, "\n"))
|
||||||
|
set syntax=html
|
||||||
|
endfunction
|
||||||
|
|
9
vim/bundle/timcharper-textile/package.sh
Executable file
9
vim/bundle/timcharper-textile/package.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd `dirname "$0"`
|
||||||
|
VERSION=`git tag | sort_rev | tail -n 1`
|
||||||
|
git archive --prefix=textile/ $VERSION | tar xf -
|
||||||
|
rm textile/.gitignore textile/package.sh
|
||||||
|
|
||||||
|
zip -r textile-$VERSION.zip textile
|
||||||
|
rm -rf textile
|
91
vim/bundle/timcharper-textile/syntax/textile.vim
Normal file
91
vim/bundle/timcharper-textile/syntax/textile.vim
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
"
|
||||||
|
" You will have to restart vim for this to take effect. In any case
|
||||||
|
" it is a good idea to read ":he new-filetype" so that you know what
|
||||||
|
" is going on, and why the above lines work.
|
||||||
|
"
|
||||||
|
" Written originally by Dominic Mitchell, Jan 2006.
|
||||||
|
" happygiraffe.net
|
||||||
|
"
|
||||||
|
" Modified by Aaron Bieber, May 2007.
|
||||||
|
" blog.aaronbieber.com
|
||||||
|
"
|
||||||
|
" Modified by Tim Harper, July 2008 - current
|
||||||
|
" tim.theenchanter.com
|
||||||
|
" @(#) $Id$
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Textile commands like "h1" are case sensitive, AFAIK.
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
" Textile syntax: <http://textism.com/tools/textile/>
|
||||||
|
|
||||||
|
" Inline elements.
|
||||||
|
syn match txtEmphasis /_[^_]\+_/
|
||||||
|
syn match txtBold /\*[^*]\+\*/
|
||||||
|
syn match txtCite /??.\+??/
|
||||||
|
syn match txtDeleted /-[^-]\+-/
|
||||||
|
syn match txtInserted /+[^+]\++/
|
||||||
|
syn match txtSuper /\^[^^]\+\^/
|
||||||
|
syn match txtSub /\~[^~]\+\~/
|
||||||
|
syn match txtSpan /%[^%]\+%/
|
||||||
|
syn match txtFootnoteRef /\[[0-9]\+]/
|
||||||
|
syn match txtCode /@[^@]\+@/
|
||||||
|
|
||||||
|
" Block elements.
|
||||||
|
syn match txtHeader /^h1\(([^)]*)\|{[^}]*}\|\[[^]]*\]\|[<>=()]\)*\. .\+/
|
||||||
|
syn match txtHeader2 /^h2\(([^)]*)\|{[^}]*}\|\[[^]]*\]\|[<>=()]\)*\. .\+/
|
||||||
|
syn match txtHeader3 /^h[3-6]\(([^)]*)\|{[^}]*}\|\[[^]]*\]\|[<>=()]\)*\..\+/
|
||||||
|
syn match txtFootnoteDef /^fn[0-9]\+\(([^)]*)\|{[^}]*}\|\[[^]]*\]\|[<>=()]\)*\./
|
||||||
|
syn match txtListBullet /\v^\*+ /
|
||||||
|
syn match txtListBullet2 /\v^(\*\*)+ /
|
||||||
|
syn match txtListNumber /\v^#+ /
|
||||||
|
syn match txtListNumber2 /\v^(##)+ /
|
||||||
|
|
||||||
|
syn region txtCodeblock start="^bc\(([^)]*)\|{[^}]*}\|\[[^]]*\]\|[<>=()]\)*\. " end="^$"
|
||||||
|
syn region txtBlockquote start="^bq\(([^)]*)\|{[^}]*}\|\[[^]]*\]\|[<>=()]\)*\. " end="^$"
|
||||||
|
syn region txtParagraph start="^bq\(([^)]*)\|{[^}]*}\|\[[^]]*\]\|[<>=()]\)*\. " end="^$"
|
||||||
|
|
||||||
|
syn cluster txtBlockElement contains=txtHeader,txtBlockElement,txtFootnoteDef,txtListBullet,txtListNumber
|
||||||
|
|
||||||
|
|
||||||
|
" Everything after the first colon is from RFC 2396, with extra
|
||||||
|
" backslashes to keep vim happy... Original:
|
||||||
|
" ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
|
||||||
|
"
|
||||||
|
" Revised the pattern to exclude spaces from the URL portion of the
|
||||||
|
" pattern. Aaron Bieber, 2007.
|
||||||
|
syn match txtLink /"[^"]\+":\(\([^:\/?# ]\+\):\)\?\(\/\/\([^\/?# ]*\)\)\?\([^?# ]*\)\(?\([^# ]*\)\)\?\(#\([^ ]*\)\)\?/
|
||||||
|
|
||||||
|
syn cluster txtInlineElement contains=txtEmphasis,txtBold,txtCite,txtDeleted,txtInserted,txtSuper,txtSub,txtSpan
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_txt_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_txt_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink txtHeader Title
|
||||||
|
HiLink txtHeader2 Question
|
||||||
|
HiLink txtHeader3 Statement
|
||||||
|
HiLink txtBlockquote Comment
|
||||||
|
HiLink txtCodeblock Identifier
|
||||||
|
HiLink txtListBullet Operator
|
||||||
|
HiLink txtListBullet2 Constant
|
||||||
|
HiLink txtListNumber Operator
|
||||||
|
HiLink txtListNumber2 Constant
|
||||||
|
HiLink txtLink String
|
||||||
|
HiLink txtCode Identifier
|
||||||
|
hi def txtEmphasis term=underline cterm=underline gui=italic
|
||||||
|
hi def txtBold term=bold cterm=bold gui=bold
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vim: set ai et sw=4 :
|
1
vim/plugin/settings/solarized.vim
Normal file
1
vim/plugin/settings/solarized.vim
Normal file
@ -0,0 +1 @@
|
|||||||
|
hi! link txtBold Identifier
|
Loading…
Reference in New Issue
Block a user