Skip to content
Browse files

Added distraction free plugins

  • Loading branch information...
1 parent 6cf8d4e commit 4740ab42a9569af4577b3699061d4df968cb73c0 @punjab committed Dec 9, 2012
Showing with 263 additions and 0 deletions.
  1. +66 −0 vim/colors/iawriter.vim
  2. +2 −0 vim/ftdetect/mkd.vim
  3. +90 −0 vim/plugin/DistractionFree.vim
  4. +105 −0 vim/syntax/mkd.vim
View
66 vim/colors/iawriter.vim
@@ -0,0 +1,66 @@
+"
+" Last Change: 2011/12/11
+" Maintainer: Jacek Dominiak <doj (at) ptpbs (dot) com>
+"
+" Description: Vim color file
+"
+
+set background=light
+hi clear
+if exists("syntax_on")
+ syntax reset
+endif
+
+let g:colors_name="iawriter"
+
+hi Cursor guifg=fg guibg=#54D4FF
+hi Normal guifg=#424242 guibg=#f5f6f6 ctermfg=black ctermbg=white
+hi DiffAdd guibg=#c0ffe0 ctermbg=3
+hi DiffDelete guifg=#ff8097 guibg=#ffe0f7 ctermfg=4 ctermbg=5
+hi DiffChange guibg=#cfefff ctermbg=9
+hi DiffText guibg=#bfdfff gui=NONE ctermbg=6 cterm=NONE
+hi NonText guifg=bg guibg=bg gui=NONE ctermfg=darkblue
+hi SpecialKey guifg=grey50 guibg=grey86 gui=NONE ctermfg=darkblue
+hi LineNr guifg=bg guibg=bg ctermfg=darkblue
+hi Search guibg=#fff999
+hi StatusLine guifg=bg guibg=#333333 gui=NONE ctermfg=bg ctermbg=black cterm=NONE
+hi StatusLineNC guifg=bg guibg=grey40 gui=NONE ctermfg=bg ctermbg=black cterm=NONE
+hi Visual guifg=fg guibg=#ccccdd gui=NONE
+hi VisualNOS guifg=bg guibg=#ccccdd gui=NONE
+
+" syntax highlighting groups
+hi Comment guifg=#000099 guibg=bg ctermfg=darkblue
+hi String guifg=fg guibg=#e0e4cc ctermfg=darkred
+hi Constant guifg=#c033ff guibg=bg ctermfg=darkmagenta
+hi Statement guifg=#737373 guibg=bg ctermfg=black cterm=NONE
+hi PreProc guifg=#335588 guibg=bg gui=NONE ctermfg=blue
+hi Type guifg=#338855 guibg=bg gui=NONE ctermfg=darkgreen
+hi StorageClass guifg=#990000 guibg=bg ctermfg=red
+hi Special guifg=#6688ff guibg=bg ctermfg=darkcyan
+hi Function guifg=#117777 guibg=bg ctermfg=red
+hi Title guifg=black guibg=bg ctermfg=black cterm=bold
+
+" showpairs plugin
+" for cursor on paren
+hi ShowPairsHL guibg=#c4ffc4 ctermbg=lightgreen
+" for cursor between parens
+hi ShowPairsHLp guibg=#c4f0c4 ctermbg=lightgreen
+" unmatched paren
+hi ShowPairsHLe guibg=#ff5555 ctermbg=red
+
+" settings for Vim7
+if version >= 700
+ hi MatchParen guibg=#c4ffc4 ctermbg=lightgreen
+ " Spell
+ hi SpellBad guifg=fg gui=undercurl ctermfg=red cterm=underline
+ hi SpellRare guifg=magenta gui=undercurl ctermfg=magenta cterm=underline
+ hi SpellCap guifg=fg gui=undercurl guisp=#22cc22 cterm=underline
+ " Completion menu
+ hi Pmenu guibg=#ffffcc ctermbg=yellow
+ hi PmenuSel guibg=#ddddaa ctermbg=lightcyan cterm=NONE
+ hi PmenuSbar guibg=#999966 ctermbg=lightcyan
+ " Tab line
+ hi TabLine guibg=grey70 cterm=underline
+ hi TabLineSel gui=NONE cterm=NONE
+ hi TabLineFill guifg=black guibg=grey80 cterm=underline
+endif
View
2 vim/ftdetect/mkd.vim
@@ -0,0 +1,2 @@
+" markdown filetype file
+au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=mkd
View
90 vim/plugin/DistractionFree.vim
@@ -0,0 +1,90 @@
+" DistrationFree.vim -- Toggle distraction free writing mode
+" Author: Lakshan Perera (lakshan AT web2media net)
+" URL: https://github.com/laktek/distraction-free-writing-vim
+"
+" Usage:
+"
+" Copy this file to .vim/plugin.
+"
+" In .vimrc, specify the colorschemes and fonts to use
+" in fullscreen mode and normal mode.
+"
+" g:fullscreen_colorscheme - colorscheme to use in fullscreen mode
+" g:fullscreen_font font to use in fullscreen mode
+" g:normal_colorscheme - colorscheme to use in normal mode
+" g:normal_font - font to use in normal mode
+" eg: let g:fullscreen_colorscheme = "iawriter"
+"
+" By default, toggling of full screen mode is bound to F4 key.
+" You can change it in .vimrc as follows:
+" :map <F4> :call ToggleDistractionFreeWriting()<CR>
+
+function! DistractionFreeWriting()
+ exec "colorscheme ".g:fullscreen_colorscheme
+ " added escape function to allow for multiword font names
+ " (AmaruCoder)
+ exec "set gfn=".escape(g:fullscreen_font,' ')
+
+ set background=light
+ set lines=40 columns=100 " size of the editable area
+ set linespace=5 " spacing between lines
+ set fuoptions=background:#00f5f6f6 " bakground color
+ set guioptions-=r " remove righ scrollbar
+ set laststatus=0 " don't show status line
+ set noruler " don't show ruler
+ set fullscreen " go to fullscreen editing mode
+ set linebreak " break the lines on words
+endfunction
+
+function! ToggleDistractionFreeWriting()
+ if &fullscreen
+ exec "set background=".s:prev_background
+ exec "set lines=".s:prev_lines
+ exec "set columns=".s:prev_columns
+ exec "set linespace=".s:prev_linespace
+ exec "set fuoptions=".s:prev_fuoptions
+ exec "set laststatus=".s:prev_laststatus
+ exec "set guioptions+=r"
+
+ set noruler!
+ set fullscreen!
+ set linebreak!
+
+ exec "colorscheme ".g:normal_colorscheme
+ " added escape function to allow for multiword font names
+ " (AmaruCoder)
+ exec "set gfn=".escape(g:normal_font,' ')
+ else
+ let s:prev_background = &background
+ let s:prev_gfn = &gfn
+ let s:prev_lines = &lines
+ let s:prev_columns = &columns
+ let s:prev_linespace = &linespace
+ let s:prev_fuoptions = &fuoptions
+ let s:prev_laststatus = &laststatus
+ let s:prev_font = &gfn
+
+ call DistractionFreeWriting()
+ endif
+endfunction
+
+if !exists('g:fullscreen_colorscheme')
+ let g:fullscreen_colorscheme = "iawriter"
+endif
+
+if !exists('g:fullscreen_font')
+ let g:fullscreen_font = "Cousine:h14"
+endif
+
+if !exists('g:normal_colorscheme')
+ let g:normal_colorscheme = "codeschool"
+endif
+
+if !exists('g:normal_font')
+ let g:normal_font="Inconsolata:h14"
+endif
+
+:map <F4> :call ToggleDistractionFreeWriting()<CR>
+
+" turn-on distraction free writing mode by default for markdown files
+" au BufNewFile,BufRead *.{md,mdown,mkd,mkdn,markdown,mdwn} call DistractionFreeWriting()
View
105 vim/syntax/mkd.vim
@@ -0,0 +1,105 @@
+" Vim syntax file
+" Language: Markdown
+" Maintainer: Ben Williams <benw@plasticboy.com>
+" URL: http://plasticboy.com/markdown-vim-mode/
+" Version: 9
+" Last Change: 2009 May 18
+" 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
+
+syn spell toplevel
+syn case ignore
+syn sync linebreaks=1
+
+"additions to HTML groups
+syn region htmlBold start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\*\@!/ end=/\\\@<!\*\@<!\*\*\*\@!\($\|\A\)\@=/ contains=@Spell,htmlItalic
+syn region htmlItalic start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\@!/ end=/\\\@<!\*\@<!\*\*\@!\($\|\A\)\@=/ contains=htmlBold,@Spell
+syn region htmlBold start=/\\\@<!\(^\|\A\)\@=_\@<!___\@!/ end=/\\\@<!_\@<!___\@!\($\|\A\)\@=/ contains=htmlItalic,@Spell
+syn region htmlItalic start=/\\\@<!\(^\|\A\)\@=_\@<!__\@!/ end=/\\\@<!_\@<!__\@!\($\|\A\)\@=/ contains=htmlBold,@Spell
+
+" [link](URL) | [link][id] | [link][]
+syn region mkdLink matchgroup=mkdDelimiter start="\!\?\[" end="\]\ze\s*[[(]" contains=@Spell nextgroup=mkdURL,mkdID skipwhite oneline
+syn region mkdID matchgroup=mkdDelimiter start="\[" end="\]" contained
+syn region mkdURL matchgroup=mkdDelimiter start="(" end=")" contained
+
+" Link definitions: [id]: URL (Optional Title)
+" TODO handle automatic links without colliding with htmlTag (<URL>)
+syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
+syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline
+syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained
+syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained
+syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained
+
+"define Markdown groups
+syn match mkdLineContinue ".$" contained
+syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
+syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/
+syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/
+syn match mkdRule /^\s*-\{3,}$/
+syn match mkdRule /^\s*\*\{3,5}$/
+syn match mkdListItem "^\s*[-*+]\s\+"
+syn match mkdListItem "^\s*\d\+\.\s\+"
+syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
+syn match mkdLineBreak / \+$/
+syn region mkdCode start=/\\\@<!`/ end=/\\\@<!`/
+syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/
+syn region mkdCode start=/\s*```[^`]*/ end=/[^`]*```\s*/
+syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell
+syn region mkdCode start="<pre[^>]*>" end="</pre>"
+syn region mkdCode start="<code[^>]*>" end="</code>"
+
+"HTML headings
+syn region htmlH1 start="^\s*#" end="\($\|#\+\)" contains=@Spell
+syn region htmlH2 start="^\s*##" end="\($\|#\+\)" contains=@Spell
+syn region htmlH3 start="^\s*###" end="\($\|#\+\)" contains=@Spell
+syn region htmlH4 start="^\s*####" end="\($\|#\+\)" contains=@Spell
+syn region htmlH5 start="^\s*#####" end="\($\|#\+\)" contains=@Spell
+syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contains=@Spell
+syn match htmlH1 /^.\+\n=\+$/ contains=@Spell
+syn 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 = "mkd"
+
+delcommand HtmlHiLink
+" vim: ts=8

0 comments on commit 4740ab4

Please sign in to comment.
Something went wrong with that request. Please try again.