Update README
This commit is contained in:
parent
1ff8be79d3
commit
bec90a4076
92
README.md
92
README.md
@ -296,86 +296,86 @@ Multibyte Pairs
|
|||||||
|
|
||||||
* Function AutoPairsDefine(addPairs:dict[, removeOpenPairList:list])
|
* Function AutoPairsDefine(addPairs:dict[, removeOpenPairList:list])
|
||||||
|
|
||||||
add or delete pairs base on g:AutoPairs
|
add or delete pairs base on g:AutoPairs
|
||||||
|
|
||||||
eg:
|
eg:
|
||||||
au FileType html let b:AutoPairs = AutoPairsDefine({'<!--' : '-->'}, ['{'])
|
au FileType html let b:AutoPairs = AutoPairsDefine({'<!--' : '-->'}, ['{'])
|
||||||
add <!-- --> pair and remove '{' for html file
|
add <!-- --> pair and remove '{' for html file
|
||||||
|
|
||||||
the pair implict start with \V, so if want to match start of line ^ should be write in \^ vim comment {'\^"': ''}
|
the pair implict start with \V, so if want to match start of line ^ should be write in \^ vim comment {'\^"': ''}
|
||||||
|
|
||||||
* General usage
|
* General usage
|
||||||
|
|
||||||
au FileType php let b:AutoPairs = AutoPairsDefine({'<?' : '?>', '<?php': '?>'})
|
au FileType php let b:AutoPairs = AutoPairsDefine({'<?' : '?>', '<?php': '?>'})
|
||||||
|
|
||||||
the first key of closed pair ? will be mapped
|
the first key of closed pair ? will be mapped
|
||||||
|
|
||||||
pairs: '<?' : '?>', '<?php': '?>'
|
pairs: '<?' : '?>', '<?php': '?>'
|
||||||
input: <?
|
input: <?
|
||||||
output: <?|?>
|
output: <?|?>
|
||||||
|
|
||||||
input: <?php
|
input: <?php
|
||||||
output: <?php|?>
|
output: <?php|?>
|
||||||
|
|
||||||
input: he<?php|?> (press <BS> at|)
|
input: he<?php|?> (press <BS> at|)
|
||||||
output: he|
|
output: he|
|
||||||
|
|
||||||
input: <?php|?> (press ? at|)
|
input: <?php|?> (press ? at|)
|
||||||
output: <?php?>|
|
output: <?php?>|
|
||||||
|
|
||||||
pair: '[[':']]'
|
pair: '[[':']]'
|
||||||
input: [[|]] (press <BR>)
|
input: [[|]] (press <BR>)
|
||||||
output: | ([[ and ]] will be deleted the [['s priority is higher than [ for it's longer)
|
output: | ([[ and ]] will be deleted the [['s priority is higher than [ for it's longer)
|
||||||
|
|
||||||
* Modifier
|
* Modifier
|
||||||
|
|
||||||
The text after // in close pair is modifiers
|
The text after // in close pair is modifiers
|
||||||
|
|
||||||
n - do not map the first charactor of closed pair
|
n - do not map the first charactor of closed pair
|
||||||
|
|
||||||
for 'begin' 'end' pair, e is a charactor, if map e to jump will be annoy, so use modifier 'n' to skip key map
|
for 'begin' 'end' pair, e is a charactor, if map e to jump will be annoy, so use modifier 'n' to skip key map
|
||||||
|
|
||||||
au FileType ruby let b:AutoPairs = AutoPairsDefine({'begin': 'end//n]'})
|
au FileType ruby let b:AutoPairs = AutoPairsDefine({'begin': 'end//n]'})
|
||||||
|
|
||||||
|
|
||||||
input: begin
|
input: begin
|
||||||
output: begin|end
|
output: begin|end
|
||||||
|
|
||||||
input: begin|end (press <BR> on |)
|
input: begin|end (press <BR> on |)
|
||||||
output: |
|
output: |
|
||||||
|
|
||||||
input: begin|end (press e on |)
|
input: begin|end (press e on |)
|
||||||
output: begineend (will not jump for e is not mapped)
|
output: begineend (will not jump for e is not mapped)
|
||||||
|
|
||||||
* Advanced usage
|
* Advanced usage
|
||||||
|
|
||||||
au FileType rust let b:AutoPairs = AutoPairsDefine({'\w\zs<': '>'})
|
au FileType rust let b:AutoPairs = AutoPairsDefine({'\w\zs<': '>'})
|
||||||
|
|
||||||
if press < after a word will generate the pair
|
if press < after a word will generate the pair
|
||||||
|
|
||||||
when use regexp MUST use \zs to prevent catching
|
when use regexp MUST use \zs to prevent catching
|
||||||
if use '\w<' without \zs, for text hello<|> press <BS> on | will output 'hell', the 'o' has been deleted
|
if use '\w<' without \zs, for text hello<|> press <BS> on | will output 'hell', the 'o' has been deleted
|
||||||
|
|
||||||
pair: '\w\zs<': '>'
|
pair: '\w\zs<': '>'
|
||||||
input: h <
|
input: h <
|
||||||
output: h <
|
output: h <
|
||||||
|
|
||||||
input: h<
|
input: h<
|
||||||
output: h<|>
|
output: h<|>
|
||||||
|
|
||||||
input: h<|> press <BR>
|
input: h<|> press <BR>
|
||||||
output: h|
|
output: h|
|
||||||
|
|
||||||
pair: '\ws<': '>' (WRONG pair which missed \zs)
|
pair: '\ws<': '>' (WRONG pair which missed \zs)
|
||||||
input: h<|> press <BR>
|
input: h<|> press <BR>
|
||||||
output: | (charactor 'h' is deleted)
|
output: | (charactor 'h' is deleted)
|
||||||
|
|
||||||
|
|
||||||
the 'begin' 'end' pair write in
|
the 'begin' 'end' pair write in
|
||||||
|
|
||||||
au FileType ruby let b:AutoPairs = AutoPairsDefine({'\v(^|[^\w])\zsbegin': 'end//n'})
|
au FileType ruby let b:AutoPairs = AutoPairsDefine({'\v(^|[^\w])\zsbegin': 'end//n'})
|
||||||
|
|
||||||
will be better, only auto pair when at start of line or follow non-word text
|
will be better, only auto pair when at start of line or follow non-word text
|
||||||
|
|
||||||
|
|
||||||
Known Issues
|
Known Issues
|
||||||
|
Loading…
Reference in New Issue
Block a user