| version 1.4, 2003/01/10 10:42:04 |
version 1.5, 2003/01/21 13:46:07 |
|
|
| "--------------------------------------%<-------------------------------------- |
"--------------------------------------%<-------------------------------------- |
| " }}} |
" }}} |
| |
|
| |
" Only do this when not done yet |
| |
" This plugin is (must be) sourced by ~/.vimrc, because |
| |
" many ftplugins are using function IMAP() |
| |
if exists("b:did_imap_plugin") |
| |
finish |
| |
endif |
| |
let b:did_imap_plugin = 1 |
| |
|
| " IMAP: Adds a "fake" insert mode mapping. {{{ |
" IMAP: Adds a "fake" insert mode mapping. {{{ |
| " For example, doing |
" For example, doing |
| " IMAP('abc', 'def') |
" IMAP('abc', 'def') |
|
|
| " character and then if a possible match exists, ereases the left-hand side |
" character and then if a possible match exists, ereases the left-hand side |
| " and inserts the right hand side instead. |
" and inserts the right hand side instead. |
| silent! function! <SID>LookupCharacter(char) |
silent! function! <SID>LookupCharacter(char) |
| if exists("g:disable_imap") |
if exists("b:disable_imap") |
| if g:disable_imap == 1 |
if b:disable_imap == 1 |
| "echo "LookupCharacter(\"" . a:char . "\") - disabled (g:disabled=1)" |
"echo "LookupCharacter(\"" . a:char . "\") - disabled (b:disabled=1)" |
| " here we must return parameter |
" here we must return parameter |
| return a:char |
return a:char |
| endif |
endif |
| endif |
endif |
| if exists("g:disabled_imap_syntax_items") |
if exists("b:disabled_imap_syntax_items") |
| let currentSyntaxItem = synIDattr(synID(line("."), col(".") - 1, 1), "name") |
let currentSyntaxItem = synIDattr(synID(line("."), col(".") - 1, 1), "name") |
| if match(currentSyntaxItem, g:disabled_imap_syntax_items) != -1 |
if match(currentSyntaxItem, b:disabled_imap_syntax_items) != -1 |
| echo "IMAP mappings are disabled here" |
echo "IMAP mappings are disabled here" |
| return a:char |
return a:char |
| endif |
endif |
| Line 202 silent! function! <SID>LookupCharacter(c |
|
| Line 210 silent! function! <SID>LookupCharacter(c |
|
| "echo "currentSyntaxItem = " . synIDattr(synID(line("."), col(".") - 1, 1), "name") |
"echo "currentSyntaxItem = " . synIDattr(synID(line("."), col(".") - 1, 1), "name") |
| \ 'line = ' . line(".") |
\ 'line = ' . line(".") |
| \ 'col = ' .col(".") |
\ 'col = ' .col(".") |
| echo "LookupCharacter(\"" . a:char . "\") - enabled (g:disabled=0)" |
echo "LookupCharacter(\"" . a:char . "\") - enabled (b:disabled=0)" |
| let charHash = char2nr(a:char) |
let charHash = char2nr(a:char) |
| |
|
| if !exists('s:charLens_' . &ft . '_' . charHash) |
if !exists('s:charLens_' . &ft . '_' . charHash) |
|
|
| let s:ml = exists('g:mapleader') ? g:mapleader : '\' |
let s:ml = exists('g:mapleader') ? g:mapleader : '\' |
| " these are mappings which were originally in imaps.vim. ideally they should |
" these are mappings which were originally in imaps.vim. ideally they should |
| " be in the corresponding ftplugin/<ft>.vim directory. |
" be in the corresponding ftplugin/<ft>.vim directory. |
| |
|
| " General purpose mappings {{{ |
" General purpose mappings {{{ |
| call IMAP ('date' .s:ml, "\<c-r>=strftime('%b %d %Y')\<cr>", '') |
"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 ('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 ('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 ('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 ('homep' . s:ml, "http://robotics.eecs.berkeley.edu/~srinath", '') |
| " End general purpose mappings }}} |
" End general purpose mappings }}} |
| " Vim Mappings {{{ |
" Vim Mappings {{{ |
| call IMAP ('while' . s:ml, |
"call IMAP ('while' . s:ml, |
| \ "let i = لل\<cr>while i <= \<cr>\<cr>\tlet i = i + 1\<cr>\<bs>endwhile", 'vim') |
" \ "let i = لل\<cr>while i <= \<cr>\<cr>\tlet i = i + 1\<cr>\<bs>endwhile", 'vim') |
| call IMAP ('fdesc'.s:ml, "\"Description: ", 'vim') |
"call IMAP ('fdesc'. s:ml, "\"Description: ", 'vim') |
| " end vim mappings }}} |
" end vim mappings }}} |
| |
|
| " Snip: puts a scissor string above and below block of text {{{ |
" Snip: puts a scissor string above and below block of text {{{ |