Skip to content

Commit

Permalink
markdown iawriter jsbeautify
Browse files Browse the repository at this point in the history
  • Loading branch information
tempire committed Sep 5, 2012
1 parent 76d3a27 commit 5052561
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 31 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Expand Up @@ -106,3 +106,9 @@
[submodule "bundle/vimproc"] [submodule "bundle/vimproc"]
path = bundle/vimproc path = bundle/vimproc
url = git://github.com/Shougo/vimproc.git url = git://github.com/Shougo/vimproc.git
[submodule "bundle/jsbeautify"]
path = bundle/jsbeautify
url = git://github.com/maksimr/vim-jsbeautify.git
[submodule "bundle/markdown"]
path = bundle/markdown
url = git://github.com/plasticboy/vim-markdown.git
1 change: 1 addition & 0 deletions bundle/jsbeautify
Submodule jsbeautify added at 6394cd
1 change: 1 addition & 0 deletions bundle/markdown
Submodule markdown added at 70ca17
68 changes: 68 additions & 0 deletions colors/iawriter.vim
@@ -0,0 +1,68 @@
"
" 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=#ffffff guibg=#990000
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 ctermfg=bg
"hi NonText guifg=grey50 guibg=grey86 gui=NONE ctermfg=darkblue
hi SpecialKey guifg=grey50 guibg=grey86 gui=NONE ctermfg=darkblue
"hi NonText guifg=grey50 guibg=grey86 ctermfg=blue
hi LineNr guifg=grey50 guibg=grey86 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=#b30000 guibg=bg ctermfg=darkred
hi Constant guifg=#c033ff guibg=bg ctermfg=darkmagenta
hi Statement guifg=black 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

" 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=#cc0000 gui=undercurl guisp=#cc0000 ctermfg=red cterm=underline
hi SpellRare guifg=magenta gui=undercurl ctermfg=magenta cterm=underline
hi SpellCap 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
148 changes: 117 additions & 31 deletions vimrc
Expand Up @@ -21,12 +21,12 @@ call pathogen#infect()


" turn on indent-guides " turn on indent-guides
autocmd VimEnter * IndentGuidesEnable autocmd VimEnter * IndentGuidesEnable
"let g:indent_guides_guide_size=1 let g:indent_guides_guide_size=1


set number set number
set nocompatible set nocompatible


set wildignore+=*CVS "set wildignore+=*CVS


" snipmate " snipmate
filetype on filetype on
Expand Down Expand Up @@ -54,7 +54,7 @@ set textwidth=79
set formatoptions=qrn1 set formatoptions=qrn1
"if version >= 703 "if version >= 703
if exists('+colorcolumn') if exists('+colorcolumn')
set colorcolumn=80 set colorcolumn=80
endif endif


" folding " folding
Expand All @@ -68,7 +68,7 @@ let NERDTreeShowLineNumbers=1
let NERDTreeShowBookmarks=1 let NERDTreeShowBookmarks=1
let NERDTreeChDirMode=2 let NERDTreeChDirMode=2
let NERDTreeWinSize=35 let NERDTreeWinSize=35
let NERDTreeIgnore=['CVS'] "let NERDTreeIgnore=['CVS']


set incsearch set incsearch
set ignorecase set ignorecase
Expand All @@ -79,7 +79,7 @@ set hlsearch
set history=500 set history=500


" scrolling " scrolling
set ruler "set ruler
set scrolloff=10 " Scroll with 10 line buffer set scrolloff=10 " Scroll with 10 line buffer


" clear recent search highlighting with space " clear recent search highlighting with space
Expand Down Expand Up @@ -117,30 +117,30 @@ set statusline+=%y "filetype
set statusline+=%r "read only flag set statusline+=%r "read only flag
set statusline+=%m "modified flag set statusline+=%m "modified flag


set list "set list
set listchars=tab:.\ ,trail:.,extends:#,nbsp:. "set listchars=tab:.\ ,trail:.,extends:#,nbsp:.


" font " font
if has("gui_gnome") if has("gui_gnome")
set guifont=Monospace\ 8 set guifont=Monospace\ 8
set list set list
set listchars=tab:▸\ ,eol:¬,extends:#,nbsp:.,trail:. set listchars=tab:▸\ ,eol:¬,extends:#,nbsp:.,trail:.


elseif has("gui_macvim") elseif has("gui_macvim")
"set guifont=Menlo:h12 "set guifont=Menlo:h12
set guifont=Monaco:h12 set guifont=Monaco:h12
set list set list
set listchars=tab:▸\ ,eol:¬,extends:#,nbsp:.,trail:. set listchars=tab:▸\ ,eol:¬,extends:#,nbsp:.,trail:.
endif endif


