2 Commits
1.3 ... 1.5

Author SHA1 Message Date
Israel Chauca Fuentes
75b4f3b520 == 1.5 ==
Fix: delimitMate should work as expected in files passed as arguments to Vim.
2009-10-05 05:48:09 -05:00
Israel Chauca Fuentes
3ce7f7ffcf === 1.4 ===
Fix: Fix: delimitMate is now enabled on new buffers even if they don't have set the file type option or were opened directly from the terminal.
2009-09-27 16:49:03 -05:00
2 changed files with 103 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
*delimitMate.txt* Trying to keep those beasts at bay!
*delimitMate.txt* Trying to keep those beasts at bay! v.1.5
REFERENCE MANUAL *
@@ -174,8 +174,8 @@ e.g.: >
------------------------------------------------------------------------------
*'delimitMate_autoclose'*
*'b:delimitMate_autoclose'*
Values: 0 or 1.
Default: 1
Values: 0 or 1. ~
Default: 1 ~
If this option is set to 0, delimitMate will not add a closing delimiter
automagically. See |delimitMateAutoClose| for details.
@@ -186,8 +186,8 @@ e.g.: >
------------------------------------------------------------------------------
*'delimitMate_matchpairs'*
*'b:delimitMate_matchpairs'*
Values: A string with |matchpairs| syntax.
Default: &matchpairs
Values: A string with |matchpairs| syntax. ~
Default: &matchpairs ~
Use this option to tell delimitMate which characters should be considered
matching pairs. Read |delimitMateAutoClose| for details.
@@ -198,8 +198,8 @@ e.g: >
------------------------------------------------------------------------------
*'delimitMate_quotes'*
*'b:delimitMate_quotes'*
Values: A string of characters separated by spaces.
Default: "\" ' `"
Values: A string of characters separated by spaces. ~
Default: "\" ' `" ~
Use this option to tell delimitMate which characters should be considered as
quotes. Read |delimitMateAutoClose| for details.
@@ -210,8 +210,8 @@ e.g.: >
------------------------------------------------------------------------------
*'delimitMate_visual_leader'*
*'b:delimitMate_visual_leader'*
Values: Any character.
Default: q
Values: Any character. ~
Default: q ~
The value of this option will be used to wrap the selection in visual mode
when followed by a delimiter. Read |delimitMateVisualWrap| for details.
@@ -222,8 +222,8 @@ e.g: >
------------------------------------------------------------------------------
*'delimitMate_expand_cr'*
*'b:delimitMate_expand_cr'*
Values: A key mapping.
Default: "\<CR>"
Values: A key mapping. ~
Default: "\<CR>" ~
The value of this option will be used to expand the car return character when
typed inside an empty delimiter pair. Read |delimitMateExpansion| for details.
@@ -234,8 +234,8 @@ e.g.: >
------------------------------------------------------------------------------
*'delimitMate_expand_space'*
*'b:delimitMate_expand_space'*
Values: A key mapping.
Default: "\<Space>"
Values: A key mapping. ~
Default: "\<Space>" ~
The value of this option will be used to expand the space character when typed
inside an empty delimiter pair. Read |delimitMateExpansion| for details.
@@ -245,8 +245,8 @@ e.g.: >
<
------------------------------------------------------------------------------
*'delimitMate_excluded_ft'*
Values: A string of file type names separated by single commas.
Defaul: Empty.
Values: A string of file type names separated by single commas. ~
Defaul: Empty. ~
This options turns delimitMate off for the listed file types, use this option
only if don't want any of the features it provides.
@@ -371,7 +371,17 @@ This script was inspired by the auto-completion of delimiters of TextMate.
==============================================================================
8. HISTORY *delimitMateHistory*
Version Date Release notes
Version Date Release notes ~
|---------|------------|-----------------------------------------------------|
1.5 2009-10-05 Fix: delimitMate should work correctly for files
passed as arguments to Vim. Thanks to Ben Beuchler
for helping to nail this bug.
|---------|------------|-----------------------------------------------------|
1.4 2009-09-27 Fix: delimitMate is now enabled on new buffers even
if they don't have set the file type option or were
opened directly from the terminal.
|---------|------------|-----------------------------------------------------|
1.3 2009-09-24 Now local options can be used along with autocmd
for specific file type configurations.
@@ -391,12 +401,15 @@ This script was inspired by the auto-completion of delimiters of TextMate.
the cursor would jump to the right.
- New buffer inside the current window wouldn't
have the mappings set.
|---------|------------|-----------------------------------------------------|
1.1 2009-08-25 Fixed an error that ocurred when mapleader wasn't
set and added support for GetLatestScripts
auto-detection.
|---------|------------|-----------------------------------------------------|
1.0 2009-08-23 Initial upload.
|---------|------------|-----------------------------------------------------|
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -1,6 +1,6 @@
" ============================================================================
" File: delimitMate.vim
" Version: 1.3
" Version: 1.5
" Description: This plugin tries to emulate the auto-completion of delimiters
" that TextMate provides.
" Maintainer: Israel Chauca F. <israelchauca@gmail.com>
@@ -343,7 +343,7 @@ endfunction "}}}1
function! s:ExtraMappings() "{{{1
" If pair is empty, delete both delimiters:
inoremap <buffer> <expr> <BS> <SID>WithinEmptyPair() ? "<Right><BS><BS>" : "\<BS>"
inoremap <buffer> <expr> <BS> <SID>WithinEmptyPair() ? "\<Right>\<BS>\<BS>" : "\<BS>"
" Expand return if inside an empty pair:
inoremap <buffer> <CR> <C-R>=<SID>ExpandReturn()<CR>
@@ -392,7 +392,7 @@ function! s:TestMappings() "{{{1
exec "normal A\<CR>Car return: " . s:quotes[i] . s:quotes[i] . "\<CR>|\<Esc>GGA\<CR>\<CR>"
endfor
endif
exec "normal \<Esc>"
exec "normal \<Esc>i"
endfunction "}}}1
function! s:SwitchAutoclose() "{{{1
@@ -406,6 +406,61 @@ function! s:SwitchAutoclose() "{{{1
DelimitMateReload
endfunction "}}}1
function! s:UnMap() " {{{
" No Autoclose Mappings:
for char in s:right_delims + s:quotes
if maparg(char,"i") =~? 'SkipDelim'
exec 'iunmap <buffer> ' . char
"echomsg 'iunmap <buffer> ' . char
endif
endfor
" Autoclose Mappings:
let s:i = 0
while s:i < len(s:matchpairs)
if maparg(s:left_delims[s:i],"i") =~? s:left_delims[s:i] . s:right_delims[s:i] . '<Left>'
exec 'iunmap <buffer> ' . s:left_delims[s:i]
"echomsg 'iunmap <buffer> ' . s:left_delims[s:i]
endif
let s:i += 1
endwhile
for char in s:quotes
if maparg(char, "i") =~? 'QuoteDelim'
exec 'iunmap <buffer> ' . char
"echomsg 'iunmap <buffer> ' . char
endif
endfor
for char in s:right_delims
if maparg(char, "i") =~? 'ClosePair'
exec 'iunmap <buffer> ' . char
"echomsg 'iunmap <buffer> ' . char
endif
endfor
" Visual Mappings:
for char in s:right_delims + s:left_delims + s:quotes
if maparg(s:visual_leader . char,"v") =~? 'IsBlock'
exec 'vunmap <buffer> ' . s:visual_leader . char
"echomsg 'vunmap <buffer> ' . s:visual_leader . char
endif
endfor
" Expansion Mappings:
if maparg('<BS>', "i") =~? 'WithinEmptyPair'
iunmap <buffer> <BS>
"echomsg "iunmap <buffer> <BS>"
endif
if maparg('<CR>',"i") =~? 'ExpandReturn'
iunmap <buffer> <CR>
"echomsg "iunmap <buffer> <CR>"
endif
if maparg('<Space>',"i") =~? 'ExpandSpace'
iunmap <buffer> <Space>
"echomsg "iunmap <buffer> <Space>"
endif
endfunction " }}}
function! s:TestMappingsDo() "{{{1
if !exists("g:delimitMate_testing")
call s:DelimitMateDo()
@@ -423,12 +478,17 @@ function! s:DelimitMateDo() "{{{1
if exists("g:delimitMate_excluded_ft")
for ft in split(g:delimitMate_excluded_ft,',')
if ft ==? &filetype
echomsg "Excluded"
if !exists("s:quotes")
return 1
endif
"echomsg "excluded"
call s:UnMap()
return 1
endif
endfor
endif
try
"echomsg "included"
let save_cpo = &cpo
set cpo&vim
call s:Init()
@@ -439,7 +499,7 @@ function! s:DelimitMateDo() "{{{1
endfunction "}}}1
" Do the real work: {{{1
"call s:DelimitMateDo()
call s:DelimitMateDo()
" Let me refresh without re-loading the buffer:
command! DelimitMateReload call s:DelimitMateDo()
@@ -447,8 +507,14 @@ command! DelimitMateReload call s:DelimitMateDo()
" Quick test:
command! DelimitMateTest call s:TestMappingsDo()
"autocmd BufNewFile,BufRead,BufEnter * if !exists("b:loaded_delimitMate") || &filetype !=? "mailapp" | call <SID>DelimitMateDo() | endif
autocmd VimEnter * autocmd FileType * if !exists("b:loaded_delimitMate") | call <SID>DelimitMateDo() | endif
" Run on file type events.
"autocmd VimEnter * autocmd FileType * call <SID>DelimitMateDo()
autocmd FileType * call <SID>DelimitMateDo()
" Run on new buffers.
autocmd BufNewFile,BufRead,BufEnter * if !exists("b:loaded_delimitMate") | call <SID>DelimitMateDo() | endif
"function! s:GetSynRegion () | echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') | endfunction
" GetLatestVimScripts: 2754 1 :AutoInstall: delimitMate.vim
" vim:foldmethod=marker:foldcolumn=2