1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00
This commit is contained in:
amix
2013-12-29 11:33:00 +00:00
parent 5d177a21f6
commit a340836c8a
5 changed files with 24 additions and 132 deletions

View File

@ -3,7 +3,7 @@
"Description: Emulates iA Writer environment when editing Markdown, reStructuredText
" or text files.
"Maintainer: Amir Salihefendic <amix@doist.io>
"Version: 0.1
"Version: 0.2
"Last Change: 2013-12-29
"License: BSD
"==============================================================================
@ -19,24 +19,27 @@ let g:loaded_zenroom2_plugin = 1
"
" Save the current `background` value for reset later
let s:save_background = ""
if exists( "&background" )
let s:save_background = &background
endif
" Save the current `textwidth'` value for reset later
let s:save_textwidth = ""
if exists( "&textwidth'" )
let s:save_textwidth' = &textwidth'
endif
function! s:markdown_room()
if exists( "&background" )
let s:save_background = &background
endif
if exists( "&textwidth'" )
let s:save_textwidth' = &textwidth'
endif
set background=light
set linespace=8
set textwidth=80
hi Normal guibg=gray95
hi NonText guifg=gray95
hi FoldColumn guibg=gray95
hi FoldColumn guibg=gray95 ctermbg=bg
hi CursorLine guibg=gray90
hi Title gui=bold guifg=gray25
hi MarkdownHeadingDelimiter gui=bold guifg=gray25
@ -69,17 +72,22 @@ function! s:markdown_room()
exec( "hi StatusLineNC " . l:highlightfgbgcolor )
endfunction
function! s:goyo_before()
let is_mark_or_rst = &filetype == "markdown" || &filetype == "rst" || &filetype == "text"
function! g:zenroom_goyo_before()
if !has("gui_running")
return
endif
if is_mark_or_rst
if &filetype == "markdown" || &filetype == "rst" || &filetype == "text"
call s:markdown_room()
endif
endfunction
function! s:goyo_after()
let is_mark_or_rst = &filetype == "markdown" || &filetype == "rst" || &filetype == "text"
if is_mark_or_rst
function! g:zenroom_goyo_after()
if !has("gui_running")
return
endif
if &filetype == "markdown" || &filetype == "rst" || &filetype == "text"
set linespace=0
if s:save_textwidth != ""
@ -92,4 +100,5 @@ function! s:goyo_after()
endif
endfunction
let g:goyo_callbacks = [ function('s:goyo_before'), function('s:goyo_after') ]
let g:goyo_callbacks = [ function('g:zenroom_goyo_before'), function('g:zenroom_goyo_after') ]