if &t_Co >= 256 || has("gui_running") if &t_Co >= 256 || has("gui_running")
set guifont=Monaco:h12 set guifont=Monaco:h12
colorscheme tempire colorscheme tempire
set guioptions-=r set guioptions-=r
set go-=L set go-=L
set go-=T set go-=T
else else
colorscheme ir_black colorscheme ir_black
endif endif


" line tracking " line tracking
Expand Down Expand Up @@ -181,6 +181,7 @@ map <leader>H :call HexHighlight()<cr>
map <leader>tts :%s/\s\+$//<cr> map <leader>tts :%s/\s\+$//<cr>
map <leader>term :ConqueTerm bash<cr> map <leader>term :ConqueTerm bash<cr>
map <leader>b :TagbarToggle<cr> map <leader>b :TagbarToggle<cr>
map <leader>sp :setlocal spell! spelllang=en_us<CR> " toggle spellcheck
" "
" cd to directory of current file " cd to directory of current file
map <leader>cd :cd %:p:h<cr> map <leader>cd :cd %:p:h<cr>
Expand Down Expand Up @@ -251,6 +252,17 @@ let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1 let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
"au FileType haskell nmap <Leader>gt :GhcModType<cr>
"au FileType haskell nmap <Leader>gc :GhcModTypeClear<cr>
au FileType haskell nmap gt :GhcModType<cr>
au FileType haskell nmap gc :GhcModTypeClear<cr>
"autocmd BufWritePost *.hs call s:check_and_lint()
"autocmd BufWritePost *.hs GhcModCheckAsync
"let &l:statusline = '%{empty(getqflist()) ? "[No Errors]" : "[Errors Found]"}' . (empty(&l:statusline) ? &statusline : &l:statusline)

" markdown support - turn-on distraction free writing mode for markdown files
au BufNewFile,BufRead *.{md,mdown,mkd,mkdn,markdown,mdwn} call DistractionFreeWriting()
au BufNewFile,BufRead *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=markdown


" compile erlang files " compile erlang files
autocmd BufRead,BufNewFile *.erl nmap <Leader>C :!erlc %<cr> autocmd BufRead,BufNewFile *.erl nmap <Leader>C :!erlc %<cr>
Expand All @@ -275,7 +287,7 @@ function! Prove ( verbose, taint )
" endif " endif
"execute !HARNESS_PERL_SWITCHES=-MDevel::Cover prove -" . s:params . " " . g:testfile "execute !HARNESS_PERL_SWITCHES=-MDevel::Cover prove -" . s:params . " " . g:testfile
execute "!prove --timer --normalize --state=save -" . s:params . " " . g:testfile execute "!prove --timer --normalize --state=save -" . s:params . " " . g:testfile
"TEST_VERBOSE=1 prove -lvc --timer --normalize --state=save "TEST_VERBOSE=1 prove -lvc --timer --normalize --state=save
else else
call Compile () call Compile ()
endif endif
Expand All @@ -291,9 +303,9 @@ endfunction
autocmd BufRead,BufNewFile *.t,*.pl,*.plx,*.pm nmap <Leader>te :let g:testfile = expand("%")<cr>:echo "testfile is now" g:testfile<cr>:call Prove (1,1)<cr> autocmd BufRead,BufNewFile *.t,*.pl,*.plx,*.pm nmap <Leader>te :let g:testfile = expand("%")<cr>:echo "testfile is now" g:testfile<cr>:call Prove (1,1)<cr>
" markdown " markdown
augroup mkd "augroup mkd
autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:&gt; "autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:&gt;
augroup END "augroup END


