" Text formatter plugin for Vim text editor " " This plugin provides commands and key mappings to quickly align and format " text. Text can be aligned to either left or right margin or justified to " both margins or centered. The text formatting commands in this plugin are " a bit different from those integrated to Vim. " " Version: 0.9 " Maintainer: Teemu Likonen " GetLatestVimScripts: 0 0 :AutoInstall: textformat.vim " " {{{ Copyright and license " " Copyright (C) 2008 Teemu Likonen " " This program is free software; you can redistribute it and/or modify " it under the terms of the GNU General Public License as published by " the Free Software Foundation; either version 2 of the License, or " (at your option) any later version. " " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. " " You should have received a copy of the GNU General Public License " along with this program; if not, write to the Free Software " Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA " " The License text in full: " http://www.gnu.org/licenses/old-licenses/gpl-2.0.html " " }}} command! -nargs=? -range AlignLeft ,call textformat#Align_Command('left',) command! -nargs=? -range AlignRight ,call textformat#Align_Command('right',) command! -nargs=? -range AlignJustify ,call textformat#Align_Command('justify',) command! -nargs=? -range AlignCenter ,call textformat#Align_Command('center',) 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#Align_Command('left') vnoremap Align_Range_Right :call textformat#Align_Command('right') vnoremap Align_Range_Justify :call textformat#Align_Command('justify') vnoremap Align_Range_Center :call textformat#Align_Command('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 " vim600: fdm=marker