mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-07 05:04:34 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75b4f3b520 | ||
|
|
3ce7f7ffcf |
@@ -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 *
|
REFERENCE MANUAL *
|
||||||
@@ -174,8 +174,8 @@ e.g.: >
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_autoclose'*
|
*'delimitMate_autoclose'*
|
||||||
*'b:delimitMate_autoclose'*
|
*'b:delimitMate_autoclose'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1. ~
|
||||||
Default: 1
|
Default: 1 ~
|
||||||
|
|
||||||
If this option is set to 0, delimitMate will not add a closing delimiter
|
If this option is set to 0, delimitMate will not add a closing delimiter
|
||||||
automagically. See |delimitMateAutoClose| for details.
|
automagically. See |delimitMateAutoClose| for details.
|
||||||
@@ -186,8 +186,8 @@ e.g.: >
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_matchpairs'*
|
*'delimitMate_matchpairs'*
|
||||||
*'b:delimitMate_matchpairs'*
|
*'b:delimitMate_matchpairs'*
|
||||||
Values: A string with |matchpairs| syntax.
|
Values: A string with |matchpairs| syntax. ~
|
||||||
Default: &matchpairs
|
Default: &matchpairs ~
|
||||||
|
|
||||||
Use this option to tell delimitMate which characters should be considered
|
Use this option to tell delimitMate which characters should be considered
|
||||||
matching pairs. Read |delimitMateAutoClose| for details.
|
matching pairs. Read |delimitMateAutoClose| for details.
|
||||||
@@ -198,8 +198,8 @@ e.g: >
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_quotes'*
|
*'delimitMate_quotes'*
|
||||||
*'b:delimitMate_quotes'*
|
*'b:delimitMate_quotes'*
|
||||||
Values: A string of characters separated by spaces.
|
Values: A string of characters separated by spaces. ~
|
||||||
Default: "\" ' `"
|
Default: "\" ' `" ~
|
||||||
|
|
||||||
Use this option to tell delimitMate which characters should be considered as
|
Use this option to tell delimitMate which characters should be considered as
|
||||||
quotes. Read |delimitMateAutoClose| for details.
|
quotes. Read |delimitMateAutoClose| for details.
|
||||||
@@ -210,8 +210,8 @@ e.g.: >
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_visual_leader'*
|
*'delimitMate_visual_leader'*
|
||||||
*'b:delimitMate_visual_leader'*
|
*'b:delimitMate_visual_leader'*
|
||||||
Values: Any character.
|
Values: Any character. ~
|
||||||
Default: q
|
Default: q ~
|
||||||
|
|
||||||
The value of this option will be used to wrap the selection in visual mode
|
The value of this option will be used to wrap the selection in visual mode
|
||||||
when followed by a delimiter. Read |delimitMateVisualWrap| for details.
|
when followed by a delimiter. Read |delimitMateVisualWrap| for details.
|
||||||
@@ -222,8 +222,8 @@ e.g: >
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_expand_cr'*
|
*'delimitMate_expand_cr'*
|
||||||
*'b:delimitMate_expand_cr'*
|
*'b:delimitMate_expand_cr'*
|
||||||
Values: A key mapping.
|
Values: A key mapping. ~
|
||||||
Default: "\<CR>"
|
Default: "\<CR>" ~
|
||||||
|
|
||||||
The value of this option will be used to expand the car return character when
|
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.
|
typed inside an empty delimiter pair. Read |delimitMateExpansion| for details.
|
||||||
@@ -234,8 +234,8 @@ e.g.: >
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_expand_space'*
|
*'delimitMate_expand_space'*
|
||||||
*'b:delimitMate_expand_space'*
|
*'b:delimitMate_expand_space'*
|
||||||
Values: A key mapping.
|
Values: A key mapping. ~
|
||||||
Default: "\<Space>"
|
Default: "\<Space>" ~
|
||||||
|
|
||||||
The value of this option will be used to expand the space character when typed
|
The value of this option will be used to expand the space character when typed
|
||||||
inside an empty delimiter pair. Read |delimitMateExpansion| for details.
|
inside an empty delimiter pair. Read |delimitMateExpansion| for details.
|
||||||
@@ -245,8 +245,8 @@ e.g.: >
|
|||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_excluded_ft'*
|
*'delimitMate_excluded_ft'*
|
||||||
Values: A string of file type names separated by single commas.
|
Values: A string of file type names separated by single commas. ~
|
||||||
Defaul: Empty.
|
Defaul: Empty. ~
|
||||||
|
|
||||||
This options turns delimitMate off for the listed file types, use this option
|
This options turns delimitMate off for the listed file types, use this option
|
||||||
only if don't want any of the features it provides.
|
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*
|
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
|
1.3 2009-09-24 Now local options can be used along with autocmd
|
||||||
for specific file type configurations.
|
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.
|
the cursor would jump to the right.
|
||||||
- New buffer inside the current window wouldn't
|
- New buffer inside the current window wouldn't
|
||||||
have the mappings set.
|
have the mappings set.
|
||||||
|
|
||||||
|---------|------------|-----------------------------------------------------|
|
|---------|------------|-----------------------------------------------------|
|
||||||
1.1 2009-08-25 Fixed an error that ocurred when mapleader wasn't
|
1.1 2009-08-25 Fixed an error that ocurred when mapleader wasn't
|
||||||
set and added support for GetLatestScripts
|
set and added support for GetLatestScripts
|
||||||
auto-detection.
|
auto-detection.
|
||||||
|
|
||||||
|---------|------------|-----------------------------------------------------|
|
|---------|------------|-----------------------------------------------------|
|
||||||
1.0 2009-08-23 Initial upload.
|
1.0 2009-08-23 Initial upload.
|
||||||
|
|
||||||
|---------|------------|-----------------------------------------------------|
|
|---------|------------|-----------------------------------------------------|
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
vim:tw=78:ts=8:ft=help:norl:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
" ============================================================================
|
" ============================================================================
|
||||||
" File: delimitMate.vim
|
" File: delimitMate.vim
|
||||||
" Version: 1.3
|
" Version: 1.5
|
||||||
" Description: This plugin tries to emulate the auto-completion of delimiters
|
" Description: This plugin tries to emulate the auto-completion of delimiters
|
||||||
" that TextMate provides.
|
" that TextMate provides.
|
||||||
" Maintainer: Israel Chauca F. <israelchauca@gmail.com>
|
" Maintainer: Israel Chauca F. <israelchauca@gmail.com>
|
||||||
@@ -343,7 +343,7 @@ endfunction "}}}1
|
|||||||
|
|
||||||
function! s:ExtraMappings() "{{{1
|
function! s:ExtraMappings() "{{{1
|
||||||
" If pair is empty, delete both delimiters:
|
" 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:
|
" Expand return if inside an empty pair:
|
||||||
inoremap <buffer> <CR> <C-R>=<SID>ExpandReturn()<CR>
|
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>"
|
exec "normal A\<CR>Car return: " . s:quotes[i] . s:quotes[i] . "\<CR>|\<Esc>GGA\<CR>\<CR>"
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
exec "normal \<Esc>"
|
exec "normal \<Esc>i"
|
||||||
endfunction "}}}1
|
endfunction "}}}1
|
||||||
|
|
||||||
function! s:SwitchAutoclose() "{{{1
|
function! s:SwitchAutoclose() "{{{1
|
||||||
@@ -406,6 +406,61 @@ function! s:SwitchAutoclose() "{{{1
|
|||||||
DelimitMateReload
|
DelimitMateReload
|
||||||
endfunction "}}}1
|
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
|
function! s:TestMappingsDo() "{{{1
|
||||||
if !exists("g:delimitMate_testing")
|
if !exists("g:delimitMate_testing")
|
||||||
call s:DelimitMateDo()
|
call s:DelimitMateDo()
|
||||||
@@ -423,12 +478,17 @@ function! s:DelimitMateDo() "{{{1
|
|||||||
if exists("g:delimitMate_excluded_ft")
|
if exists("g:delimitMate_excluded_ft")
|
||||||
for ft in split(g:delimitMate_excluded_ft,',')
|
for ft in split(g:delimitMate_excluded_ft,',')
|
||||||
if ft ==? &filetype
|
if ft ==? &filetype
|
||||||
echomsg "Excluded"
|
if !exists("s:quotes")
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
"echomsg "excluded"
|
||||||
|
call s:UnMap()
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
try
|
try
|
||||||
|
"echomsg "included"
|
||||||
let save_cpo = &cpo
|
let save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
call s:Init()
|
call s:Init()
|
||||||
@@ -439,7 +499,7 @@ function! s:DelimitMateDo() "{{{1
|
|||||||
endfunction "}}}1
|
endfunction "}}}1
|
||||||
|
|
||||||
" Do the real work: {{{1
|
" Do the real work: {{{1
|
||||||
"call s:DelimitMateDo()
|
call s:DelimitMateDo()
|
||||||
|
|
||||||
" Let me refresh without re-loading the buffer:
|
" Let me refresh without re-loading the buffer:
|
||||||
command! DelimitMateReload call s:DelimitMateDo()
|
command! DelimitMateReload call s:DelimitMateDo()
|
||||||
@@ -447,8 +507,14 @@ command! DelimitMateReload call s:DelimitMateDo()
|
|||||||
" Quick test:
|
" Quick test:
|
||||||
command! DelimitMateTest call s:TestMappingsDo()
|
command! DelimitMateTest call s:TestMappingsDo()
|
||||||
|
|
||||||
"autocmd BufNewFile,BufRead,BufEnter * if !exists("b:loaded_delimitMate") || &filetype !=? "mailapp" | call <SID>DelimitMateDo() | endif
|
" Run on file type events.
|
||||||
autocmd VimEnter * autocmd FileType * if !exists("b:loaded_delimitMate") | call <SID>DelimitMateDo() | endif
|
"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
|
" GetLatestVimScripts: 2754 1 :AutoInstall: delimitMate.vim
|
||||||
" vim:foldmethod=marker:foldcolumn=2
|
" vim:foldmethod=marker:foldcolumn=2
|
||||||
|
|||||||
Reference in New Issue
Block a user