[
  {
    "path": "LICENSE.markdown",
    "content": "Copyright (c) 2010 Mike West, http://mikewest.org/\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\nRedistributions 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.\n\nNeither 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.\n\nTHIS 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.\n"
  },
  {
    "path": "README.markdown",
    "content": "Vimroom\n=======\n\nReadme goes here.\n"
  },
  {
    "path": "doc/vimroom.txt",
    "content": "*vimroom.txt*\n\n==============================================================================\nTABLE OF CONTENTS                                          *vimroom* *vimroom-toc*\n\n  1. About                                                       |vimroom-about|\n  2. Installation                                         |vimroom-installation|\n  3. Configuration                                       |vimroom-configuration|\n\n==============================================================================\nABOUT                                                            *vimroom-about*\n\nI do most of my writing in Vim, because I’m a big nerd. It does most of what\nI want a writing environment to do, but I miss some of the “distraction free\"\nfeatures of the quite exceptional WriteRoom. Fullscreening Vim means that text\nends up flat up against the left side of my monitor, but I’d much prefer it to\nbe centered. I’d also like a little of the visual clutter to fade away.  Some\nof this is possible with MacVim, but I’d rather do as much as possible in\na platform-independent way. So, command-line Vim it is.\n\nFor more visit:\n  http://projects.mikewest.org/vimroom/\n  https://github.com/mikewest/vimroom\n\n==============================================================================\nINSTALLATION                                              *vimroom-installation*\n\nI think the best way to install Vim plugins is via Tim Pope’s Pathogen. Using\nthat plugin, you can simply clone the VimRoom repository into your bundles\ndirectory, and you’re done.\n\nWithout Pathogen, installation is almost as trivial: simply copy\n./plugins/vimroom.vim from the repository into your plugins directory. That’s\nit!\n\n==============================================================================\nCONFIGURATION                                            *vimroom-configuration*\n\nBy default, VimRoom binds <Leader>V to <Plug>VimroomToggle, and sets up an 80\ncolumn workspace with at least 5 columns of space on either side (it doesn’t\nhelp at all to have single-column sidebars, you see), and 3 lines of space\nabove and below. It assumes a black background when hiding visual\ndistractions. As of v0.4, VimRoom also sets up a :VimroomToggle command that\nhas the same effect.\n\nChanging any of these assumptions is a simple matter of setting variables in\nyour .vimrc.\n\n                                                        *g:vimroom_background*\nis the background color to be used for hiding elements.  Set this to your\nterminal’s background color (“white”, “black”, etc.)\n\n                                                 *g:vimroom_min_sidebar_width*\nis the minimum sidebar width. This will automatically expand to take up all\nthe free space left after setting the main workspace window to g:vimroom_width\npcolumns.\n\n                                                 *g:vimroom_navigational_keys*\ndetermines whether Vimroom will map keys like <Up>, <Down>, j, and k to\nnavigate over “display” lines, rather than “logical” lines. This defaults to\np1 (on), if you’d prefer the mapping not take place, set it to 0 (off).\n\n                                                         *g:vimroom_scrolloff*\nspecifies how many lines of text ought appear before and after the cursor.\npThis defaults to 999, which centers the cursor on the screen.\n\n                                                    *g:vimroom_sidebar_height*\nsets the height of the upper and lower “sidebars.” If you don’t want vertical\npadding, set this to 0.\n\n                                                             *g:vimroom_width*\nis the width of your workspace.\n\n\nYou can bind the <Plug>VimroomToggle function to any key combination you like\nvia the usual mechanisms. For example::\n>\n  nnoremap <silent> <Leader>mz <Plug>VimroomToggle\n<>\n\nWould bind the function to <Leader>mz. Trivial, right?\n\nAnd that’s it!\n\n==============================================================================\nvim:tw=78:ts=2:sw=2:expandtab:ft=help:norl:\n"
  },
  {
    "path": "plugin/vimroom.vim",
    "content": "\"==============================================================================\n\"File:        vimroom.vim\n\"Description: Vaguely emulates a writeroom-like environment in Vim by\n\"             splitting the current window in such a way as to center a column\n\"             of user-specified width, wrap the text, and break lines.\n\"Maintainer:  Mike West <mike@mikewest.org>\n\"Version:     0.7\n\"Last Change: 2010-10-31\n\"License:     BSD <../LICENSE.markdown>\n\"==============================================================================\n\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\" Plugin Configuration\n\"\n\n\" The typical start to any vim plugin: If the plugin has already been loaded,\n\" exit as quickly as possible.\nif exists( \"g:loaded_vimroom_plugin\" )\n    finish\nendif\nlet g:loaded_vimroom_plugin = 1\n\n\" The desired column width.  Defaults to 80:\nif !exists( \"g:vimroom_width\" )\n    let g:vimroom_width = 80\nendif\n\n\" The minimum sidebar size.  Defaults to 5:\nif !exists( \"g:vimroom_min_sidebar_width\" )\n    let g:vimroom_min_sidebar_width = 5\nendif\n\n\" The sidebar height.  Defaults to 3:\nif !exists( \"g:vimroom_sidebar_height\" )\n    let g:vimroom_sidebar_height = 3\nendif\n\n\" The GUI background color.  Defaults to \"black\"\nif !exists( \"g:vimroom_guibackground\" )\n    let g:vimroom_guibackground = \"black\"\nendif\n\n\" The cterm background color.  Defaults to \"bg\"\nif !exists( \"g:vimroom_ctermbackground\" )\n    let g:vimroom_ctermbackground = \"bg\"\nendif\n\n\" The \"scrolloff\" value: how many lines should be kept visible above and below\n\" the cursor at all times?  Defaults to 999 (which centers your cursor in the \n\" active window).\nif !exists( \"g:vimroom_scrolloff\" )\n    let g:vimroom_scrolloff = 999\nendif\n\n\" Should Vimroom map navigational keys (`<Up>`, `<Down>`, `j`, `k`) to navigate\n\" \"display\" lines instead of \"logical\" lines (which makes it much simpler to deal\n\" with wrapped lines). Defaults to `1` (on). Set to `0` if you'd prefer not to\n\" run the mappings.\nif !exists( \"g:vimroom_navigation_keys\" )\n    let g:vimroom_navigation_keys = 1\nendif\n\n\" Should Vimroom clear line numbers from the Vimroomed buffer?  Defaults to `1`\n\" (on). Set to `0` if you'd prefer Vimroom to leave line numbers untouched.\n\" (Note that setting this to `0` will not turn line numbers on if they aren't\n\" on already).\nif !exists( \"g:vimroom_clear_line_numbers\" )\n    let g:vimroom_clear_line_numbers = 1\nendif\n\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\" Plugin Code\n\"\n\n\" Given the desired column width, and minimum sidebar width, determine\n\" the minimum window width necessary for splitting to make sense\nlet s:minwidth = g:vimroom_width + ( g:vimroom_min_sidebar_width * 2 )\n\n\" Save the current color scheme for reset later\nlet s:scheme = \"\"\nif exists( \"g:colors_name\" )\n    let s:scheme = g:colors_name\nendif\nif exists( \"&t_mr\" )\n    let s:save_t_mr = &t_mr\nend\n\n\" Save the current scrolloff value for reset later\nlet s:save_scrolloff = \"\"\nif exists( \"&scrolloff\" )\n    let s:save_scrolloff = &scrolloff\nend\n\n\" Save the current `laststatus` value for reset later\nlet s:save_laststatus = \"\"\nif exists( \"&laststatus\" )\n    let s:save_laststatus = &laststatus\nendif\n\n\" Save the current `textwidth` value for reset later\nlet s:save_textwidth = \"\"\nif exists( \"&textwidth\" )\n    let s:save_textwidth = &textwidth\nendif\n\n\" Save the current `number` and `relativenumber` values for reset later\nlet s:save_number = 0\nlet s:save_relativenumber = 0\nif exists( \"&number\" )\n    let s:save_number = &number\nendif\nif exists ( \"&relativenumber\" )\n    let s:save_relativenumber = &relativenumber\nendif\n\n\" We're currently in nonvimroomized state\nlet s:active   = 0\n\nfunction! s:is_the_screen_wide_enough()\n    return winwidth( winnr() ) >= s:minwidth\nendfunction\n\nfunction! s:sidebar_size()\n    return ( winwidth( winnr() ) - g:vimroom_width - 2 ) / 2\nendfunction\n\nfunction! <SID>VimroomToggle()\n    if s:active == 1\n        let s:active = 0\n        \" Close all other split windows\n        if g:vimroom_sidebar_height\n            wincmd j\n            close\n            wincmd k\n            close\n        endif\n        if g:vimroom_min_sidebar_width\n            wincmd l\n            close\n            wincmd h\n            close\n        endif\n        \" Reset color scheme (or clear new colors, if no scheme is set)\n        if s:scheme != \"\"\n            exec( \"colorscheme \" . s:scheme ) \n        else\n            hi clear\n        endif\n        if s:save_t_mr != \"\"\n            exec( \"set t_mr=\" .s:save_t_mr )\n        endif\n        \" Reset `scrolloff` and `laststatus`\n        if s:save_scrolloff != \"\"\n            exec( \"set scrolloff=\" . s:save_scrolloff )\n        endif\n        if s:save_laststatus != \"\"\n            exec( \"set laststatus=\" . s:save_laststatus )\n        endif\n        if s:save_textwidth != \"\"\n            exec( \"set textwidth=\" . s:save_textwidth )\n        endif\n        if s:save_number != 0\n            set number\n        endif\n        if s:save_relativenumber != 0\n            set relativenumber\n        endif\n        \" Remove wrapping and linebreaks\n        set nowrap\n        set nolinebreak\n    else\n        if s:is_the_screen_wide_enough()\n            let s:active = 1\n            let s:sidebar = s:sidebar_size()\n            \" Turn off status bar\n            if s:save_laststatus != \"\"\n                setlocal laststatus=0\n            endif\n            if g:vimroom_min_sidebar_width\n                \" Create the left sidebar\n                exec( \"silent leftabove \" . s:sidebar . \"vsplit new\" )\n                setlocal noma\n                setlocal nocursorline\n                setlocal nonumber\n                silent! setlocal norelativenumber\n                wincmd l\n                \" Create the right sidebar\n                exec( \"silent rightbelow \" . s:sidebar . \"vsplit new\" )\n                setlocal noma\n                setlocal nocursorline\n                setlocal nonumber\n                silent! setlocal norelativenumber\n                wincmd h\n            endif\n            if g:vimroom_sidebar_height\n                \" Create the top sidebar\n                exec( \"silent leftabove \" . g:vimroom_sidebar_height . \"split new\" )\n                setlocal noma\n                setlocal nocursorline\n                setlocal nonumber\n                silent! setlocal norelativenumber\n                wincmd j\n                \" Create the bottom sidebar\n                exec( \"silent rightbelow \" . g:vimroom_sidebar_height . \"split new\" )\n                setlocal noma\n                setlocal nocursorline\n                setlocal nonumber\n                silent! setlocal norelativenumber\n                wincmd k\n            endif\n            \" Setup wrapping, line breaking, and push the cursor down\n            set wrap\n            set linebreak\n            if g:vimroom_clear_line_numbers\n                set nonumber\n                silent! set norelativenumber\n            endif\n            if s:save_textwidth != \"\"\n                exec( \"set textwidth=\".g:vimroom_width )\n            endif\n            if s:save_scrolloff != \"\"\n                exec( \"set scrolloff=\".g:vimroom_scrolloff )\n            endif\n\n            \" Setup navigation over \"display lines\", not \"logical lines\" if\n            \" mappings for the navigation keys don't already exist.\n            if g:vimroom_navigation_keys\n                try\n                    noremap     <unique> <silent> <Up> g<Up>\n                    noremap     <unique> <silent> <Down> g<Down>\n                    noremap     <unique> <silent> k gk\n                    noremap     <unique> <silent> j gj\n                    inoremap    <unique> <silent> <Up> <C-o>g<Up>\n                    inoremap    <unique> <silent> <Down> <C-o>g<Down>\n                catch /E227:/\n                    echo \"Navigational key mappings already exist.\"\n                endtry\n            endif\n\n            \" Hide distracting visual elements\n            if has('gui_running')\n                let l:highlightbgcolor = \"guibg=\" . g:vimroom_guibackground\n                let l:highlightfgbgcolor = \"guifg=\" . g:vimroom_guibackground . \" \" . l:highlightbgcolor\n            else\n                let l:highlightbgcolor = \"ctermbg=\" . g:vimroom_ctermbackground\n                let l:highlightfgbgcolor = \"ctermfg=\" . g:vimroom_ctermbackground . \" \" . l:highlightbgcolor\n            endif\n            exec( \"hi Normal \" . l:highlightbgcolor )\n            exec( \"hi VertSplit \" . l:highlightfgbgcolor )\n            exec( \"hi NonText \" . l:highlightfgbgcolor )\n            exec( \"hi StatusLine \" . l:highlightfgbgcolor )\n            exec( \"hi StatusLineNC \" . l:highlightfgbgcolor )\n            set t_mr=\"\"\n            set fillchars+=vert:\\ \n        endif\n    endif\nendfunction\n\n\" Create a mapping for the `VimroomToggle` function\nnoremap <silent> <Plug>VimroomToggle    :call <SID>VimroomToggle()<CR>\n\n\" Create a `VimroomToggle` command:\ncommand -nargs=0 VimroomToggle call <SID>VimroomToggle()\n\n\" If no mapping exists, map it to `<Leader>V`.\nif !hasmapto( '<Plug>VimroomToggle' )\n    nmap <silent> <Leader>V <Plug>VimroomToggle\nendif\n"
  }
]