Skip to content
Browse files

=== 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.
  • Loading branch information...
1 parent 11b0827 commit 3ce7f7ffcf625373257d6fcad4ae43b85980779b @Raimondi committed Sep 27, 2009
Showing with 65 additions and 22 deletions.
  1. +19 −15 delimitMate.txt
  2. +46 −7 delimitMate.vim
View
34 delimitMate.txt
@@ -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,11 @@ This script was inspired by the auto-completion of delimiters of TextMate.
==============================================================================
8. HISTORY *delimitMateHistory*
- Version Date Release notes
+ Version Date Release notes ~
+|---------|------------|-----------------------------------------------------|
+ 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.
View
53 delimitMate.vim
@@ -1,6 +1,6 @@
" ============================================================================
" File: delimitMate.vim
-" Version: 1.3
+" Version: 1.4
" Description: This plugin tries to emulate the auto-completion of delimiters
" that TextMate provides.
" Maintainer: Israel Chauca F. <israelchauca@gmail.com>
@@ -108,7 +108,7 @@ function! s:Init() "{{{1
elseif exists("b:delimitMate_visual_leader")
let s:visual_leader = b:delimitMate_visual_leader
else
- let s:visual_leader = g:delimitMate_visual_leader
+ let s:visual_leader = g:delimitMate_visual_leader
endif " }}}
if !exists("b:delimitMate_expand_space") && !exists("g:delimitMate_expand_space") " {{{
@@ -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,42 @@ function! s:SwitchAutoclose() "{{{1
DelimitMateReload
endfunction "}}}1
+function! s:UnMap() " {{{
+
+ for char in s:right_delims + s:quotes
+ if maparg(char,"i") =~ 'SkipDelim'
+ exec 'iunmap <buffer> ' . char
+ "echomsg 'iunmap <buffer> ' . char
+ endif
+ endfor
+ 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
+ let s:i = 0
+ while s:i < len(s:matchpairs)
+ if maparg(char,"i") =~ s:left_delims[s:i] . s:right_delims[s:i] . '<Left>'
+ exec 'iunmap <buffer> ' . char
+ "echomsg 'iunmap <buffer> ' . char
+ 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")
+ exec 'iunmap <buffer> ' . char
+ "echomsg 'iunmap <buffer> ' . char
+ endif
+ endfor
+endfunction " }}}
+
function! s:TestMappingsDo() "{{{1
if !exists("g:delimitMate_testing")
call s:DelimitMateDo()
@@ -423,7 +459,7 @@ function! s:DelimitMateDo() "{{{1
if exists("g:delimitMate_excluded_ft")
for ft in split(g:delimitMate_excluded_ft,',')
if ft ==? &filetype
- echomsg "Excluded"
+ call s:UnMap()
return 1
endif
endfor
@@ -439,16 +475,19 @@ 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()
" 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()
+
+" Run on new buffers.
+autocmd BufNewFile,BufRead,BufEnter * if !exists("b:loaded_delimitMate") | call <SID>DelimitMateDo() | endif
" GetLatestVimScripts: 2754 1 :AutoInstall: delimitMate.vim
" vim:foldmethod=marker:foldcolumn=2

0 comments on commit 3ce7f7f

Please sign in to comment.
Something went wrong with that request. Please try again.