""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"    // / /Rabbit386's
"   // /         
"  // / //\/\ /\ /
" <>\/ // / //   \ <><><>  v.0.0.2

"Default stuff from Fedora Vim package (vim-minimal, maybe?)
set ignorecase
set smartcase
if has('mouse')
	set mouse=a
endif

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"   // // //        /                     /   
"  // // //        /                      
" // // // /\ /\/\/  /\ /\/\ / // /\ /\ //\/\/
" \/  \/   \//  \/  /\//  \/ \ \ \\ \\ // /\/ <><><>
"                  /                      \/
" This is a function that gives Vim the features of a word processor-- 
" smart wordwrap, some movement remapping to make the wrapping more bearable
" in long paragraphs and adds spell hilighting, then calls an outliner that
" detects markdown section headers. When combined with a markdown-HTML
" converter and a script which concatenates headers and footers on to the
" output, plus CSS and whatever else, this can actually be a very usable 
" word processor for web stuff or even general document writing. Normally
" I wouldn't go to such extremes but there are literally no word processors
" with vi keybindings that still work--abiword hasn't offered the feature in
" a long time and I don't think the plugin for libreoffice does it either. 
" Plus, I much prefer text editors. On my old hardware word processors can 
" lag behind my typing speed.  
" I don't remember who I got the basics of this from but I made some tweaks
" and incorporated the voom outliner plugin and markdown hilighting. Really,
" this is a very simple piece of configuration and not original in the
" slightest, but it's pretty huge for me since I write formatted text all the
" time and vim has a great workflow.

:command Q :qall  " makes q quit everything, while "quit" quits just one individual window. Makes voom play nice
cabbrev q Q 

func! WordProcessor()
  " movement changes
  map j gj
  map k gk
  " formatting text
  setlocal formatoptions=1
  setlocal noexpandtab
  setlocal wrap
  setlocal linebreak
  " spelling and thesaurus--toggle spelling on off.
  setlocal spell spelllang=en_us
  set thesaurus+=/home/faust/.vim/spell/thesaurus.txt
  " make autocompletion search the thesaurus
  set complete+=s
  " show markdown hiliting--if your terminal doesn't have a good italic font
  " set this will look like sh;t. I have URXVT with fixed as the main and
  " Source Code Pro for italics. It was the first passable combo I came up
  " with.
  set syntax=markdown
  Voom markdown
endfu
com! WP call WordProcessor()

" A little thing to turn off spellcheck in WP mode 
func! Off()
  setlocal spell&
endfu
com! Off call Off()

"Turn on markdown hiliting
func! MD()
  setlocal syntax=markdown
endfu
com! MD call MD()

"Turn off markdown hiliting
func! MO()
  setlocal syntax=
endfu
com! MO call MO()

" This is the same function as WP minus spell and syntax hilighting and the outliner.
" I think of this as being kind of like 'wordpad' to WP's 'microsoft word'
" so I call it 'RT' for 'rich text.'

func! RTProcessor()
  " movement changes
  map j gj
  map k gk
  " formatting text
  setlocal formatoptions=1
  setlocal noexpandtab
  setlocal wrap
  setlocal linebreak
  " Thesaurus. I need to find a better plain text thesaurus file. The one I'm
  " using doesn't have a lot of words. But when editing a large English file
  " it will give you autocomplete from words within the file as well. If your
  " file is more than about one or two thousand words this will be
  " surprisingly helpful.
  set thesaurus+=~/.vim/spell/thesaurus.txt 
  " complete+=s makes autocompletion search the thesaurus
  set complete+=s
endfu
com! RT call RTProcessor()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"     // /
"    // /     /   /   //
"   // /     /       /
"  //\ /// //\ //\/\///\/\/ /\
" //  \\/\//\/// /\/// /\/\\ 
"       \/             \/ 
" Next a little binding to dehilight search results when pressing enter in
" command mode
nnoremap <silent><CR> :nohlsearch<CR><CR>
" Add qq (nonexistent in english) as a keybinding for "Escape" to get out of
" insert mode more easily. Some people use jj... actually, I'm starting to use 
" ^[ more---the same way I've started actually using ^H for backspace etc. It
" strikes me as profoundly odd that we're still using enhanced emulations of
" an ancient text terminal made by a company that no longer exists, but as
" long as these shortcuts are here, might as well use them, right?
imap qq <Esc>
"an earlier version of this file had me actually trying to invent keybindings
"to use ^h/^j/^k/^l to move around _in insert mode_. I didn't get vim I guess
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
"     //=====            // /
"    //                 // //
"   //              /  // /
"  //--        /\/\/  // ///\/\ /\/
" //========= / /\/, <>\/// / //  \