Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
laktek committed Sep 4, 2012
0 parents commit 478a953
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
@@ -0,0 +1,10 @@
## Distraction Free Writing for Vim

Checkout this blog post for further instrutions: http://laktek.com/2012/09/05/

Copy `syntax/mkd.vim` to `~/.vim/syntax`
Copy `ftdetect/mkd.vim` to `~/.vim/ftdetect`
Copy `colors/iawriter.vim` to `~/.vim/colors`

Append the settings in `vimrc` to `~/.vimrc`.

67 changes: 67 additions & 0 deletions colors/iawriter.vim
@@ -0,0 +1,67 @@
"
" 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

set linespace=5
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
2 changes: 2 additions & 0 deletions ftdetect/mkd.vim
@@ -0,0 +1,2 @@
" markdown filetype file
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=mkd
105 changes: 105 additions & 0 deletions 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
19 changes: 19 additions & 0 deletions vimrc
@@ -0,0 +1,19 @@
" Toggle spell-checking
:map <F5> :setlocal spell! spelllang=en_us<CR>
" turn-on distraction free writing mode for markdown files
au BufNewFile,BufRead *.{md,mdown,mkd,mkdn,markdown,mdwn} call DistractionFreeWriting()

function! DistractionFreeWriting()
colorscheme iawriter
set background=light
set gfn=Cousine:h14 " font to use
set lines=40 columns=100 " size of the editable area
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

0 comments on commit 478a953

Please sign in to comment.