" Text formatter plugin for Vim text editor " " Version: 2.1 " Last Change: 2008-09-13 " Maintainer: Teemu Likonen " License: This file is placed in the public domain. " GetLatestVimScripts: 2324 1 :AutoInstall: TextFormat "{{{1 The beginning stuff if &compatible || exists('g:loaded_textformat') finish endif let s:save_cpo = &cpo set cpo&vim "}}}1 if v:version < 700 echohl ErrorMsg echomsg 'TextFormat plugin needs Vim version 7.0 or later. Sorry.' echohl None finish endif if !exists(':AlignLeft') command -nargs=? -range AlignLeft ,call textformat#Align_Command('left',) endif if !exists(':AlignRight') command -nargs=? -range AlignRight ,call textformat#Align_Command('right',) endif if !exists(':AlignJustify') command -nargs=? -range AlignJustify ,call textformat#Align_Command('justify',) endif if !exists(':AlignCenter') command -nargs=? -range AlignCenter ,call textformat#Align_Command('center',) endif nnoremap Quick_Align_Paragraph_Left :call textformat#Quick_Align_Left() nnoremap Quick_Align_Paragraph_Right :call textformat#Quick_Align_Right() nnoremap Quick_Align_Paragraph_Justify :call textformat#Quick_Align_Justify() nnoremap Quick_Align_Paragraph_Center :call textformat#Quick_Align_Center() vnoremap Align_Range_Left :call textformat#Visual_Align_Left() vnoremap Align_Range_Right :call textformat#Visual_Align_Right() vnoremap Align_Range_Justify :call textformat#Visual_Align_Justify() vnoremap Align_Range_Center :call textformat#Visual_Align_Center() function! s:Add_Mapping(mode, lhs, rhs) if maparg(a:lhs, a:mode) == '' && !hasmapto(a:rhs, a:mode) execute a:mode.'map '.a:lhs.' '.a:rhs endif endfunction call s:Add_Mapping('n', 'al', 'Quick_Align_Paragraph_Left') call s:Add_Mapping('n', 'ar', 'Quick_Align_Paragraph_Right') call s:Add_Mapping('n', 'aj', 'Quick_Align_Paragraph_Justify') call s:Add_Mapping('n', 'ac', 'Quick_Align_Paragraph_Center') call s:Add_Mapping('v', 'al', 'Align_Range_Left') call s:Add_Mapping('v', 'ar', 'Align_Range_Right') call s:Add_Mapping('v', 'aj', 'Align_Range_Justify') call s:Add_Mapping('v', 'ac', 'Align_Range_Center') delfunction s:Add_Mapping let g:loaded_textformat = 1 let &cpo = s:save_cpo " vim600: fdm=marker