[Vim-latex-cvs] vimfiles/plugin imaps.vim,1.3,1.4
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2002-11-04 22:22:59
|
Update of /cvsroot/vim-latex/vimfiles/plugin In directory usw-pr-cvs1:/tmp/cvs-serv18292 Modified Files: imaps.vim Log Message: Preben Randhol reports that imaps.vim adds some gratuitous general purpose maps, the potentially most annoying of which is the mapping for (). Remove the "example" mappings from imaps.vim and instead document a little more heavily. People who want to use imaps.vim for their own general purpose maps will now have to do something like this: au GuiEnter * :call IMAP(lhs, rhs, '') (because calling IMAP on the guienter event ensures that imaps.vim is already sourced). Index: imaps.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/plugin/imaps.vim,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** imaps.vim 2 Nov 2002 02:55:17 -0000 1.3 --- imaps.vim 4 Nov 2002 22:22:55 -0000 1.4 *************** *** 5,9 **** " Description: insert mode template expander with cursor placement " while preserving filetype indentation. ! " Last Change: Sun Oct 27 01:00 AM 2002 PST " " Documentation: {{{ --- 5,9 ---- " Description: insert mode template expander with cursor placement " while preserving filetype indentation. ! " Last Change: Mon Nov 04 02:00 PM 2002 PST " " Documentation: {{{ *************** *** 51,57 **** " placement. " ! " Consider a working example: " ! " call IMAP ("bit`", "\\begin{itemize}\<cr>\\item ä\<cr>\\end{itemize}«»", "tex") " " This effectively sets up the map for "bit`" whenever you edit a latex file. --- 51,57 ---- " placement. " ! " Example One: " ! " call IMAP ("bit`", "\\begin{itemize}\<cr>\\item «»\<cr>\\end{itemize}«»", "tex") " " This effectively sets up the map for "bit`" whenever you edit a latex file. *************** *** 62,71 **** " \end{itemize}«» " ! " where * shows the cursor position. The special character ä (typed as ! " CTRL-K + a + :) decides the cursor placement after the expansion. If there ! " is no ä, then the cursor is left at the end. Note also the «» characters. ! " They are "place-holders". Place holders are inspired by Stephen Reihm's ! " bracketing system and provide a convenient way of navigating. After you have ! " typed in the item, just press Control-J and you will be taken to «». " "--------------------------------------%<-------------------------------------- --- 62,86 ---- " \end{itemize}«» " ! " where * shows the cursor position. The cursor position after inserting the ! " text is decided by the position of the first "place-holder". Place holders ! " are special characters which decide cursor placement and movement. In the ! " example above, the place holder characters are « and ». After you have typed ! " in the item, press <C-j> and you will be taken to the next set of «»'s. ! " Therefore by placing the «» characters appropriately, you can minimize the ! " use of movement keys. ! " ! " NOTE: Set g:Imap_UsePlaceHolders to 0 to disable placeholders altogether. ! " Set ! " g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd ! " to something else if you want different place holder characters. ! " Also, b:Imap_PlaceHolderStart and b:Imap_PlaceHolderEnd override the values ! " of g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd respectively. This is ! " useful for setting buffer specific place hoders. ! " ! " Example Two: ! " You can use the <C-r> command to insert dynamic elements such as dates. ! " call IMAP ('date`', "\<c-r>=strftime('%b %d %Y')\<cr>", '') ! " ! " sets up the map for date` to insert the current date. " "--------------------------------------%<-------------------------------------- *************** *** 76,79 **** --- 91,100 ---- " }}} + " Prevent resourcing this file. + if exists('s:doneImaps') + finish + endif + let s:doneImaps = 1 + " ============================================================================== " functions for easy insert mode mappings. *************** *** 518,538 **** " ============================================================================== ! " examples of IMAP() usage and bonus function " ============================================================================== - " Miscellaneous general purpose mappings. {{{ - " these are mappings which were originally in imaps.vim. - " - " extract the leader character. the mappings need to go *after* the functio - " IMAP() is defined. - let s:ml = exists('g:mapleader') ? g:mapleader : '\' - " General purpose mappings {{{ - call IMAP ('date'.s:ml, "\<c-r>=strftime('%b %d %Y')\<cr>", '') - call IMAP ('stamp'.s:ml, "Last Change: \<c-r>=strftime('%a %b %d %I:00 %p %Y PST')\<cr>", '') - call IMAP ('winm'.s:ml, "http://robotics.eecs.berkeley.edu/~srinath/vim/winmanager-2.0.htm", '') - call IMAP ('latexs'.s:ml, "http://robotics.eecs.berkeley.edu/~srinath/vim/latexSuite.zip", '') - call IMAP ('homep'.s:ml, "http://robotics.eecs.berkeley.edu/~srinath", '') - call IMAP ('()', '(ä)«»', "") - " End general purpose mappings }}} - " }}} " Snip: puts a scissor string above and below block of text {{{ " Desciption: --- 539,544 ---- " ============================================================================== ! " A bonus function: Snip() " ============================================================================== " Snip: puts a scissor string above and below block of text {{{ " Desciption: |