" open installed perl modules " open installed perl modules
au FileType perl command! -nargs=1 PerlModuleSource :tabnew `perldoc -lm <args>` au FileType perl command! -nargs=1 PerlModuleSource :tabnew `perldoc -lm <args>`
Expand All @@ -305,16 +317,29 @@ au FileType perl command! -range=% -nargs=* Tidy <line1>,<line2>!perltidy
au FileType perl nmap <Leader>pt mz:Tidy<cr>'z:delmarks z<cr> " normal mode au FileType perl nmap <Leader>pt mz:Tidy<cr>'z:delmarks z<cr> " normal mode
au FileType perl vmap <Leader>pt :Tidy<cr> " visual mode au FileType perl vmap <Leader>pt :Tidy<cr> " visual mode
" js, css, & html tidy config (vim-jsbeautify)
let g:jsbeautify = {'indent_size': 2, 'indent_char': ' ', 'max_char': 5}
let g:htmlbeautify = {'indent_size': 2, 'indent_char': ' ', 'max_char': 80, 'brace_style': 'expand', 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u']}
let g:csseautify = {'indent_size': 2, 'indent_char': ' ', 'max_char': 80, 'brace_style': 'expand'}

" js
"au FileType javascript command! -range=% -nargs=* Tidy <line1>,<line2> :call JsBeautify()
"au FileType javascript nmap <Leader>pt mz:Tidy<cr>'z:delmarks z<cr> " normal mode
"au FileType javascript vmap <Leader>pt :Tidy<cr> " visual mode
au FileType javascript noremap <buffer> <leader>pt :call JsBeautify()<cr>
"au FileType html noremap <buffer> <leader>pt :call HtmlBeautify()<cr>
"au FileType css noremap <buffer> <leader>pt :call CSSBeautify()<cr>

" csstidy " csstidy
au FileType css command! -range=% -nargs=* Tidy <line1>,<line2>!csstidy "au FileType css command! -range=% -nargs=* Tidy <line1>,<line2>!csstidy
au FileType css nmap <Leader>pt mz:Tidy<cr>'z:delmarks z<cr> " normal mode "au FileType css nmap <Leader>pt mz:Tidy<cr>'z:delmarks z<cr> " normal mode
au FileType css vmap <Leader>pt :Tidy<cr> " visual mode "au FileType css vmap <Leader>pt :Tidy<cr> " visual mode


" json tidy " json tidy
au FileType json set filetype=javascript foldmethod=syntax "au FileType json set filetype=javascript foldmethod=syntax
au FileType json command! -range=% -nargs=* Tidy <line1>,<line2>!json_xs -f json -t json-pretty "au FileType json command! -range=% -nargs=* Tidy <line1>,<line2>!json_xs -f json -t json-pretty
au FileType json nmap <Leader>pt :Tidy<cr> " normal mode "au FileType json nmap <Leader>pt :Tidy<cr> " normal mode
au FileType json vmap <Leader>pt :Tidy<cr> " visual mode "au FileType json vmap <Leader>pt :Tidy<cr> " visual mode


" xmlfolding " xmlfolding
"au BufNewFile,BufRead *.xml,*.htm,*.html so bundle/plugin/XMLFolding.vim "au BufNewFile,BufRead *.xml,*.htm,*.html so bundle/plugin/XMLFolding.vim
Expand Down Expand Up @@ -399,3 +424,64 @@ function! ScreencastPrep1080()
set sw=2 set sw=2
NoMatchParen "opposite: DoMatchParen NoMatchParen "opposite: DoMatchParen
endfunction endfunction

function! s:check_and_lint()
let l:qflist = ghcmod#make('check')
call extend(l:qflist, ghcmod#make('lint'))
call setqflist(l:qflist)
cwindow
if empty(l:qflist)
echo "No errors found"
endif
endfunction

function! DoPrettyXML()
" save the filetype so we can restore it later
let l:origft = &ft
set ft=
" delete the xml header if it exists. This will
" permit us to surround the document with fake tags
" without creating invalid xml.
1s/<?xml .*?>//e
" insert fake tags around the entire document.
" This will permit us to pretty-format excerpts of
" XML that may contain multiple top-level elements.
0put ='<PrettyXML>'
$put ='</PrettyXML>'
silent %!xmllint --format -
" xmllint will insert an <?xml?> header. it's easy enough to delete
" if you don't want it.
" delete the fake tags
2d
$d
" restore the 'normal' indentation, which is one extra level
" too deep due to the extra tags we wrapped around the document.
silent %<
" back to home
1
" restore the filetype
exe "set ft=" . l:origft
endfunction
"command! PrettyXML call DoPrettyXML()


function DistractionFreeWriting()
colorscheme iawriter
set background=light
set gfn=Cousine:h14 " font to use
set lines=40 columns=120 " size of the editable area
set listchars=tab:▸\ ,extends:#,nbsp:.,trail:.
set guioptions-=r " remove right scrollbar
set laststatus=0 " don't show status line
set noruler " don't show ruler
set linebreak " break the lines on words
set nocursorline
set nocursorcolumn
set nonumber
set cc=

if has("gui_macvim")
set fuoptions=background:#00f5f6f6 " macvim specific setting for editor's background color
set fullscreen " go to fullscreen editing mode
endif
endfunction

0 comments on commit 5052561

Please sign in to comment.