1
0
Fork 0
mirror of synced 2024-12-30 02:19:25 -05: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

@ -75,8 +75,8 @@ I recommend reading the docs of these plugins to understand them better. Each of
* [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination.
* [vim-airline](https://github.com/bling/vim-airline): Lean & mean status/tabline for vim that's light as air (replacing powerline)
* [vim-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal
* [vim-zenroom](https://github.com/amix/vim-zenroom):
Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room [Read more here](http://amix.dk/blog/post/19744#zenroom-for-Vim-Focsuing-only-on-the-essential)
* [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2):
Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room [Read more here](http://amix.dk/blog/post/19744)
## What color schemes are included?
@ -139,9 +139,9 @@ Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin:
map <leader>nb :NERDTreeFromBookmark
map <leader>nf :NERDTreeFind<cr>
[vim-zenroom](https://github.com/mikewest/vimroom) (my fork of [vimroom](https://github.com/mikewest/vimroom)) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It only has one mapping.
[goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping.
map <leader>z :VimroomToggle<cr>
map <leader>z :Goyo<cr>
### Normal mode mappings

View file

@ -1,24 +0,0 @@
bufexplorer bufexplorer.txt /*bufexplorer*
bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog*
bufexplorer-credits bufexplorer.txt /*bufexplorer-credits*
bufexplorer-customization bufexplorer.txt /*bufexplorer-customization*
bufexplorer-installation bufexplorer.txt /*bufexplorer-installation*
bufexplorer-todo bufexplorer.txt /*bufexplorer-todo*
bufexplorer-usage bufexplorer.txt /*bufexplorer-usage*
bufexplorer-windowlayout bufexplorer.txt /*bufexplorer-windowlayout*
bufexplorer.txt bufexplorer.txt /*bufexplorer.txt*
buffer-explorer bufexplorer.txt /*buffer-explorer*
g:bufExplorerChgWin bufexplorer.txt /*g:bufExplorerChgWin*
g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp*
g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp*
g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive*
g:bufExplorerFuncRef bufexplorer.txt /*g:bufExplorerFuncRef*
g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort*
g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories*
g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath*
g:bufExplorerShowTabBuffer bufexplorer.txt /*g:bufExplorerShowTabBuffer*
g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted*
g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy*
g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow*
g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName*
g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight*

@ -0,0 +1 @@
Subproject commit 6011742c2993315b3489e20d89d730917b8e2548

View file

@ -1,62 +0,0 @@
'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'*
'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'*
'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'*
'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'*
'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'*
'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'*
'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'*
'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'*
'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'*
'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'*
'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'*
'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'*
'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'*
'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'*
'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'*
'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'*
'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'*
'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'*
'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'*
'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'*
'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'*
'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'*
'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'*
'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'*
'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'*
:TlistAddFiles taglist.txt /*:TlistAddFiles*
:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive*
:TlistClose taglist.txt /*:TlistClose*
:TlistDebug taglist.txt /*:TlistDebug*
:TlistHighlightTag taglist.txt /*:TlistHighlightTag*
:TlistLock taglist.txt /*:TlistLock*
:TlistMessages taglist.txt /*:TlistMessages*
:TlistOpen taglist.txt /*:TlistOpen*
:TlistSessionLoad taglist.txt /*:TlistSessionLoad*
:TlistSessionSave taglist.txt /*:TlistSessionSave*
:TlistShowPrototype taglist.txt /*:TlistShowPrototype*
:TlistShowTag taglist.txt /*:TlistShowTag*
:TlistToggle taglist.txt /*:TlistToggle*
:TlistUndebug taglist.txt /*:TlistUndebug*
:TlistUnlock taglist.txt /*:TlistUnlock*
:TlistUpdate taglist.txt /*:TlistUpdate*
Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()*
Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()*
Tlist_Set_App() taglist.txt /*Tlist_Set_App()*
Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()*
taglist-commands taglist.txt /*taglist-commands*
taglist-debug taglist.txt /*taglist-debug*
taglist-extend taglist.txt /*taglist-extend*
taglist-faq taglist.txt /*taglist-faq*
taglist-functions taglist.txt /*taglist-functions*
taglist-install taglist.txt /*taglist-install*
taglist-internet taglist.txt /*taglist-internet*
taglist-intro taglist.txt /*taglist-intro*
taglist-keys taglist.txt /*taglist-keys*
taglist-license taglist.txt /*taglist-license*
taglist-menu taglist.txt /*taglist-menu*
taglist-options taglist.txt /*taglist-options*
taglist-requirements taglist.txt /*taglist-requirements*
taglist-session taglist.txt /*taglist-session*
taglist-todo taglist.txt /*taglist-todo*
taglist-using taglist.txt /*taglist-using*
taglist.txt taglist.txt /*taglist.txt*

View file

@ -283,7 +283,7 @@ syntastic <https://github.com/scrooloose/syntastic>
let g:airline#extensions#syntastic#enabled = 1
<
------------------------------------- *airline-tagbar*
tagbar <https://github.com/majutsushi/>
tagbar <https://github.com/majutsushi/tagbar>
* enable/disable tagbar integration >
let g:airline#extensions#tagbar#enabled = 1

View file

@ -1,10 +0,0 @@
expand-region-about expand_region.txt /*expand-region-about*
expand-region-contents expand_region.txt /*expand-region-contents*
expand-region-global-options expand_region.txt /*expand-region-global-options*
expand-region-intro expand_region.txt /*expand-region-intro*
expand-region-mappings expand_region.txt /*expand-region-mappings*
expand-region-usage expand_region.txt /*expand-region-usage*
expand_region_text_objects expand_region.txt /*expand_region_text_objects*
expand_region_use_select_mode expand_region.txt /*expand_region_use_select_mode*
vim-expand-region.txt expand_region.txt /*vim-expand-region.txt*
vim-expand-regions expand_region.txt /*vim-expand-regions*

View file

@ -1,21 +0,0 @@
MultipleCursorsFind multiple_cursors.txt /*MultipleCursorsFind*
g:multi_cursor_exit_from_insert_mode multiple_cursors.txt /*g:multi_cursor_exit_from_insert_mode*
g:multi_cursor_exit_from_visual_mode multiple_cursors.txt /*g:multi_cursor_exit_from_visual_mode*
g:multi_cursor_next_key multiple_cursors.txt /*g:multi_cursor_next_key*
g:multi_cursor_prev_key multiple_cursors.txt /*g:multi_cursor_prev_key*
g:multi_cursor_quit_key multiple_cursors.txt /*g:multi_cursor_quit_key*
g:multi_cursor_skip_key multiple_cursors.txt /*g:multi_cursor_skip_key*
g:multi_cursor_start_key multiple_cursors.txt /*g:multi_cursor_start_key*
g:multi_cursor_use_default_mapping multiple_cursors.txt /*g:multi_cursor_use_default_mapping*
multiple-cursors-contents multiple_cursors.txt /*multiple-cursors-contents*
multiple-cursors-contributing multiple_cursors.txt /*multiple-cursors-contributing*
multiple-cursors-credit multiple_cursors.txt /*multiple-cursors-credit*
multiple-cursors-global-options multiple_cursors.txt /*multiple-cursors-global-options*
multiple-cursors-intro multiple_cursors.txt /*multiple-cursors-intro*
multiple-cursors-issues multiple_cursors.txt /*multiple-cursors-issues*
multiple-cursors-license multiple_cursors.txt /*multiple-cursors-license*
multiple-cursors-mappings multiple_cursors.txt /*multiple-cursors-mappings*
multiple-cursors-references multiple_cursors.txt /*multiple-cursors-references*
multiple-cursors-usage multiple_cursors.txt /*multiple-cursors-usage*
vim-multiple-cursors multiple_cursors.txt /*vim-multiple-cursors*
vim-multiple-cursors.txt multiple_cursors.txt /*vim-multiple-cursors.txt*

View file

@ -1,12 +0,0 @@
Copyright (c) 2010 Mike West, http://mikewest.org/
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,20 +0,0 @@
This is my fork of Vimroom which includes following:
* A special mode for editing Markdown and reStructuredText. It's highly inspired by [iA Writer](http://writer.pro/)
* Optimizations for [my vimrc](https://github.com/amix/vimrc)
Pelase read more here [
zenroom for Vim: Focsuing only on the essential](http://amix.dk/blog/post/19744#zenroom-for-Vim-Focsuing-only-on-the-essential).
## Editing code
![Screenshot 1](http://amix.dk/uploads/zenroom_code.jpg)
![Screenshot 2](http://amix.dk/uploads/zenroom_code_1.jpg)
## Updating documentation
![Screenshot 3](http://amix.dk/uploads/zenroom_documentation.jpg)
![Screenshot 4](http://amix.dk/uploads/zenroom_documentation_1.jpg)

View file

@ -1,12 +0,0 @@
g:vimroom_background vimroom.txt /*g:vimroom_background*
g:vimroom_min_sidebar_width vimroom.txt /*g:vimroom_min_sidebar_width*
g:vimroom_navigational_keys vimroom.txt /*g:vimroom_navigational_keys*
g:vimroom_scrolloff vimroom.txt /*g:vimroom_scrolloff*
g:vimroom_sidebar_height vimroom.txt /*g:vimroom_sidebar_height*
g:vimroom_width vimroom.txt /*g:vimroom_width*
vimroom vimroom.txt /*vimroom*
vimroom-about vimroom.txt /*vimroom-about*
vimroom-configuration vimroom.txt /*vimroom-configuration*
vimroom-installation vimroom.txt /*vimroom-installation*
vimroom-toc vimroom.txt /*vimroom-toc*
vimroom.txt vimroom.txt /*vimroom.txt*

View file

@ -1,86 +0,0 @@
*vimroom.txt*
==============================================================================
TABLE OF CONTENTS *vimroom* *vimroom-toc*
1. About |vimroom-about|
2. Installation |vimroom-installation|
3. Configuration |vimroom-configuration|
==============================================================================
ABOUT *vimroom-about*
I do most of my writing in Vim, because Im a big nerd. It does most of what
I want a writing environment to do, but I miss some of the “distraction free"
features of the quite exceptional WriteRoom. Fullscreening Vim means that text
ends up flat up against the left side of my monitor, but Id much prefer it to
be centered. Id also like a little of the visual clutter to fade away. Some
of this is possible with MacVim, but Id rather do as much as possible in
a platform-independent way. So, command-line Vim it is.
For more visit:
http://projects.mikewest.org/vimroom/
https://github.com/mikewest/vimroom
==============================================================================
INSTALLATION *vimroom-installation*
I think the best way to install Vim plugins is via Tim Popes Pathogen. Using
that plugin, you can simply clone the VimRoom repository into your bundles
directory, and youre done.
Without Pathogen, installation is almost as trivial: simply copy
./plugins/vimroom.vim from the repository into your plugins directory. Thats
it!
==============================================================================
CONFIGURATION *vimroom-configuration*
By default, VimRoom binds <Leader>V to <Plug>VimroomToggle, and sets up an 80
column workspace with at least 5 columns of space on either side (it doesnt
help at all to have single-column sidebars, you see), and 3 lines of space
above and below. It assumes a black background when hiding visual
distractions. As of v0.4, VimRoom also sets up a :VimroomToggle command that
has the same effect.
Changing any of these assumptions is a simple matter of setting variables in
your .vimrc.
*g:vimroom_background*
is the background color to be used for hiding elements. Set this to your
terminals background color (“white”, “black”, etc.)
*g:vimroom_min_sidebar_width*
is the minimum sidebar width. This will automatically expand to take up all
the free space left after setting the main workspace window to g:vimroom_width
pcolumns.
*g:vimroom_navigational_keys*
determines whether Vimroom will map keys like <Up>, <Down>, j, and k to
navigate over “display” lines, rather than “logical” lines. This defaults to
p1 (on), if youd prefer the mapping not take place, set it to 0 (off).
*g:vimroom_scrolloff*
specifies how many lines of text ought appear before and after the cursor.
pThis defaults to 999, which centers the cursor on the screen.
*g:vimroom_sidebar_height*
sets the height of the upper and lower “sidebars.” If you dont want vertical
padding, set this to 0.
*g:vimroom_width*
is the width of your workspace.
You can bind the <Plug>VimroomToggle function to any key combination you like
via the usual mechanisms. For example::
>
nnoremap <silent> <Leader>mz <Plug>VimroomToggle
<>
Would bind the function to <Leader>mz. Trivial, right?
And thats it!
==============================================================================
vim:tw=78:ts=2:sw=2:expandtab:ft=help:norl:

View file

@ -1,355 +0,0 @@
"==============================================================================
"File: vimroom.vim
"Description: Vaguely emulates a writeroom-like environment in Vim by
" splitting the current window in such a way as to center a column
" of user-specified width, wrap the text, and break lines.
"Maintainer: Mike West <mike@mikewest.org>
"Version: 0.7
"Last Change: 2010-10-31
"License: BSD <../LICENSE.markdown>
"==============================================================================
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin Configuration
"
" The typical start to any vim plugin: If the plugin has already been loaded,
" exit as quickly as possible.
if exists( "g:loaded_vimroom_plugin" )
finish
endif
let g:loaded_vimroom_plugin = 1
" The desired column width. Defaults to 100:
if !exists( "g:vimroom_width" )
let g:vimroom_width = 100
endif
" The minimum sidebar size. Defaults to 5:
if !exists( "g:vimroom_min_sidebar_width" )
let g:vimroom_min_sidebar_width = 5
endif
" The sidebar height. Defaults to 3:
if !exists( "g:vimroom_sidebar_height" )
let g:vimroom_sidebar_height = 2
endif
" The GUI background color. Defaults to "black"
if !exists( "g:vimroom_guibackground" )
let g:vimroom_guibackground = "#202020"
endif
" The cterm background color. Defaults to "bg"
if !exists( "g:vimroom_ctermbackground" )
let g:vimroom_ctermbackground = "bg"
endif
" The "scrolloff" value: how many lines should be kept visible above and below
" the cursor at all times? Defaults to 999 (which centers your cursor in the
" active window).
if !exists( "g:vimroom_scrolloff" )
let g:vimroom_scrolloff = 0
endif
" Should Vimroom map navigational keys (`<Up>`, `<Down>`, `j`, `k`) to navigate
" "display" lines instead of "logical" lines (which makes it much simpler to deal
" with wrapped lines). Defaults to `1` (on). Set to `0` if you'd prefer not to
" run the mappings.
if !exists( "g:vimroom_navigation_keys" )
let g:vimroom_navigation_keys = 1
endif
" Should Vimroom clear line numbers from the Vimroomed buffer? Defaults to `1`
" (on). Set to `0` if you'd prefer Vimroom to leave line numbers untouched.
" (Note that setting this to `0` will not turn line numbers on if they aren't
" on already).
if !exists( "g:vimroom_clear_line_numbers" )
let g:vimroom_clear_line_numbers = 1
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin Code
"
" Given the desired column width, and minimum sidebar width, determine
" the minimum window width necessary for splitting to make sense
let s:minwidth = g:vimroom_width + ( g:vimroom_min_sidebar_width * 2 )
" Save the current color scheme for reset later
let s:scheme = ""
if exists( "g:colors_name" )
let s:scheme = g:colors_name
endif
if exists( "&t_mr" )
let s:save_t_mr = &t_mr
end
" Save the current scrolloff value for reset later
let s:save_scrolloff = ""
if exists( "&scrolloff" )
let s:save_scrolloff = &scrolloff
end
" Save the current `laststatus` value for reset later
let s:save_laststatus = ""
if exists( "&laststatus" )
let s:save_laststatus = &laststatus
endif
" 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
" Save the current `showtabline` value for reset later
let s:save_showtabline = ""
if exists( "&showtabline" )
let s:save_showtabline = &showtabline
endif
" Save the current `textwidth` value for reset later
let s:save_textwidth = ""
if exists( "&textwidth" )
let s:save_textwidth = &textwidth
endif
" Save the current `number` and `relativenumber` values for reset later
let s:save_number = 0
let s:save_relativenumber = 0
if exists( "&number" )
let s:save_number = &number
endif
if exists ( "&relativenumber" )
let s:save_relativenumber = &relativenumber
endif
" We're currently in nonvimroomized state
let s:active = 0
function! s:is_the_screen_wide_enough()
return winwidth( winnr() ) >= s:minwidth
endfunction
function! s:sidebar_size()
return ( winwidth( winnr() ) - g:vimroom_width - 2 ) / 2
endfunction
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=" . g:vimroom_ctermbackground
let l:highlightfgbgcolor = "ctermfg=" . g:vimroom_ctermbackground . " " . 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! <SID>VimroomToggle()
if s:active == 1
let s:active = 0
" Close all other split windows
if g:vimroom_sidebar_height
wincmd j
close
wincmd k
close
endif
if g:vimroom_min_sidebar_width
wincmd l
close
wincmd h
close
endif
" Reset color scheme (or clear new colors, if no scheme is set)
if s:scheme != ""
exec( "colorscheme " . s:scheme )
else
hi clear
endif
if s:save_t_mr != ""
exec( "set t_mr=" .s:save_t_mr )
endif
" Reset `scrolloff` and `laststatus`
if s:save_scrolloff != ""
exec( "set scrolloff=" . s:save_scrolloff )
endif
if s:save_laststatus != ""
exec( "set laststatus=" . s:save_laststatus )
endif
if s:save_showtabline != ""
exec( "set showtabline=" . s:save_showtabline )
endif
exec( "set linespace=0" )
if s:save_background != ""
exec( "set background=" . s:save_background )
endif
if s:save_textwidth != ""
exec( "set textwidth=" . s:save_textwidth )
endif
if s:save_number != 0
set number
endif
if s:save_relativenumber != 0
set relativenumber
endif
" Remove wrapping and linebreaks
set nowrap
set nolinebreak
" Enable AirLine
exec("silent AirlineToggle")
exec("silent AirlineRefresh")
else
if s:is_the_screen_wide_enough()
let is_mark_or_rst = &filetype == "markdown" || &filetype == "rst" || &filetype == "text"
if is_mark_or_rst
call s:markdown_room()
endif
" Disable AirLine
exec("silent AirlineToggle")
let s:active = 1
let s:sidebar = s:sidebar_size()
" Turn off status bar
if s:save_laststatus != ""
setlocal laststatus=0
endif
" Turn off tabline
if s:save_showtabline != ""
setlocal showtabline=0
endif
if g:vimroom_min_sidebar_width
" Create the left sidebar
exec( "silent leftabove " . s:sidebar . "vsplit new" )
setlocal noma
setlocal nocursorline
setlocal nonumber
silent! setlocal norelativenumber
wincmd l
" Create the right sidebar
exec( "silent rightbelow " . s:sidebar . "vsplit new" )
setlocal noma
setlocal nocursorline
setlocal nonumber
silent! setlocal norelativenumber
wincmd h
exec( "silent vertical resize " . g:vimroom_width )
endif
if g:vimroom_sidebar_height
" Create the top sidebar
exec( "silent leftabove " . g:vimroom_sidebar_height . "split new" )
setlocal noma
setlocal nocursorline
setlocal nonumber
silent! setlocal norelativenumber
wincmd j
" Create the bottom sidebar
exec( "silent rightbelow " . g:vimroom_sidebar_height . "split new" )
setlocal noma
setlocal nocursorline
setlocal nonumber
silent! setlocal norelativenumber
wincmd k
endif
" Setup wrapping, line breaking, and push the cursor down
set wrap
set linebreak
if g:vimroom_clear_line_numbers
set nonumber
silent! set norelativenumber
endif
if s:save_textwidth != ""
exec( "set textwidth=".g:vimroom_width )
endif
if s:save_scrolloff != ""
exec( "set scrolloff=".g:vimroom_scrolloff )
endif
" Setup navigation over "display lines", not "logical lines" if
" mappings for the navigation keys don't already exist.
if g:vimroom_navigation_keys
try
noremap <unique> <silent> <Up> g<Up>
noremap <unique> <silent> <Down> g<Down>
noremap <unique> <silent> k gk
noremap <unique> <silent> j gj
inoremap <unique> <silent> <Up> <C-o>g<Up>
inoremap <unique> <silent> <Down> <C-o>g<Down>
catch /E227:/
echo "Navigational key mappings already exist."
endtry
endif
" Hide distracting visual elements
if !is_mark_or_rst
if has('gui_running')
let l:highlightbgcolor = "guibg=" . g:vimroom_guibackground
let l:highlightfgbgcolor = "guifg=" . g:vimroom_guibackground . " " . l:highlightbgcolor
else
let l:highlightbgcolor = "ctermbg=" . g:vimroom_ctermbackground
let l:highlightfgbgcolor = "ctermfg=" . g:vimroom_ctermbackground . " " . 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 )
endif
set t_mr=""
set fillchars+=vert:\
endif
endif
endfunction
" Create a mapping for the `VimroomToggle` function
noremap <silent> <Plug>VimroomToggle :call <SID>VimroomToggle()<CR>
" Create a `VimroomToggle` command:
command -nargs=0 VimroomToggle call <SID>VimroomToggle()
" If no mapping exists, map it to `<Leader>V`.
if !hasmapto( '<Plug>VimroomToggle' )
nmap <silent> <Leader>V <Plug>VimroomToggle
endif

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') ]

View file

@ -33,7 +33,7 @@ vim-expand-region https://github.com/terryma/vim-expand-region
vim-multiple-cursors https://github.com/terryma/vim-multiple-cursors
vim-fugitive https://github.com/tpope/vim-fugitive
vim-airline https://github.com/bling/vim-airline
vim-zenroom https://github.com/amix/vim-zenroom
vim-zenroom2 https://github.com/amix/vim-zenroom2
""".strip()
GITHUB_ZIP = '%s/archive/master.zip'

View file

@ -109,4 +109,5 @@ let g:airline_theme="luna"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Vimroom
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <silent> <leader>z :VimroomToggle<cr>
let g:goyo_width=100
nnoremap <silent> <leader>z :Goyo<cr>