Commits

Vinícius Figueiredo  committed 3b2cb9c

Settings for Markdown editing.

  • Participants
  • Parent commits 2446939

Comments (0)

Files changed (6)

+syntax: glob
+*backup*

File _vim/colors/jellybeans.vim

+" Vim color file
+"
+"  "    __       _ _       _                             "
+"  "    \ \  ___| | |_   _| |__   ___  __ _ _ __  ___    "
+"  "     \ \/ _ \ | | | | |  _ \ / _ \/ _  |  _ \/ __|   "
+"  "  /\_/ /  __/ | | |_| | |_| |  __/ |_| | | | \__ \   "
+"  "  \___/ \___|_|_|\__  |____/ \___|\____|_| |_|___/   "
+"  "                 \___/                               "
+"
+"         "A colorful, dark color scheme for Vim."
+"
+" File:         jellybeans.vim
+" Maintainer:   NanoTech <http://nanotech.nanotechcorp.net/>
+" Version:      1.2
+" Last Change:  May 26th, 2009
+" Contributors: Daniel Herbert <http://pocket-ninja.com>,
+"               Henry So, Jr. <henryso@panix.com>,
+"               David Liang <bmdavll at gmail dot com>
+"
+" Copyright (c) 2009 NanoTech
+"
+" 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.
+
+set background=dark
+
+hi clear
+
+if exists("syntax_on")
+	syntax reset
+endif
+
+let colors_name = "jellybeans"
+
+if has("gui_running") || &t_Co == 88 || &t_Co == 256
+	let s:low_color = 0
+else
+	let s:low_color = 1
+endif
+
+" Color approximation functions by Henry So, Jr. and David Liang {{{
+" Added to jellybeans.vim by Daniel Herbert
+
+" returns an approximate grey index for the given grey level
+fun! s:grey_number(x)
+	if &t_Co == 88
+		if a:x < 23
+			return 0
+		elseif a:x < 69
+			return 1
+		elseif a:x < 103
+			return 2
+		elseif a:x < 127
+			return 3
+		elseif a:x < 150
+			return 4
+		elseif a:x < 173
+			return 5
+		elseif a:x < 196
+			return 6
+		elseif a:x < 219
+			return 7
+		elseif a:x < 243
+			return 8
+		else
+			return 9
+		endif
+	else
+		if a:x < 14
+			return 0
+		else
+			let l:n = (a:x - 8) / 10
+			let l:m = (a:x - 8) % 10
+			if l:m < 5
+				return l:n
+			else
+				return l:n + 1
+			endif
+		endif
+	endif
+endfun
+
+" returns the actual grey level represented by the grey index
+fun! s:grey_level(n)
+	if &t_Co == 88
+		if a:n == 0
+			return 0
+		elseif a:n == 1
+			return 46
+		elseif a:n == 2
+			return 92
+		elseif a:n == 3
+			return 115
+		elseif a:n == 4
+			return 139
+		elseif a:n == 5
+			return 162
+		elseif a:n == 6
+			return 185
+		elseif a:n == 7
+			return 208
+		elseif a:n == 8
+			return 231
+		else
+			return 255
+		endif
+	else
+		if a:n == 0
+			return 0
+		else
+			return 8 + (a:n * 10)
+		endif
+	endif
+endfun
+
+" returns the palette index for the given grey index
+fun! s:grey_color(n)
+	if &t_Co == 88
+		if a:n == 0
+			return 16
+		elseif a:n == 9
+			return 79
+		else
+			return 79 + a:n
+		endif
+	else
+		if a:n == 0
+			return 16
+		elseif a:n == 25
+			return 231
+		else
+			return 231 + a:n
+		endif
+	endif
+endfun
+
+" returns an approximate color index for the given color level
+fun! s:rgb_number(x)
+	if &t_Co == 88
+		if a:x < 69
+			return 0
+		elseif a:x < 172
+			return 1
+		elseif a:x < 230
+			return 2
+		else
+			return 3
+		endif
+	else
+		if a:x < 75
+			return 0
+		else
+			let l:n = (a:x - 55) / 40
+			let l:m = (a:x - 55) % 40
+			if l:m < 20
+				return l:n
+			else
+				return l:n + 1
+			endif
+		endif
+	endif
+endfun
+
+" returns the actual color level for the given color index
+fun! s:rgb_level(n)
+	if &t_Co == 88
+		if a:n == 0
+			return 0
+		elseif a:n == 1
+			return 139
+		elseif a:n == 2
+			return 205
+		else
+			return 255
+		endif
+	else
+		if a:n == 0
+			return 0
+		else
+			return 55 + (a:n * 40)
+		endif
+	endif
+endfun
+
+" returns the palette index for the given R/G/B color indices
+fun! s:rgb_color(x, y, z)
+	if &t_Co == 88
+		return 16 + (a:x * 16) + (a:y * 4) + a:z
+	else
+		return 16 + (a:x * 36) + (a:y * 6) + a:z
+	endif
+endfun
+
+" returns the palette index to approximate the given R/G/B color levels
+fun! s:color(r, g, b)
+	" get the closest grey
+	let l:gx = s:grey_number(a:r)
+	let l:gy = s:grey_number(a:g)
+	let l:gz = s:grey_number(a:b)
+
+	" get the closest color
+	let l:x = s:rgb_number(a:r)
+	let l:y = s:rgb_number(a:g)
+	let l:z = s:rgb_number(a:b)
+
+	if l:gx == l:gy && l:gy == l:gz
+		" there are two possibilities
+		let l:dgr = s:grey_level(l:gx) - a:r
+		let l:dgg = s:grey_level(l:gy) - a:g
+		let l:dgb = s:grey_level(l:gz) - a:b
+		let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
+		let l:dr = s:rgb_level(l:gx) - a:r
+		let l:dg = s:rgb_level(l:gy) - a:g
+		let l:db = s:rgb_level(l:gz) - a:b
+		let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
+		if l:dgrey < l:drgb
+			" use the grey
+			return s:grey_color(l:gx)
+		else
+			" use the color
+			return s:rgb_color(l:x, l:y, l:z)
+		endif
+	else
+		" only one possibility
+		return s:rgb_color(l:x, l:y, l:z)
+	endif
+endfun
+
+" returns the palette index to approximate the 'rrggbb' hex string
+fun! s:rgb(rgb)
+	let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
+	let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
+	let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
+	return s:color(l:r, l:g, l:b)
+endfun
+
+" sets the highlighting for the given group
+fun! s:X(group, fg, bg, attr, lcfg, lcbg)
+	if s:low_color
+		let l:fge = empty(a:lcfg)
+		let l:bge = empty(a:lcbg)
+
+		if !l:fge && !l:bge
+			exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=".a:lcbg
+		elseif !l:fge && l:bge
+			exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=NONE"
+		elseif l:fge && !l:bge
+			exec "hi ".a:group." ctermfg=NONE ctermbg=".a:lcbg
+		endif
+	else
+		let l:fge = empty(a:fg)
+		let l:bge = empty(a:bg)
+
+		if !l:fge && !l:bge
+			exec "hi ".a:group." guifg=#".a:fg." guibg=#".a:bg." ctermfg=".s:rgb(a:fg)." ctermbg=".s:rgb(a:bg)
+		elseif !l:fge && l:bge
+			exec "hi ".a:group." guifg=#".a:fg." guibg=NONE ctermfg=".s:rgb(a:fg)
+		elseif l:fge && !l:bge
+			exec "hi ".a:group." guifg=NONE guibg=#".a:bg." ctermbg=".s:rgb(a:bg)
+		endif
+	endif
+
+	if a:attr == ""
+		exec "hi ".a:group." gui=none cterm=none"
+	else
+		if a:attr == 'italic'
+			exec "hi ".a:group." gui=".a:attr." cterm=none"
+		else
+			exec "hi ".a:group." gui=".a:attr." cterm=".a:attr
+		endif
+	endif
+endfun
+" }}}
+
+if version >= 700
+  call s:X("CursorLine","","1c1c1c","","","")
+  call s:X("CursorColumn","","1c1c1c","","","")
+  call s:X("MatchParen","ffffff","80a090","bold","","")
+
+  call s:X("TabLine","000000","b0b8c0","italic","","Black")
+  call s:X("TabLineFill","9098a0","","","","")
+  call s:X("TabLineSel","000000","f0f0f0","italic,bold","","")
+
+  " Auto-completion
+  call s:X("Pmenu","ffffff","000000","","","")
+  call s:X("PmenuSel","101010","eeeeee","","","")
+endif
+
+call s:X("Visual","","404040","","","")
+call s:X("Cursor","","b0d0f0","","","")
+
+call s:X("Normal","e8e8d3","151515","","White","")
+call s:X("LineNr","605958","151515","none","Black","")
+call s:X("Comment","888888","","italic","Grey","")
+call s:X("Todo","808080","","bold","","")
+
+call s:X("StatusLine","f0f0f0","101010","italic","","")
+call s:X("StatusLineNC","a0a0a0","181818","italic","","")
+call s:X("VertSplit","181818","181818","italic","","")
+
+call s:X("Folded","a0a8b0","384048","italic","black","")
+call s:X("FoldColumn","a0a8b0","384048","","","")
+call s:X("SignColumn","a0a8b0","384048","","","")
+
+call s:X("Title","70b950","","bold","","")
+
+call s:X("Constant","cf6a4c","","","Red","")
+call s:X("Special","799d6a","","","Green","")
+call s:X("Delimiter","668799","","","Grey","")
+
+call s:X("String","99ad6a","","","Green","")
+call s:X("StringDelimiter","556633","","","DarkGreen","")
+
+call s:X("Identifier","c6b6ee","","","LightCyan","")
+call s:X("Structure","8fbfdc","","","LightCyan","")
+call s:X("Function","fad07a","","","Yellow","")
+call s:X("Statement","8197bf","","","DarkBlue","")
+call s:X("PreProc","8fbfdc","","","LightBlue","")
+
+hi link Operator Normal
+
+call s:X("Type","ffb964","","","Yellow","")
+call s:X("NonText","808080","151515","","","")
+
+call s:X("SpecialKey","808080","343434","","","")
+
+call s:X("Search","f0a0c0","302028","underline","Magenta","")
+
+call s:X("Directory","dad085","","","","")
+call s:X("ErrorMsg","","902020","","","")
+hi link Error ErrorMsg
+
+" Diff
+
+hi link diffRemoved Constant
+hi link diffAdded String
+
+" VimDiff
+
+call s:X("DiffAdd","","032218","","Black","DarkGreen")
+call s:X("DiffChange","","100920","","Black","DarkMagenta")
+call s:X("DiffDelete","220000","220000","","DarkRed","DarkRed")
+call s:X("DiffText","","000940","","","DarkRed")
+
+" PHP
+
+hi link phpFunctions Function
+call s:X("StorageClass","c59f6f","","","Red","")
+hi link phpSuperglobal Identifier
+hi link phpQuoteSingle StringDelimiter
+hi link phpQuoteDouble StringDelimiter
+hi link phpBoolean Constant
+hi link phpNull Constant
+hi link phpArrayPair Operator
+
+" Ruby
+
+hi link rubySharpBang Comment
+call s:X("rubyClass","447799","","","DarkBlue","")
+call s:X("rubyIdentifier","c6b6fe","","","","")
+
+call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","")
+call s:X("rubySymbol","7697d6","","","Blue","")
+hi link rubyGlobalVariable rubyInstanceVariable
+hi link rubyModule rubyClass
+call s:X("rubyControl","7597c6","","","","")
+
+hi link rubyString String
+hi link rubyStringDelimiter StringDelimiter
+hi link rubyInterpolationDelimiter Identifier
+
+call s:X("rubyRegexpDelimiter","540063","","","Magenta","")
+call s:X("rubyRegexp","dd0093","","","DarkMagenta","")
+call s:X("rubyRegexpSpecial","a40073","","","Magenta","")
+
+call s:X("rubyPredefinedIdentifier","de5577","","","Red","")
+
+" JavaScript
+hi link javaScriptValue Constant
+hi link javaScriptRegexpString rubyRegexp
+
+" Tag list
+hi link TagListFileName Directory
+
+" delete functions {{{
+delf s:X
+delf s:rgb
+delf s:color
+delf s:rgb_color
+delf s:rgb_level
+delf s:rgb_number
+delf s:grey_color
+delf s:grey_level
+delf s:grey_number
+" }}}

