Created
March 6, 2012 23:38
-
-
Save amacdougall/1989803 to your computer and use it in GitHub Desktop.
Simple vim script for a single centered text column.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Name: focus.vim | |
" Author: Alan MacDougall <[email protected]> | |
" License: Public Domain | |
" | |
" Focus on a single column of text, showing it in a distraction-free format. | |
" Save this as ~/.vim/scripts/focus.vim (or whatever you please), and invoke | |
" it with :source <filename>. Of course, you could certainly hook that up to a | |
" :command, or a macro, or a Vimscript function... | |
" collapse current splits and divide screen in three | |
only | |
vsplit | |
vsplit | |
" | |
" hide the tildes for nonexistent lines | |
hi! NonText guifg=bg guibg=bg | |
" hide the vertical split borders | |
hi! VertSplit guifg=bg guibg=bg | |
set laststatus=0 " hide status bar | |
set noruler " hide ruler [I prefer to leave this out] | |
enew " edit new blank file, i.e. clear screen | |
set nocul " hide cursor line highlight, if present | |
2wincmd l " move to right-hand split | |
enew | |
set nocul | |
wincmd h " move to center split; happy typing! |
Just open a new gvim/MacVim window before doing this, since there's no provision for reversing the effect!
there is also the VimRoom plugin
Yeah, this little script is very specific to my own setup and needs. I'm really fortunate that MacVim fullscreens at greater than 80 * 3 + 2 columns on my 27" iMac, for instance, meaning my centered column is wide enough for an 80-column text view. To universalize it would involve enough work to where VimRoom is probably a better solution. :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Screenshot: