1
0
mirror of https://github.com/amix/vimrc synced 2025-06-23 06:35:01 +08:00

Added goyo.vim and vim-zenroom2

This commit is contained in:
amix
2013-12-29 10:37:14 +00:00
parent c3fdf943a1
commit 7654d5264c
16 changed files with 124 additions and 609 deletions

View File

@ -0,0 +1,20 @@
This is a Vim extension that emulates iA Writer environment when editing Markdown, reStructuredText or text files.
It requires [goyo.vim](https://github.com/junegunn/goyo.vim) and it works by setting global Goyo callbacks that triggers special setup for Markdown, reStructuredText and text files.
This is an improvement of my initial version called [vim-zenroom](https://github.com/amix/vim-zenroom). Please read more here [
zenroom for Vim: Focusing only on the essential](http://amix.dk/blog/post/19744#zenroom-for-Vim-Focsuing-only-on-the-essential).
## Inspirations/Similar
* [lite-dfm](https://github.com/bilalq/lite-dfm)
* [vimroom](https://github.com/mikewest/vimroom)
* [vim-zenroom](https://github.com/amix/vim-zenroom)
* [Writing Markdown With Style in Vim](http://astrails.com/blog/2013/8/12/writing-markdown-with-style-in-vim)
## How it looks like in action
![Screenshot 3](http://amix.dk/uploads/zenroom_documentation.jpg)
![Screenshot 4](http://amix.dk/uploads/zenroom_documentation_1.jpg)

View File

@ -0,0 +1,95 @@
"==============================================================================
"File: zenroom2.vim
"Description: Emulates iA Writer environment when editing Markdown, reStructuredText
" or text files.
"Maintainer: Amir Salihefendic <amix@doist.io>
"Version: 0.1
"Last Change: 2013-12-29
"License: BSD
"==============================================================================
if exists( "g:loaded_zenroom2_plugin" )
finish
endif
let g:loaded_zenroom2_plugin = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin Configuration
"
" 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()
set background=light
set linespace=8
set textwidth=80
hi Normal guibg=gray95
hi NonText guifg=gray95
hi FoldColumn guibg=gray95
hi CursorLine guibg=gray90
hi Title gui=bold guifg=gray25
hi MarkdownHeadingDelimiter gui=bold guifg=gray25
hi htmlSpecialChar guifg=black
hi markdownError guifg=black
hi markdownBold gui=bold guifg=gray25
hi markdownItalic guifg=gray25 gui=underline
hi markdownUrl guifg=#2fb3a6
hi markdownAutomaticLink guifg=#2fb3a6
hi markdownLinkText guifg=#317849
hi markdownUrlTitle guifg=#317849
hi markdownBlockquote guifg=#317849 gui=bold
hi markdownId guifg=#2fb3a6
hi markdownIdDeclaration guifg=#317849 gui=bold
hi markdownListMarker guifg=#317849
hi Cursor guibg=#15abdd
if has('gui_running')
let l:highlightbgcolor = "guibg=#f2f2f2"
let l:highlightfgbgcolor = "guifg=#f2f2f2" . " " . l:highlightbgcolor
else
let l:highlightbgcolor = "ctermbg=bg"
let l:highlightfgbgcolor = "ctermfg=bg" . " " . l:highlightbgcolor
endif
exec( "hi Normal " . l:highlightbgcolor )
exec( "hi VertSplit " . l:highlightfgbgcolor )
exec( "hi NonText " . l:highlightfgbgcolor )
exec( "hi StatusLine " . l:highlightfgbgcolor )
exec( "hi StatusLineNC " . l:highlightfgbgcolor )
endfunction
function! s:goyo_before()
let is_mark_or_rst = &filetype == "markdown" || &filetype == "rst" || &filetype == "text"
if is_mark_or_rst
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
set linespace=0
if s:save_textwidth != ""
exec( "set textwidth=" . s:save_textwidth )
endif
if s:save_background != ""
exec( "set background=" . s:save_background )
endif
endif
endfunction
let g:goyo_callbacks = [ function('s:goyo_before'), function('s:goyo_after') ]