Permalink
Browse files

markdown iawriter jsbeautify

  • Loading branch information...
1 parent 76d3a27 commit 505256141fe68caaf109d32e02d7ad695eb38e7c @tempire committed Sep 5, 2012
Showing with 193 additions and 31 deletions.
  1. +6 −0 .gitmodules
  2. +1 −0 bundle/jsbeautify
  3. +1 −0 bundle/markdown
  4. +68 −0 colors/iawriter.vim
  5. +117 −31 vimrc
View
@@ -106,3 +106,9 @@
[submodule "bundle/vimproc"]
path = bundle/vimproc
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
Submodule jsbeautify added at 6394cd
Submodule markdown added at 70ca17
View
@@ -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
View
148 vimrc
@@ -21,12 +21,12 @@ call pathogen#infect()
" turn on indent-guides
autocmd VimEnter * IndentGuidesEnable
-"let g:indent_guides_guide_size=1
+let g:indent_guides_guide_size=1
set number
set nocompatible
-set wildignore+=*CVS
+"set wildignore+=*CVS
" snipmate
filetype on
@@ -54,7 +54,7 @@ set textwidth=79
set formatoptions=qrn1
"if version >= 703
if exists('+colorcolumn')
- set colorcolumn=80
+ set colorcolumn=80
endif
" folding
@@ -68,7 +68,7 @@ let NERDTreeShowLineNumbers=1
let NERDTreeShowBookmarks=1
let NERDTreeChDirMode=2
let NERDTreeWinSize=35
-let NERDTreeIgnore=['CVS']
+"let NERDTreeIgnore=['CVS']
set incsearch
set ignorecase
@@ -79,7 +79,7 @@ set hlsearch
set history=500
" scrolling
-set ruler
+"set ruler
set scrolloff=10 " Scroll with 10 line buffer
" clear recent search highlighting with space
@@ -117,30 +117,30 @@ set statusline+=%y "filetype
set statusline+=%r "read only flag
set statusline+=%m "modified flag
-set list
-set listchars=tab:.\ ,trail:.,extends:#,nbsp:.
+"set list
+"set listchars=tab:.\ ,trail:.,extends:#,nbsp:.
" font
if has("gui_gnome")
- set guifont=Monospace\ 8
- set list
- set listchars=tab:▸\ ,eol:¬,extends:#,nbsp:.,trail:.
+ set guifont=Monospace\ 8
+ set list
+ set listchars=tab:▸\ ,eol:¬,extends:#,nbsp:.,trail:.
elseif has("gui_macvim")
- "set guifont=Menlo:h12
- set guifont=Monaco:h12
- set list
- set listchars=tab:▸\ ,eol:¬,extends:#,nbsp:.,trail:.
+ "set guifont=Menlo:h12
+ set guifont=Monaco:h12
+ set list
+ set listchars=tab:▸\ ,eol:¬,extends:#,nbsp:.,trail:.
endif
if &t_Co >= 256 || has("gui_running")
- set guifont=Monaco:h12
- colorscheme tempire
- set guioptions-=r
- set go-=L
- set go-=T
+ set guifont=Monaco:h12
+ colorscheme tempire
+ set guioptions-=r
+ set go-=L
+ set go-=T
else
- colorscheme ir_black
+ colorscheme ir_black
endif
" line tracking
@@ -181,6 +181,7 @@ map <leader>H :call HexHighlight()<cr>
map <leader>tts :%s/\s\+$//<cr>
map <leader>term :ConqueTerm bash<cr>
map <leader>b :TagbarToggle<cr>
+map <leader>sp :setlocal spell! spelllang=en_us<CR> " toggle spellcheck
"
" cd to directory of current file
map <leader>cd :cd %:p:h<cr>
@@ -251,6 +252,17 @@ let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_min_syntax_length = 3
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
autocmd BufRead,BufNewFile *.erl nmap <Leader>C :!erlc %<cr>
@@ -275,7 +287,7 @@ function! Prove ( verbose, taint )
" endif
"execute !HARNESS_PERL_SWITCHES=-MDevel::Cover prove -" . 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
call Compile ()
endif
@@ -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>
" markdown
-augroup mkd
-autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:&gt;
-augroup END
+"augroup mkd
+"autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:&gt;
+"augroup END
" open installed perl modules
au FileType perl command! -nargs=1 PerlModuleSource :tabnew `perldoc -lm <args>`
@@ -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 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
-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 vmap <Leader>pt :Tidy<cr> " visual mode
+"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 vmap <Leader>pt :Tidy<cr> " visual mode
" json tidy
-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 nmap <Leader>pt :Tidy<cr> " normal mode
-au FileType json vmap <Leader>pt :Tidy<cr> " visual mode
+"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 nmap <Leader>pt :Tidy<cr> " normal mode
+"au FileType json vmap <Leader>pt :Tidy<cr> " visual mode
" xmlfolding
"au BufNewFile,BufRead *.xml,*.htm,*.html so bundle/plugin/XMLFolding.vim
@@ -399,3 +424,64 @@ function! ScreencastPrep1080()
set sw=2
NoMatchParen "opposite: DoMatchParen
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.