mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-07 21:24:51 +08:00
*** 1.0 First Release ***
- Last changes to documentation (for now). - Now the presence of delimitMate_testing will let me work better. - Changed some variables from global to local. - Changed how visual wrap finish: * If left delimiter is used then finish in normal mode. * If right delimiter is used then finish in insert mode.
This commit is contained in:
@@ -16,21 +16,29 @@
|
|||||||
3. Customization___________________________|delimitMateOptions|
|
3. Customization___________________________|delimitMateOptions|
|
||||||
3.1 Option summary_____________________|delimitMateOptionSummary|
|
3.1 Option summary_____________________|delimitMateOptionSummary|
|
||||||
3.2 Options details____________________|delimitMateOptionDetails|
|
3.2 Options details____________________|delimitMateOptionDetails|
|
||||||
4. Public command__________________________|delimitMatePublicCommand|
|
4. Public commands_________________________|delimitMatePublicCommands|
|
||||||
5. TODO list_______________________________|delimitMateTodo|
|
5. TODO list_______________________________|delimitMateTodo|
|
||||||
6. The Maintainer__________________________|delimitMateMaintainer|
|
6. Maintainer______________________________|delimitMateMaintainer|
|
||||||
7. Credits_________________________________|delimitMateCredits|
|
7. Credits_________________________________|delimitMateCredits|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
1.- INTRODUCTION *delimitMate*
|
1.- INTRODUCTION *delimitMate*
|
||||||
|
|
||||||
What is this "delimitMate"?
|
The delimitMate plugin tries to provide some not so dumb help in the work with
|
||||||
|
delimiters (brackets, quotes, etc.), with some optional auto-completions and
|
||||||
|
expansions.
|
||||||
|
|
||||||
The delimitMate plugin tries to emulate the auto-completion of delimiters that
|
When automatic closing is enabled, if an opening delimiter is inserted
|
||||||
TextMate provides. The characters used as delimiters can be easily modified,
|
delimitMate inserts the closing pair and places the cursor between them. When
|
||||||
this allows great flexibility; for example, one set can be used for Tcl and a
|
automatic closing is disabled, no closing delimiters is inserted by
|
||||||
different one for HTML.
|
delimitMate, but if a pair of delimiters is typed, the cursor is placed in the
|
||||||
|
middle. Also, to get out of a pair of delimiters just type the right delimiter
|
||||||
|
and the cursor will jump to the right.
|
||||||
|
|
||||||
|
If the cursor is inside an empty pair of delimiters <Space> and <CR> can be
|
||||||
|
expanded to follow your coding style, you just need to define a couple of
|
||||||
|
options with the desired mappings for them.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
2. FUNCTIONALITY PROVIDED *delimitMateFunctionality*
|
2. FUNCTIONALITY PROVIDED *delimitMateFunctionality*
|
||||||
@@ -43,13 +51,13 @@ inserts the closing delimiter and places the cursor between the pair. With
|
|||||||
automatic closing disabled, no closing delimiters is inserted by delimitMate,
|
automatic closing disabled, no closing delimiters is inserted by delimitMate,
|
||||||
but when a pair of delimiters is typed, the cursor is placed in the middle.
|
but when a pair of delimiters is typed, the cursor is placed in the middle.
|
||||||
|
|
||||||
When the cursor is inside an empty pair or located next to the left ofo a
|
When the cursor is inside an empty pair or located next to the left of a
|
||||||
closing delimiter, the cursor is placed outside the pair to the right of the
|
closing delimiter, the cursor is placed outside the pair to the right of the
|
||||||
closing delimiter.
|
closing delimiter.
|
||||||
|
|
||||||
Unless |delimitMate_matchpairs| is set, this script uses the values in
|
Unless |'b:delimitMate_matchpairs'| and |'b:delimitMate_quotes'|is set, this
|
||||||
'&matchpirs' to identify the pairs, and the default value for quotes is
|
script uses the values in '&matchpirs' to identify the pairs, and "\" ' ` "
|
||||||
"\" ' ` ", which can also be modified.
|
for quotes respectively.
|
||||||
|
|
||||||
The following table shows the behaviour, this applies to quotes too (the final
|
The following table shows the behaviour, this applies to quotes too (the final
|
||||||
position of the cursor is represented by a "|"):
|
position of the cursor is represented by a "|"):
|
||||||
@@ -72,9 +80,9 @@ Without auto-close: >
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
2.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion*
|
2.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion*
|
||||||
|
|
||||||
When the cursor is inside an empty pair of delimiters, space and car return
|
When the cursor is inside an empty pair of delimiters, <Space> and <CR> can be
|
||||||
can be expanded to follow your coding style using |'delimitMate_expand_space'|
|
expanded to follow your coding style with |'b:delimitMate_expand_space'| and
|
||||||
and |'delimitMate_expand_return'|. e.g. (cursor represented by a "|"):
|
|'b:delimitMate_expand_cr'|. e.g. (cursor represented by a "|"):
|
||||||
|
|
||||||
Expand <Space> to: >
|
Expand <Space> to: >
|
||||||
|
|
||||||
@@ -108,8 +116,9 @@ e.g.: >
|
|||||||
|
|
||||||
When visual mode is active this script allows for the selection to be enclosed
|
When visual mode is active this script allows for the selection to be enclosed
|
||||||
with delimiters. But, since brackets have special meaning in visual mode, a
|
with delimiters. But, since brackets have special meaning in visual mode, a
|
||||||
leader ("q" by default) should precede the delimiter. This feature doesn't
|
leader (the value of 'mapleader' by default) should precede the delimiter.
|
||||||
currently work on blockwise visual mode, any sugestions are welcome.
|
This feature doesn't currently work on blockwise visual mode, any suggestions
|
||||||
|
will be welcome.
|
||||||
|
|
||||||
e.g. (selection represented between square brackets): >
|
e.g. (selection represented between square brackets): >
|
||||||
|
|
||||||
@@ -128,21 +137,21 @@ in your vimrc file.
|
|||||||
|
|
||||||
|'loaded_delimitMate'| Turns off the script.
|
|'loaded_delimitMate'| Turns off the script.
|
||||||
|
|
||||||
|'delimitMate_autoclose'| Tells delimitMate wether to automagically
|
|'delimitMate_autoclose'| Tells delimitMate whether to automagically
|
||||||
insert the closing delimiter.
|
insert the closing delimiter.
|
||||||
|
|
||||||
|'delimitMate_matchpairs'| Tells delimitMate which characters are
|
|'b:delimitMate_matchpairs'| Tells delimitMate which characters are
|
||||||
matching pairs.
|
matching pairs.
|
||||||
|
|
||||||
|'delimitMate_quotes'| Tells delimitMate which quotes should be
|
|'b:delimitMate_quotes'| Tells delimitMate which quotes should be
|
||||||
used.
|
used.
|
||||||
|
|
||||||
|'delimitMate_visual_leader'| Sets the leader to be used in visual mode.
|
|'delimitMate_visual_leader'| Sets the leader to be used in visual mode.
|
||||||
|
|
||||||
|'delimitMate_expand_return'| Sets the expansion for <CR> inside an empty
|
|'b:delimitMate_expand_cr'| Sets the expansion for <CR> inside an empty
|
||||||
pair of matching delimiters or quotes.
|
pair of matching delimiters or quotes.
|
||||||
|
|
||||||
|'delimitMate_expand_space'| Sets the expansion for <Space> inside an
|
|'b:delimitMate_expand_space'| Sets the expansion for <Space> inside an
|
||||||
empty pair of matching delimiters or quotes.
|
empty pair of matching delimiters or quotes.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -160,26 +169,29 @@ 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. e.g.: >
|
automagically. See |delimitMateAutoClose| for details.
|
||||||
|
e.g.: >
|
||||||
let delimitMate_autoclose = 0
|
let delimitMate_autoclose = 0
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'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. e.g: >
|
matching pairs. Read |delimitMateAutoClose| for details.
|
||||||
|
e.g: >
|
||||||
let delimitMate = "(:),[:],{:},<:>"
|
let delimitMate = "(:),[:],{:},<:>"
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'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. e.g.: >
|
quotes. Read |delimitMateAutoClose| for details.
|
||||||
let delimitMate_quotes = "\" ' ` *"
|
e.g.: >
|
||||||
|
let b:delimitMate_quotes = "\" ' ` *"
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_visual_leader'*
|
*'delimitMate_visual_leader'*
|
||||||
@@ -192,28 +204,28 @@ e.g: >
|
|||||||
let delimitMate_visual_leader = "f"
|
let delimitMate_visual_leader = "f"
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'delimitMate_expand_return'*
|
*'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.
|
||||||
e.g.: >
|
e.g.: >
|
||||||
let delimitMate_expand_return = "\<CR>\<CR>\<Up>"
|
let b:delimitMate_expand_cr = "\<CR>\<CR>\<Up>"
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'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.
|
||||||
e.g.: >
|
e.g.: >
|
||||||
let delimitMate_expand_space = "\<Space>\<Space>\<Left>"
|
let b:delimitMate_expand_space = "\<Space>\<Space>\<Left>"
|
||||||
<
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
4. PUBLIC COMMANDS *delimitMatePublicCommand*
|
4. PUBLIC COMMANDS *delimitMatePublicCommands*
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
:DelimitMateReload *:DelimitMateReload*
|
:DelimitMateReload *:DelimitMateReload*
|
||||||
@@ -295,14 +307,16 @@ represented by an "|": >
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
5. TODO LIST *delimitMateTodo*
|
5. TODO LIST *delimitMateTodo*
|
||||||
|
|
||||||
- Automatic file type set-up.
|
- Automatic set-up by file type.
|
||||||
- Make visual wrapping work on blockwise visual mode.
|
- Make visual wrapping work on blockwise visual mode.
|
||||||
|
- Limit behaviour by region.
|
||||||
|
- Fix some problems wrapping a single empty line in visual mode.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
6. THE MAINTAINER *delimitMateMaintainer*
|
6. MAINTAINER *delimitMateMaintainer*
|
||||||
|
|
||||||
Hi there! My name is Israel Chauca F. and I can be reached at:
|
Hi there! My name is Israel Chauca F. and I can be reached at:
|
||||||
israelchauca@gmail.com
|
mailto:israelchauca@gmail.com
|
||||||
|
|
||||||
Feel free to send me any suggestions and/or comments about this plugin, I'll
|
Feel free to send me any suggestions and/or comments about this plugin, I'll
|
||||||
be very pleased to read them.
|
be very pleased to read them.
|
||||||
@@ -321,8 +335,9 @@ from the following sources:
|
|||||||
From the comments on the previous blog post and from:
|
From the comments on the previous blog post and from:
|
||||||
http://gist.github.com/144619
|
http://gist.github.com/144619
|
||||||
|
|
||||||
- Orestis Markou
|
- Vim Scripts:
|
||||||
Script: simple pairs:
|
http://www.vim.org/scripts
|
||||||
http://www.vim.org/scripts/script.php?script_id=2339
|
|
||||||
|
This script was inspired by the auto-completion of delimiters of TextMate.
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
vim:tw=78:ts=8:ft=help:norl:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
" ============================================================================
|
" ============================================================================
|
||||||
" File: delimitMate.vim
|
" File: delimitMate.vim
|
||||||
|
" Version: 1.0
|
||||||
" 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>
|
||||||
@@ -13,12 +14,11 @@
|
|||||||
" From the comments on the previous blog post and from:
|
" From the comments on the previous blog post and from:
|
||||||
" http://gist.github.com/144619
|
" http://gist.github.com/144619
|
||||||
"
|
"
|
||||||
" - Orestis Markou
|
" - Vim Scripts:
|
||||||
" Script 'simple pairs':
|
" http://www.vim.org/scripts/
|
||||||
" http://www.vim.org/scripts/script.php?script_id=2339
|
|
||||||
|
|
||||||
if exists("g:loaded_delimitMate") "{{{1
|
if exists("g:loaded_delimitMate") && !exists("g:delimitMate_testing") "{{{1
|
||||||
" Don't define the functions if they already exist: just do the work:
|
" Don't define the functions if they already exist: just do the work (unless we are testing):
|
||||||
call s:DelimitMateDo()
|
call s:DelimitMateDo()
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
@@ -38,60 +38,58 @@ function! s:Init() "{{{1
|
|||||||
let s:autoclose = g:delimitMate_autoclose
|
let s:autoclose = g:delimitMate_autoclose
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("g:delimitMate_matchpairs")
|
if !exists("b:delimitMate_matchpairs")
|
||||||
if s:ValidMatchpairs(&matchpairs) == 1
|
if s:ValidMatchpairs(&matchpairs) == 1
|
||||||
let s:matchpairs_temp = &matchpairs
|
let s:matchpairs_temp = &matchpairs
|
||||||
else
|
else
|
||||||
echoerr "There seems to be a problem with 'matchpairs', read ':help matchpairs' and fix it or notify the maintainer of this script if this is a bug."
|
echoerr "delimitMate: There seems to be a problem with 'matchpairs', read ':help matchpairs' and fix it or notify the maintainer of this script if this is a bug."
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if s:ValidMatchpairs(g:delimitMate_matchpairs) || g:delimitMate_matchpairs == ""
|
if s:ValidMatchpairs(b:delimitMate_matchpairs) || b:delimitMate_matchpairs == ""
|
||||||
let s:matchpairs_temp = g:delimitMate_matchpairs
|
let s:matchpairs_temp = b:delimitMate_matchpairs
|
||||||
else
|
else
|
||||||
echoerr "Invalid format in 'g:delimitMate_matchpairs', falling back to matchpairs."
|
echoerr "delimitMate: Invalid format in 'b:delimitMate_matchpairs', falling back to matchpairs. Fix the error and use the command :DelimitMateReload to try again."
|
||||||
echoerr "Fix the error and use the command :DelimitMateReload to try again."
|
|
||||||
if s:ValidMatchpairs(&matchpairs) == 1
|
if s:ValidMatchpairs(&matchpairs) == 1
|
||||||
let s:matchpairs_temp = &matchpairs
|
let s:matchpairs_temp = &matchpairs
|
||||||
else
|
else
|
||||||
echoerr "There seems to be a problem with 'matchpairs', read ':help matchpairs' and fix it or notify the maintainer of this script if this is a bug."
|
echoerr "delimitMate: There seems to be a problem with 'matchpairs', read ':help matchpairs' and fix it or notify the maintainer of this script if this is a bug."
|
||||||
let s:matchpairs_temp = ""
|
let s:matchpairs_temp = ""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists("g:delimitMate_quotes")
|
if exists("b:delimitMate_quotes")
|
||||||
if g:delimitMate_quotes =~ '^\(\S\)\(\s\S\)*$' || g:delimitMate_quotes == ""
|
if b:delimitMate_quotes =~ '^\(\S\)\(\s\S\)*$' || b:delimitMate_quotes == ""
|
||||||
let s:quotes = split(g:delimitMate_quotes)
|
let s:quotes = split(b:delimitMate_quotes)
|
||||||
else
|
else
|
||||||
let s:quotes = split("\" ' `")
|
let s:quotes = split("\" ' `")
|
||||||
echoerr "delimitMate: There is a problem with the format of 'delimitMate_quotes', it should be a string of single characters separated by spaces."
|
echoerr "delimitMate: There is a problem with the format of 'b:delimitMate_quotes', it should be a string of single characters separated by spaces. Falling back to default values."
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let s:quotes = split("\" ' `")
|
let s:quotes = split("\" ' `")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("g:delimitMate_visual_leader")
|
if !exists("g:delimitMate_visual_leader")
|
||||||
let s:visual_leader = "q"
|
let s:visual_leader = g:mapleader
|
||||||
else
|
else
|
||||||
let s:visual_leader = g:delimitMate_visual_leader
|
let s:visual_leader = g:delimitMate_visual_leader
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("g:delimitMate_expand_space")
|
if !exists("b:delimitMate_expand_space")
|
||||||
let s:expand_space = "\<Space>"
|
let s:expand_space = "\<Space>"
|
||||||
elseif g:delimitMate_expand_space == ""
|
elseif b:delimitMate_expand_space == ""
|
||||||
let s:expand_space = "\<Space>"
|
let s:expand_space = "\<Space>"
|
||||||
else
|
else
|
||||||
let s:expand_space = g:delimitMate_expand_space
|
let s:expand_space = b:delimitMate_expand_space
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("g:delimitMate_expand_return")
|
if !exists("b:delimitMate_expand_cr")
|
||||||
let s:expand_return = "\<CR>"
|
let s:expand_return = "\<CR>"
|
||||||
elseif g:delimitMate_expand_return == ""
|
elseif b:delimitMate_expand_cr == ""
|
||||||
let s:expand_return = "\<CR>"
|
let s:expand_return = "\<CR>"
|
||||||
else
|
else
|
||||||
let s:expand_return = g:delimitMate_expand_return
|
let s:expand_return = b:delimitMate_expand_cr
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:matchpairs = split(s:matchpairs_temp, ',')
|
let s:matchpairs = split(s:matchpairs_temp, ',')
|
||||||
@@ -192,10 +190,7 @@ function! s:NoAutoClose() "{{{1
|
|||||||
exec 'imap <buffer> ' . delim . ' <C-R>=<SID>SkipDelim("' . escape(delim,'"') . '")<CR>'
|
exec 'imap <buffer> ' . delim . ' <C-R>=<SID>SkipDelim("' . escape(delim,'"') . '")<CR>'
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" Wrap the selection with delimiters, but do nothing if blockwise visual
|
" Wrap the selection with delimiters, but do nothing if blockwise visual mode is active:
|
||||||
" mode is active:
|
|
||||||
""let s:i = 0
|
|
||||||
""while s:i < len(s:matchpairs)
|
|
||||||
for i in range(len(s:matchpairs))
|
for i in range(len(s:matchpairs))
|
||||||
" Map left delimiter:
|
" Map left delimiter:
|
||||||
" vmap <buffer> <expr> q( visualmode() == "<C-V>" ? <SID>MapMsg(VMapMsg) : "s(\<C-R>\")\<Esc>"
|
" vmap <buffer> <expr> q( visualmode() == "<C-V>" ? <SID>MapMsg(VMapMsg) : "s(\<C-R>\")\<Esc>"
|
||||||
@@ -203,7 +198,7 @@ function! s:NoAutoClose() "{{{1
|
|||||||
|
|
||||||
" Map right delimiter:
|
" Map right delimiter:
|
||||||
" vmap <buffer> <expr> q) visualmode() == "<C-V>" ? <SID>MapMsg(VMapMsg) : "s(\<C-R>\")\<Esc>"
|
" vmap <buffer> <expr> q) visualmode() == "<C-V>" ? <SID>MapMsg(VMapMsg) : "s(\<C-R>\")\<Esc>"
|
||||||
exec 'vmap <buffer> <expr> ' . s:visual_leader . s:right_delims[i] . ' visualmode() == "<C-V>" ? <SID>MapMsg("' . s:VMapMsg . '") : "s' . s:left_delims[i] . '\<C-R>\"' . s:right_delims[i] . '\<Esc>"'
|
exec 'vmap <buffer> <expr> ' . s:visual_leader . s:right_delims[i] . ' visualmode() == "<C-V>" ? <SID>MapMsg("' . s:VMapMsg . '") : "s' . s:left_delims[i] . '\<C-R>\"' . s:right_delims[i] . '"'
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
for quote in s:quotes
|
for quote in s:quotes
|
||||||
@@ -221,8 +216,7 @@ function! s:AutoClose() "{{{1
|
|||||||
let s:i += 1
|
let s:i += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Add matching quote and jump to the midle, or exit if inside a pair of
|
" Add matching quote and jump to the midle, or exit if inside a pair of matching quotes:
|
||||||
" matching quotes:
|
|
||||||
" imap <buffer> " <C-R>=<SID>QuoteDelim("\"")<CR>
|
" imap <buffer> " <C-R>=<SID>QuoteDelim("\"")<CR>
|
||||||
for delim in s:quotes
|
for delim in s:quotes
|
||||||
exec 'imap <buffer> ' . delim . ' <C-R>=<SID>QuoteDelim("\' . delim . '")<CR>'
|
exec 'imap <buffer> ' . delim . ' <C-R>=<SID>QuoteDelim("\' . delim . '")<CR>'
|
||||||
@@ -234,8 +228,7 @@ function! s:AutoClose() "{{{1
|
|||||||
exec 'imap <buffer> ' . delim . ' <C-R>=<SID>ClosePair("\' . delim . '")<CR>'
|
exec 'imap <buffer> ' . delim . ' <C-R>=<SID>ClosePair("\' . delim . '")<CR>'
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" Wrap the selection with matching pairs, but do nothing if blockwise visual
|
" Wrap the selection with matching pairs, but do nothing if blockwise visual mode is active:
|
||||||
" mode is active:
|
|
||||||
let s:i = 0
|
let s:i = 0
|
||||||
while s:i < len(s:matchpairs)
|
while s:i < len(s:matchpairs)
|
||||||
" Map left delimiter:
|
" Map left delimiter:
|
||||||
@@ -244,12 +237,11 @@ function! s:AutoClose() "{{{1
|
|||||||
|
|
||||||
" Map right delimiter:
|
" Map right delimiter:
|
||||||
" vmap <buffer> <expr> q) visualmode() == "<C-V>" ? <SID>MapMsg("Message") : "s(\<C-R>\""\<Esc>"
|
" vmap <buffer> <expr> q) visualmode() == "<C-V>" ? <SID>MapMsg("Message") : "s(\<C-R>\""\<Esc>"
|
||||||
exec 'vmap <buffer> <expr> ' . s:visual_leader . s:right_delims[s:i] . ' visualmode() == "<C-V>" ? <SID>MapMsg("' . s:VMapMsg . '") : "s' . s:left_delims[s:i] . '\<C-R>\"\<Esc>"'
|
exec 'vmap <buffer> <expr> ' . s:visual_leader . s:right_delims[s:i] . ' visualmode() == "<C-V>" ? <SID>MapMsg("' . s:VMapMsg . '") : "s' . s:left_delims[s:i] . '\<C-R>\""'
|
||||||
let s:i += 1
|
let s:i += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Wrap the selection with matching quotes, but do nothing if blockwise visual
|
" Wrap the selection with matching quotes, but do nothing if blockwise visual mode is active:
|
||||||
" mode is active:
|
|
||||||
for quote in s:quotes
|
for quote in s:quotes
|
||||||
" vmap <buffer> <expr> q' visualmode() == "<C-V>" ? <SID>MapMsg("Message") : "s'\<C-R>\"'\<Esc>"
|
" vmap <buffer> <expr> q' visualmode() == "<C-V>" ? <SID>MapMsg("Message") : "s'\<C-R>\"'\<Esc>"
|
||||||
exec 'vmap <buffer> <expr> ' . s:visual_leader . quote . ' visualmode() == "<C-V>" ? <SID>MapMsg("' . s:VMapMsg . '") : "s' . escape(quote,'"') .'\<C-R>\"' . escape(quote,'"') . '\<Esc>"'
|
exec 'vmap <buffer> <expr> ' . s:visual_leader . quote . ' visualmode() == "<C-V>" ? <SID>MapMsg("' . s:VMapMsg . '") : "s' . escape(quote,'"') .'\<C-R>\"' . escape(quote,'"') . '\<Esc>"'
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
To install this script just copy delimitMate.vim to your Vim's plugin folder (e.g.: $HOME/.vim/plugin) and delimitMate.txt to the respective 'doc' folder, then run 'helptags /path/to/.vim/doc'. After that you can read ':help delimitMate' for more info.
|
|
||||||
Reference in New Issue
Block a user