File _vim/ftdetect/markdown.vim

+" Markdown
+autocmd BufNewFile,BufRead *.{md,mkd,mkdn,mark*} set filetype=markdown

File _vim/snippets/markdown.snippets

+# [link][]
+snippet []
+	[${1:link_id}][]${2}
+# [link][id]
+snippet [[
+	[${1:link}][${2:id}]${3}
+# [link](url)
+snippet [(
+	[${1:link}](http://${2:url})${3}
+# [link](email)
+snippet [@
+	[${1:link}(mailto:${2:email})${3}
+# [link](url "title")
+snippet [("
+	[${1:link}](${2:url} "${3:title}")${4}
+# [id]: url "title"
+snippet [:
+	[${1:id}]: http://${2:url} "${3:title}"
+# [id]: email "title"
+snippet [:@
+	[${1:id}]: mailto:${2:url} "${3:title}"
+# ![alt][id]
+snippet ![
+	![${1:alt}][${2:id}]${3}
+# ![alt](url)
+snippet !(
+	![${1:alt}](${2:url})${3}
+# ![alt](url "title")
+snippet !("
+	![${1:alt}](${2:url} "${3:title}")${4}
+# *emphasis* or _emphasis_
+snippet *
+	*${1}*${2}
+snippet _
+	_${1}_${2}
+# **strong** or __strong__
+snippet **
+	**${1}**${2}
+snippet __
+	__${1}__${2}
+# `code`
+snippet `
+	`${1}`${2}

File _vim/syntax/markdown.vim

+" Vim syntax file
+" Language:     Markdown
+" Author:       Ben Williams <benw@plasticboy.com>
+" Maintainer:   Hallison Batista <email@hallisonbatista.com>
+" URL:          http://plasticboy.com/markdown-vim-mode/
+" Version:      1.0.1
+" Last Change:  Fri Dec  4 08:36:48 AMT 2009
+" Remark:       Uses HTML syntax file
+" Remark:       I don't do anything with angle brackets (<>) because that would too easily
+"               easily conflict with HTML syntax
+" TODO: Handle stuff contained within stuff (e.g. headings within blockquotes)
+
+" Read the HTML syntax to start with
+if version < 600
+  so <sfile>:p:h/html.vim
+else
+  runtime! syntax/html.vim
+  unlet b:current_syntax
+endif
+
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+" Don't use standard HiLink, it will not work with included syntax files
+if version < 508
+  command! -nargs=+ HtmlHiLink hi link <args>
+else
+  command! -nargs=+ HtmlHiLink hi def link <args>
+endif
+
+syntax spell toplevel
+syntax case ignore
+syntax sync linebreaks=1
+
+" Additions to HTML groups
+syntax region htmlBold    start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\*\@!/  end=/\\\@<!\*\@<!\*\*\*\@!\($\|\A\)\@=/  contains=htmlItalic,@Spell
+syntax region htmlItalic  start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\@!/    end=/\\\@<!\*\@<!\*\*\@!\($\|\A\)\@=/    contains=htmlBold,@Spell
+syntax region htmlBold    start=/\\\@<!\(^\|\A\)\@=_\@<!___\@!/      end=/\\\@<!_\@<!___\@!\($\|\A\)\@=/      contains=htmlItalic,@Spell
+syntax region htmlItalic  start=/\\\@<!\(^\|\A\)\@=_\@<!__\@!/       end=/\\\@<!_\@<!__\@!\($\|\A\)\@=/       contains=htmlBold,@Spell
+
+" [link](URL) | [link][id] | [link][]
+syntax region mkdLink matchgroup=mkdDelimiter start="\!\?\["  end="\]\ze\s*[[(]" contains=@Spell nextgroup=mkdURL,mkdID skipwhite oneline
+syntax region mkdID   matchgroup=mkdDelimiter start="\["      end="\]" contained
+syntax region mkdURL  matchgroup=mkdDelimiter start="("       end=")"  contained
+
+" Link definitions: [id]: URL (Optional Title)
+" TODO handle automatic links without colliding with htmlTag (<URL>)
+syntax region mkdLinkDef matchgroup=mkdDelimiter   start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
+syntax region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]"   contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline
+syntax region mkdLinkTitle matchgroup=mkdDelimiter start=+"+     end=+"+  contained
+syntax region mkdLinkTitle matchgroup=mkdDelimiter start=+'+     end=+'+  contained
+syntax region mkdLinkTitle matchgroup=mkdDelimiter start=+(+     end=+)+  contained
+
+" Define Markdown groups
+syntax match  mkdLineContinue ".$" contained
+syntax match  mkdRule      /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
+syntax match  mkdRule      /^\s*-\s\{0,1}-\s\{0,1}-$/
+syntax match  mkdRule      /^\s*_\s\{0,1}_\s\{0,1}_$/
+syntax match  mkdRule      /^\s*-\{3,}$/
+syntax match  mkdRule      /^\s*\*\{3,5}$/
+syntax match  mkdListItem  "^\s*[-*+]\s\+"
+syntax match  mkdListItem  "^\s*\d\+\.\s\+"
+syntax match  mkdCode      /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
+syntax match  mkdLineBreak /  \+$/
+syntax region mkdCode       start=/\\\@<!`/     end=/\\\@<!`/
+syntax region mkdCode       start=/\s*``[^`]*/  end=/[^`]*``\s*/
+syntax region mkdBlockquote start=/^\s*>/       end=/$/           contains=mkdLineBreak,mkdLineContinue,@Spell
+syntax region mkdCode       start="<pre[^>]*>"  end="</pre>"
+syntax region mkdCode       start="<code[^>]*>" end="</code>"
+
+" HTML headings
+syntax region htmlH1       start="^\s*#"                   end="\($\|#\+\)" contains=@Spell
+syntax region htmlH2       start="^\s*##"                  end="\($\|#\+\)" contains=@Spell
+syntax region htmlH3       start="^\s*###"                 end="\($\|#\+\)" contains=@Spell
+syntax region htmlH4       start="^\s*####"                end="\($\|#\+\)" contains=@Spell
+syntax region htmlH5       start="^\s*#####"               end="\($\|#\+\)" contains=@Spell
+syntax region htmlH6       start="^\s*######"              end="\($\|#\+\)" contains=@Spell
+syntax match  htmlH1       /^.\+\n=\+$/ contains=@Spell
+syntax match  htmlH2       /^.\+\n-\+$/ contains=@Spell
+
+"highlighting for Markdown groups
+HtmlHiLink mkdString        String
+HtmlHiLink mkdCode          String
+HtmlHiLink mkdBlockquote    Comment
+HtmlHiLink mkdLineContinue  Comment
+HtmlHiLink mkdListItem      Identifier
+HtmlHiLink mkdRule          Identifier
+HtmlHiLink mkdLineBreak     Todo
+HtmlHiLink mkdLink          htmlLink
+HtmlHiLink mkdURL           htmlString
+HtmlHiLink mkdID            Identifier
+HtmlHiLink mkdLinkDef       mkdID
+HtmlHiLink mkdLinkDefTarget mkdURL
+HtmlHiLink mkdLinkTitle     htmlString
+
+HtmlHiLink mkdDelimiter     Delimiter
+
+let b:current_syntax = "markdown"
+
+delcommand HtmlHiLink
+" vim: tabstop=2
 
 " vim
 autocmd FileType vim setlocal expandtab shiftwidth=2 tabstop=8 softtabstop=2
+
+" Markdown
+autocmd FileType markdown setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4