[Vim-latex-cvs] vimfiles/plugin imaps.vim,1.15,1.16
Brought to you by:
srinathava,
tmaas
|
From: <sri...@us...> - 2002-12-31 09:21:04
|
Update of /cvsroot/vim-latex/vimfiles/plugin
In directory sc8-pr-cvs1:/tmp/cvs-serv20482
Modified Files:
imaps.vim
Log Message:
1. Problem: When the user tries to trigger an abbreviation near the eol,
the marker string being too long triggers a line break.
Therefore, just for the time being check to see if phs != phe, and if
so, then use phs.phs as the marker (improbable string).
We would like ultimately to completeley get over this hack and use
movement instead.
2. Problem: The <C-K> map for jumping back was interfering with the
dictionary completion mode of vim. Therefore change default mapping for
jumping back to <S-C-J> instead of <C-K>. Ofcourse this makes it
invisible to non-gui users (I think).
3. Tried to do the "right" thing for mapping. First provide a number of
mappings using <plug>. These mappings call IMAP_Jumpfunc() in various
ways. Various <plug> mappings for various modes have been provided.
After this, we map the default keys to the <plug> mappings checking for
hasmapto() each time. This provides for a robust and easy user
customization. Initially, the user had to do something like:
inoremap <C-J> <C-r>=IMAP_Jumpfunc('', 0)<CR>
in his .vimrc to be able to override our mapping. Now he will do
inoremap <C-J> <Plug>IMAP_JumpForward
Doing this also has the advantage that changes in IMAP_Jumpfunc() will
not affect the user customization.
NOTE: This <plug> things were inspired by looking at the excellent
cvscommand.vim plugin I've begun using...
Index: imaps.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/plugin/imaps.vim,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** imaps.vim 30 Dec 2002 10:54:49 -0000 1.15
--- imaps.vim 31 Dec 2002 09:21:01 -0000 1.16
***************
*** 8,12 ****
" while preserving filetype indentation.
"
! " Last Change: Mon Dec 30 02:00 AM 2002 PST
"
" Documentation: {{{
--- 8,12 ----
" while preserving filetype indentation.
"
! " Last Change: Tue Dec 31 01:00 AM 2002 PST
"
" Documentation: {{{
***************
*** 269,273 ****
" A very rare string: Do not use any special characters here. This is used
" for moving to the beginning of the inserted text.
! let marker = '<!---@#%_Start_Here_@#%----!>'
let markerLength = strlen(marker)
--- 269,280 ----
" A very rare string: Do not use any special characters here. This is used
" for moving to the beginning of the inserted text.
! " When phs != phe, we are guarenteed that unless the user has done bad
! " things, phs.phs will never occur in the file.
! if phsUser != pheUser
! let marker = phsUser.phsUser
! else
! let marker = '<!---@#%_Start_Here_@#%----!>'
! endif
! call Tex_Debug('marker = '.marker)
let markerLength = strlen(marker)
***************
*** 404,421 ****
" }}}
" Maps for IMAP_Jumpfunc {{{
" map only if there is no mapping already. allows for user customization.
! if !hasmapto('IMAP_Jumpfunc')
! inoremap <C-J> <c-r>=IMAP_Jumpfunc('', 0)<CR>
! inoremap <C-K> <c-r>=IMAP_Jumpfunc('b', 0)<CR>
! nmap <C-J> i<C-J>
! nmap <C-K> i<C-K>
! if exists('g:Imap_StickyPlaceHolders') && g:Imap_StickyPlaceHolders
! vmap <C-J> <C-\><C-N>i<C-J>
! vmap <C-K> <C-\><C-N>i<C-K>
! else
! vmap <C-J> <Del>i<C-J>
! vmap <C-K> <Del>i<C-K>
endif
! end
" }}}
--- 411,467 ----
" }}}
" Maps for IMAP_Jumpfunc {{{
+ "
+ " These mappings use <Plug> and thus provide for easy user customization. When
+ " the user wants to map some other key to jump forward, he can do for
+ " instance:
+ " nmap ,f <plug>IMAP_JumpForward
+ " etc.
+
+ " jumping forward and back in insert mode.
+ imap <silent> <Plug>IMAP_JumpForward <c-r>=IMAP_Jumpfunc('', 0)<CR>
+ imap <silent> <Plug>IMAP_JumpBack <c-r>=IMAP_Jumpfunc('b', 0)<CR>
+
+ " jumping in normal mode
+ nmap <silent> <Plug>IMAP_JumpForward i<c-r>=IMAP_Jumpfunc('', 0)<CR>
+ nmap <silent> <Plug>IMAP_JumpBack i<c-r>=IMAP_Jumpfunc('b', 0)<CR>
+
+ " deleting the present selection and then jumping forward.
+ vmap <silent> <Plug>IMAP_DeleteAndJumpForward "_<Del>i<c-r>=IMAP_Jumpfunc('', 0)<CR>
+ vmap <silent> <Plug>IMAP_DeleteAndJumpBack "_<Del>i<c-r>=IMAP_Jumpfunc('b', 0)<CR>
+
+ " jumping forward without deleting present selection.
+ vmap <silent> <Plug>IMAP_JumpForward <C-\><C-N>i<c-r>=IMAP_Jumpfunc('', 0)<CR>
+ vmap <silent> <Plug>IMAP_JumpBack <C-\><C-N>i<c-r>=IMAP_Jumpfunc('b', 0)<CR>
+
+ " }}}
+ " Default maps for IMAP_Jumpfunc {{{
" map only if there is no mapping already. allows for user customization.
! if !hasmapto('<Plug>IMAP_JumpForward', 'i')
! imap <C-J> <Plug>IMAP_JumpForward
! endif
! if !hasmapto('<Plug>IMAP_JumpBack', 'i')
! imap <S-C-J> <Plug>IMAP_JumpBack
! endif
! if !hasmapto('<Plug>IMAP_JumpForward', 'n')
! nmap <C-J> <Plug>IMAP_JumpForward
! endif
! if !hasmapto('<Plug>IMAP_JumpBack', 'n')
! nmap <S-C-J> <Plug>IMAP_JumpBack
! endif
! if exists('g:Imap_StickyPlaceHolders') && g:Imap_StickyPlaceHolders
! if !hasmapto('<Plug>IMAP_JumpForward', 'v')
! vmap <C-J> <Plug>IMAP_JumpForward
endif
! if !hasmapto('<Plug>IMAP_JumpBack', 'v')
! vmap <S-C-J> <Plug>IMAP_JumpBack
! endif
! else
! if !hasmapto('<Plug>IMAP_DeleteAndJumpForward', 'v')
! vmap <C-J> <Plug>IMAP_DeleteAndJumpForward
! endif
! if !hasmapto('<Plug>IMAP_DeleteAndJumpBack', 'v')
! vmap <S-C-J> <Plug>IMAP_DeleteAndJumpBack
! endif
! endif
" }}}
|