Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 1fbc0cd025ec2dc87b9cabd9f205a101806f0133 @Soares committed Oct 1, 2012
Showing with 111 additions and 0 deletions.
  1. +17 −0 README.md
  2. +50 −0 doc/write.txt
  3. +44 −0 plugin/write.vim
@@ -0,0 +1,17 @@
+# Write.vim
+## Get your author on
+
+Write.vim helps you turn vim into not just a code editor, but an editor for
+plain text (novels, stories, papers, articles, etc.).
+
+This plugin provides commands like :WriteOn, :WriteOff, and :Write. It's
+recommended that you add your own mappings to trigger these commands, such as:
+
+ noremap <leader>w :WriteOn
+ noremap <leader>W :WriteOff
+
+or
+
+ noremap <leader>w :Write
+
+to toggle writer mode.
@@ -0,0 +1,50 @@
+*write.txt* Get your author on.
+
+Author: Nate Soares <http://so8r.es/>
+License: Same terms as Vim itself (see |license|)
+
+INTRODUCTION *write*
+
+Vim writing mode, for writing non-code text (books, novels, etc.).
+
+COMMANDS *write-commands*
+
+ *write-:WriteOn*
+:WriteOn Turn writing mode on. This does the following:
+ - soft wrap lines
+ - make j & k navigate screenwise, not linewise
+ - turn selling on
+ - turn line numbers off
+ As well as a few other tweaks that make writing easier.
+
+
+ *write-:WriteOff*
+:WriteOff Turn writing mode off. Resets all values changed by
+ :WriteOn (which are changed locally) to the global
+ values.
+
+ *write-:Write*
+:Write Toggles writing mode.
+
+
+Turn writing mode on. This does the following:
+ -
+FUNCTIONS *write-Functions*
+
+ *write#On*
+write#On Turn writing mode on.
+
+ *write#Off*
+write#Off Turn writing mode off.
+
+ *write#Toggle*
+write#Toggle Toggle writing mode.
+
+
+ABOUT *write-about*
+
+Grab the latest version or report a bug on GitHub:
+
+http://github.com/Soares/write.vim
+
+ vim:tw=78:ts=8:sw=0:noet:ft=help:norl:
@@ -0,0 +1,44 @@
+" write.vim: Get your author on.
+"
+" Author: Nate Soares <http://so8r.es>
+" Version: 1.0
+" License: The same as vim itself. (See |license|)
+
+if exists("g:loaded_write") || &cp || v:version < 700
+ finish
+endif
+let g:loaded_write = 1
+
+let g:write_writing = 0
+
+" Sets the buffer as writer-friendly.
+function! write#On()
+ let g:write_writing=1
+ setlocal wrap linebreak nolist
+ setlocal display+=lastline
+ noremap <buffer> <silent> k gk
+ noremap <buffer> <silent> j gj
+ setlocal spell nornu nonu
+endfunction
+command! WriteOn call write#On()
+
+" Unsets the buffer as writer-friendly.
+" Will only undo changes that write.vim made.
+function! write#Off()
+ let g:write_writing=0
+ setlocal wrap< linebreak< nolist< display<
+ silent! unmap <buffer> k
+ silent! unmap <buffer> j
+ setlocal spell< rnu< nu<
+endfunction
+command! WriteOff call write#Off()
+
+" Toggles write mode.
+function! write#Toggle()
+ if g:write_writing
+ call write#Off()
+ else
+ call write#On()
+ endif
+endfunction
+command! Write call write#Toggle()

0 comments on commit 1fbc0cd

Please sign in to comment.