Giter Site home page Giter Site logo

auto-pairs's Introduction

Auto Pairs

Insert or delete brackets, parens, quotes in pair.

Installation

  • Manual
    • Copy plugin/auto-pairs.vim to ~/.vim/plugin
  • Pathogen
    • git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs
  • Vundle
    • Plugin 'jiangmiao/auto-pairs'

Features

  • Insert in pair

    input: [
    output: [|]
    
  • Delete in pair

    input: foo[<BS>]
    output: foo
    
  • Insert new indented line after Return

    input: {|} (press <CR> at |)
    output: {
        |
    }          (press } to close the pair)
    output: {
    }|         (the inserted blank line will be deleted)
    
  • Insert spaces before closing characters, only for [], (), {}

    input: {|} (press <SPACE> at |)
    output: { | }
    
    input: {|} (press <SPACE>foo} at |)
    output: { foo }|
    
    input: '|' (press <SPACE> at |)
    output: ' |'
    
  • Skip ' when inside a word

    input: foo| (press ' at |)
    output: foo'
    
  • Skip closed bracket.

    input: []
    output: []
    
  • Ignore auto pair when previous character is \

    input: "\'
    output: "\'"
    
  • Fast Wrap

    input: |[foo, bar()] (press (<M-e> at |)
    output: ([foo, bar()])
    
  • Quick move char to closed pair

    input: (|){["foo"]} (press <M-}> at |)
    output: ({["foo"]}|)
    
    input: |[foo, bar()] (press (<M-]> at |)
    output: ([foo, bar()]|)
    
  • Quick jump to closed pair.

    input:
    {
        something;|
    }
    
    (press } at |)
    
    output:
    {
    
    }|
    
  • Fly Mode

     input: if(a[3)
     output: if(a[3])| (In Fly Mode)
     output: if(a[3)]) (Without Fly Mode)
    
     input:
     {
         hello();|
         world();
     }
    
     (press } at |)
    
     output:
     {
         hello();
         world();
     }|
    
     (then press <M-b> at | to do backinsert)
     output:
     {
         hello();}|
         world();
     }
    
     See Fly Mode section for details
    
  • Multibyte Pairs

     Support any multibyte pairs such as <!-- -->, <% %>, """ """
     See multibyte pairs section for details
    

Fly Mode

Fly Mode will always force closed-pair jumping instead of inserting. only for ")", "}", "]"

If jumps in mistake, could use AutoPairsBackInsert(Default Key: <M-b>) to jump back and insert closed pair.

the most situation maybe want to insert single closed pair in the string, eg ")"

Fly Mode is DISABLED by default.

add let g:AutoPairsFlyMode = 1 .vimrc to turn it on

Default Options:

let g:AutoPairsFlyMode = 0
let g:AutoPairsShortcutBackInsert = '<M-b>'

Shortcuts

System Shortcuts:
    <CR>  : Insert new indented line after return if cursor in blank brackets or quotes.
    <BS>  : Delete brackets in pair
    <M-p> : Toggle Autopairs (g:AutoPairsShortcutToggle)
    <M-e> : Fast Wrap (g:AutoPairsShortcutFastWrap)
    <M-n> : Jump to next closed pair (g:AutoPairsShortcutJump)
    <M-b> : BackInsert (g:AutoPairsShortcutBackInsert)

If <M-p> <M-e> or <M-n> conflict with another keys or want to bind to another keys, add

    let g:AutoPairsShortcutToggle = '<another key>'

to .vimrc, if the key is empty string '', then the shortcut will be disabled.

Options

  • g:AutoPairs

    Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''"}
    
  • b:AutoPairs

    Default: g:AutoPairs
    
    Buffer level pairs set.
    
  • g:AutoPairsShortcutToggle

    Default: '<M-p>'
    
    The shortcut to toggle autopairs.
    
  • g:AutoPairsShortcutFastWrap

    Default: '<M-e>'
    
    Fast wrap the word. all pairs will be consider as a block (include <>).
    (|)'hello' after fast wrap at |, the word will be ('hello')
    (|)<hello> after fast wrap at |, the word will be (<hello>)
    
  • g:AutoPairsShortcutJump

    Default: '<M-n>'
    
    Jump to the next closed pair
    
  • g:AutoPairsMapBS

    Default : 1
    
    Map <BS> to delete brackets, quotes in pair
    execute 'inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>'
    
  • g:AutoPairsMapCh

    Default : 1
    
    Map <C-h> to delete brackets, quotes in pair
    
  • g:AutoPairsMapCR

    Default : 1
    
    Map <CR> to insert a new indented line if cursor in (|), {|} [|], '|', "|"
    execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsReturn()<CR>'
    
  • g:AutoPairsCenterLine

    Default : 1
    
    When g:AutoPairsMapCR is on, center current line after return if the line is at the bottom 1/3 of the window.
    
  • g:AutoPairsMapSpace

    Default : 1
    
    Map <space> to insert a space after the opening character and before the closing one.
    execute 'inoremap <buffer> <silent> <CR> <C-R>=AutoPairsSpace()<CR>'
    
  • g:AutoPairsFlyMode

    Default : 0
    
    set it to 1 to enable FlyMode.
    see FlyMode section for details.
    
  • g:AutoPairsMultilineClose

    Default : 1
    
    When you press the key for the closing pair (e.g. `)`) it jumps past it.
    If set to 1, then it'll jump to the next line, if there is only whitespace.
    If set to 0, then it'll only jump to a closing pair on the same line.
    
  • g:AutoPairsShortcutBackInsert

    Default : <M-b>
    
    Work with FlyMode, insert the key at the Fly Mode jumped postion
    
  • g:AutoPairsMoveCharacter

    Default: "()[]{}\"'"
    
    Map <M-(> <M-)> <M-[> <M-]> <M-{> <M-}> <M-"> <M-'> to
    move character under the cursor to the pair.
    

Buffer Level Pairs Setting

Set b:AutoPairs before BufEnter

eg:

" When the filetype is FILETYPE then make AutoPairs only match for parenthesis
au Filetype FILETYPE let b:AutoPairs = {"(": ")"}
au FileType php      let b:AutoPairs = AutoPairsDefine({'<?' : '?>', '<?php': '?>'})

Multibyte Pairs

The default pairs is {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
You could also define multibyte pairs such as <!-- -->, <% %> and so on
  • Function AutoPairsDefine(addPairs:dict[, removeOpenPairList:list])

      add or delete pairs base on g:AutoPairs
    
      eg:
          au FileType html let b:AutoPairs = AutoPairsDefine({'<!--' : '-->'}, ['{'])
          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 {'\^"': ''}
    
  • General usage

      au FileType php      let b:AutoPairs = AutoPairsDefine({'<?' : '?>', '<?php': '?>'})
    
      the first key of closed pair ? will be mapped
    
      pairs: '<?' : '?>', '<?php': '?>'
      input: <?
      output: <?|?>
    
      input: <?php
      output: <?php|?>
    
      input: he<?php|?> (press <BS> at|)
      output: he|
    
      input: <?php|?> (press ? at|)
      output: <?php?>|
    
      pair: '[[':']]'
      input: [[|]] (press <BS>)
      output: | ([[ and ]] will be deleted the [['s priority is higher than [ for it's longer)
    
  • Modifier

      The text after //  in close pair is modifiers
    
      n - do not map the first charactor of closed pair to close key
      m - close key jumps through multi line
      s - close key jumps only in the same line
      k[KEY] - map the close key to [KEY]
    
          by default if open key equals close key the multi line is turn off
    
          "<?": "?>"      ? jumps only in the same line
          "<?": "?>//m"   force ? jumping through multi line
          "<?php":"?>"    ? will jump through multi line
          "<?php":"?>//s" force ? only jumping in the same line
          "<?": "?>//n"   do not jump totally
          "<?": "?>//k]"  use key ] to jump through ?>
    
      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]'})
    
    
      input: begin
      output: begin|end
    
      input: begin|end (press <BS> on |)
      output: |
    
      input: begin|end (press e on |)
      output: begineend (will not jump for e is not mapped)
    
  • Advanced usage

      au FileType rust     let b:AutoPairs = AutoPairsDefine({'\w\zs<': '>'})
    
      if press < after a word will generate the pair
    
      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
    
      pair: '\w\zs<': '>'
      input: h <
      output: h <
    
      input: h<
      output: h<|>
    
      input: h<|> press <BS>
      output: h|
    
      pair: '\w<': '>' (WRONG pair which missed \zs)
      input: h<|> press <BS>
      output: | (charactor 'h' is deleted)
    
    
      the 'begin' 'end' pair write in
    
      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
    

TroubleShooting

The script will remap keys ([{'"}]) <BS>,
If auto pairs cannot work, use :imap ( to check if the map is corrected.
The correct map should be <C-R>=AutoPairsInsert("\(")<CR>
Or the plugin conflict with some other plugins.
use command :call AutoPairsInit() to remap the keys.
  • How to insert parens purely

    There are 3 ways

    1. use Ctrl-V ) to insert paren without trigger the plugin.

    2. use Alt-P to turn off the plugin.

    3. use DEL or x to delete the character insert by plugin.

  • Swedish Character Conflict

    Because AutoPairs uses Meta(Alt) key as shortcut, it is conflict with some Swedish character such as å. To fix the issue, you need remap or disable the related shortcut.

Known Issues

Breaks '.' - issue #3

Description: After entering insert mode and inputing `[hello` then leave insert
             mode by `<ESC>`. press '.' will insert 'hello' instead of '[hello]'.
Reason: `[` actually equals `[]\<LEFT>` and \<LEFT> will break '.'.
        After version 7.4.849, Vim implements new keyword <C-G>U to avoid the break
Solution: Update Vim to 7.4.849+

Contributors

License

Copyright (C) 2011-2013 Miao Jiang

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

auto-pairs's People

Contributors

bombela avatar camthompson avatar d10n avatar davepagurek avatar docwhat avatar felixoid avatar grodzik avatar halftan avatar jiangmiao avatar kborkows avatar philliptvo avatar rkiyanchuk avatar scottmcginness avatar shirohana avatar vbauerster avatar ytang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

auto-pairs's Issues

{<enter> instead of {{

Hi
This is a great script. I think this would be even more nice:

{
||
V
{

}

same with other brackets.

关于使用<c-h>删除左括号的处理

👍 👍

我发现的auto-pairs比 delimitMate好很多。比如enter空行的处理,比其他的插件都好很多,也没发现bug(使用别的插件,撤销后会残留([{)]})。(我之前以为这是delimitMate的功劳,才发现自己同时安装了auto-pairsdelimitMate,做了对比才知道是auto-pairs在默默奉献着)

但有一点,所有的“括号类插件”都没有做好:
比如:

(|)

代表光标

使用`backspace`删除`(`,`)`也会自动被删掉,但使用`<c-h>`时,`)`却还在。

使用<c-w>,<c-h>删除单词或单个字符,比使用backspace要快捷呢,如果auto-pairs能支持这两个快捷键的处理就好了。

auto-pairs is better than delimitMate
English user please read the duplicate Raimondi/delimitMate#127

Conflict with viki

Hi jiangmiao,

I know this is not your script's fault but I was wondering if you maybe have a solution for it or if it would be possible to even modify your script to avoid this problem?

I am using viki/Deplate (http://www.vim.org/scripts/script.php?script_id=861)
and just noticed that auto-pairs causes a serious issue in viki, probably because of the remapping of ?

When I have auot-pairs in my plugin folder and open a page in viki then whenever I hit ENTER, I get this:

viki#ExprMarkInexistentInElement('ParagraphVisible','
')

I don't know how to explore further what is going on and whether there could be a workaround. I tried toggling auto-pairs in viki files but even when auto-pairs is off I get the above problem. It only goes away if I remove auto-pairs from the plugin folder.

"Quick jump to closed pair" ignores AutoPairs setting

I have this in my .vimrc:

" {{{ Autopairs

autocmd FileType vim let b:AutoPairs={'(':')', '[':']', "'":"'", '`':'`'}
let g:AutoPairsFlyMode = 0

" }}}

If I insert a " after the fourth line, the cursor jumps to the double-quote mark on the last line. This happens even if I set AutoPairs globally to exclude double-quote marks.

License missing

Hi there

I couldn't find a license mentioned. Can you please add one so one knows whether it is legal to fork or package it for a Linux distribution (for example)?

Thanks!

Too big indentation on putting a new line after e.g. ({ <CR> })

I have noticed that with your plugin using Insert new indented line after Return in e.g. ({ | }) I would get wrong indentation level.

mydata.forEach(function(d){
  d.interval = +d.interval;
  })

How this can be corrected or adjusted to produce something like this :

mydata.forEach(function(d){
  d.interval = +d.interval;
})

??

AutoPair with pipe characters '|'

How do you configure vimrc to auto close pipes ?

let g:AutoPairs = {'(': ')', '|': '|'}

This config causes the AutoPairsTryInit function to trigger errors when vim loads.

I'm using Vundle to manage my different plugins.
Capture
Let me know if you need more info.
Thanks

Trouble using a Swedish character in insert mode.

After switching to the latest version (1.2.9) I'm suddenly unable to insert the Swedish character 'å'. The issue has been replicated over two apple computers, both running MacVim 7.3 snapshot 66 and Vim 7.3 patch 754. The issue appears both in gVim and terminal sessions.

Pressing Enter is broken in C/C++

Pressing enter in insert mode inserts the following text

<SNR>22_HandlePossibleSelectionEnter()

This problem is faced only when I use auto-pairs along with clang-complete

<CR> don't work together with supertab

if you have supertab, the CR wil be mapped to:

i <CR> & <C-R>=<SNR>83_SelectCompletion(1)<CR><CR><SNR>19_AutoPairsReturn

and if you press {<CR>, it become {<CR><CR>|} (| is the curser), more worse, if you press <CR>, it becomes <CR><CR> :-(

So I had to modify supertab now :-(

Insert-mode changes are not monolithic

Normally if you enter Insert-mode, everything from entering the mode until you return to Normal-mode is stored as one change.

After bisecting I've determined that 207107a has the effect of breaking up these monolithic changes into lots of small ones, effectively flooding the undo list.

No indentation on enter

From the documentation, it seems after hitting enter after creating a pair of curly-brackets, the trailing bracket should be on its own line, with the cursor indented on the previous (new) line, for example:
{(enter)}
produces
{
(tab or spaces)||
}

However, I do not see any indentation when I try this.

无法输入中文

使用了auto-pairs插件后,无法输入中文,切换到中文输入法打字时会自动换回英文

Close ( of auto-completion

Hello,
I'm using a lot auto-completion with omnicompletion and Valloric/YouCompleteMe but auto-pairs actually don't close the auto-inserted (. How do I fix this problem or is there a simple patch ?

auto-pairs breaks iabbre

auto-pairs used to be able to work with iabbre. But now it breaks iabbre. I forgot from which version this problem began to occur. I noticed that many automatic-paren-closing plugins have the same problem. If the author confirms this is a won't-fix, it is absolutely all right to close this ticket immediately.

Figure out if starting quote is already in code

When I use vim html attribute completion I get to situations where the code looks like:

<img src="test.jpg|

and when I hit " to end the attribute auto-pairs enters a second " so the code becomes

<img src="test.jpg"|"

could auto-paris not figure out that I'm already inside a string and just want to close it? I know I can do " but it would be nice if I didn't have to.

Fast Wrap 的位置

Fast Wrap 目前的行為: ( | 是 caret 的位置)

Before:
(|)p[i];
fast wrap once:
(p[|)i];
fast wrap twice:
(p[i];|)

原本預期是這樣:

Before:
(|)p[i];
fast wrap once:
(p|)[i];
fast wrap twice:
(p[i]|);

Errors in pair creation that is split by ENTER

I'm using MacVim and trying to press ENTER just after a pair creation to produce, e.g.

(

)

gives the following error:

auto-pairs error

The problem is in this line:

if g:AutoPairsCenterLine && winline() * 1.5 >= winheight(0)

VIM help says those functions return a Number and says the following about Float/Number conversions:

When mixing Number and Float the Number is converted to Float.  Otherwise
there is no automatic conversion of Float.  You can use str2float() for String
to Float, printf() for Float to String and float2nr() for Float to Number. 

I've changed that line to this:

if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2

and it's not giving errors anymore.

OFF TOPIC:
I'm a MacVim user and some default auto-pairs shortcuts has made me go through this.

Allow the `.` key to work -- add repeat.vim support

I like your auto-pairs mode very much. It just "works" enough that I rarely think about it.

However, it does ruin the the . command. Typing anything with a pair in it will produce weird results with the . command.

@tpope has vim-repeat which allows (allegedly) plugin writers to easily support the . command. I don't know how easy it is, since I don't grok how it works or how to add it to your code.

But I'd really appreciate it if auto-pairs worked with the . command.

Thanks!

javascript indentation

In javascript with nocindent, the indentation is "wrong".

Firstly without auto-pairs plugin:

// cindent
function () {
    var foo = {
        bar: {

             } // this line is not indented "correctly"
    }
}
// nocindent
function () {
    var foo = {
        bar: {

        } // ok
    }
}

With auto-pairs and nocindent the result is like setting cindent.

I think it is due to '=ko' in line 369:

return "\<ESC>=ko".cmd

https://github.com/jiangmiao/auto-pairs/blob/master/plugin/auto-pairs.vim#L369

Any thought?

Thanks in advance,
Alberto

How do I disable auto-pairing " for VimL?

(Sorry, rather a question, than an issue.)

auto-pairs is great, but when writing a VimL file, it's a bit annoying that " always gets auto-paired. How do I disable auto-pairing " just for VimL?
I read the documentation, but couldn't figure out.

Backspace deletes text in a weird way

I'm having a weird behavior with auto-pairs and the backspace key. It deletes part of the line but if I write something it continues where I was before backspace. The below example is just made up, a better example can be viewed in a screen recording I did and uploaded here: http://d.pr/v/6U87

The video is not very good since it's my first try att screen recording but you can hopefully see what happens. Here is the text version, I start out with a line like this:

Official site of the popular vi clone. Includes project news, documentation.

My cursor is at the end and when I press backspace the line is changed to

Official site of the popular vi

When I write more text it becomes

Official site of the popular vi More text added here

I've disabled all other plugins except auto-pairs and if I disable auto-pairs also it doesn't happend. If I do :imap I get:

i <BS> *@<C-R>=AutoPairsDelete()<CR>

Thanks in advance!

<CR> don't work together with supertab

if you have supertab, the CR wil be mapped to:

i & =83_SelectCompletion(1)19_AutoPairsReturn

and if you press {, it become {|} (| is the curser), more worse, if you press , it becomes :-(

So I had to modify supertab now :-(

Typing â problem

I have been facing an issue that when I type â, like in the word "Parâmetro", either the cursor jumps somewhere else in the file, or the â is just not inserted and I see only "Parmetro". If I do Ctrl-V â then it works. Strangely, typing any other ^ combination, like
"você", û, ô, etc., it works just fine.

There has been a discussion about this issue in vim_use google groups:
https://groups.google.com/forum/?fromgroups=#!topic/vim_use/rDgZc-az5I4

Your plugin is amazing. Keep up the good work. Thanks.

Backspace removes additional " (quote) on line below

Take the following vim script code:

" This is a comment

Cursor is somewhere on the line above. Open new line above with . Result:

"<cursor here>
" This is a comment

Press backspace to delete the " (quote) at the beginning of the line. Result:

 This is a comment

The " (quote) in the commented out line was removed in addition to the " (quote) intended to be removed.

Undesirable behavior after deleting a closing bracket in normal/visual mode.

For example, let's say you have the following text:

def nested_tuple():
    return (
        (
            'a', 'b',
        )
    )

Now delete the penultimate closing paren in nomal mode:

def nested_tuple():
    return (
        (
            'a', 'b',
    )

If you enter insert mode and try to re-add the inner closing paren where it was before, auto-pairs will instead "pass over" the outer paren, forcing you to type ) twice.

support auto pairs for neocomplcache complete.

I'm using neocomplcache, neocomplcache complete function like this aa.func(, I hope auto pairs can work here.
I posted an issue at neocomplcache repo, someone told me, this should be implemented by autopairs.

Suggestion: Add `` to the default list of auto-pairs

Just a suggestion to include `` in the list of default items to be auto-handled. In Markdown (and older shell scripts, I suppose), it would be very helpful to have them auto-closed, and I can't think of a language where you really wouldn't want them to double.

That said, it's easy enough to add them manually, so this is really just a suggested thought, not a defect at all.

Thanks for the library.

Breaks Return in markdown

In a markdown file, instead of creating a new line when the return key is pressed, auto-pairs spits out <SNR>57_Return()

Fly mode has strange behavior

I.e. if the text is like below:

(|
()

and | is the curser. when you press ), mustly you mean close the first bracket, but in face you jumpped to second ).

maybe we can check the next ) before jump.

thank you :-)

jump out pairs with a key map.

I hope AutoPairs can support a function for key map to jump out pairs directly.
For example:
print('This is text|') --> jump out --> print('This is text')|
The cursor | can jump out quickly.
This keymap can be <Tab> or <C-*> etc.

Abbreviations are not working with this plugin

I noticed that vim's internal abbreviations are not working once auto-pairs is installed. I had the same issue in the past the auto-close. I guess it's how those plugins are implemented.

Any chance to might figure out a workaround?

Typographer's quotes do not pair

I would like to auto pair certain typographer's quote pairs, specifically with and with .

The following is in my .vimrc:

let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`', '‘':'’','“':'”','«':'»'}

The French style quotes « and » auto pair, but the other two additions (‘ ’ “ ”) do not.

The unicode codes involved:

  • « and » are U+00AB and U+00BB (these work)
  • and are U+2018 and U+2019 (do not work)
  • and are U+201C and U+201D (do not work)

Closing bracket not indented properly when `filetype plugin indent on`

When I've set filetype plugin indent on and am writing a nested paren/bracket/etc., the closing bracket doesn't indent properly after hitting enter.

This is true for both CSS and JavaScript (haven't tested others).

Screencast attached:

http://f.cl.ly/items/3w3E2Z1h1z3O3H3l3T2b/autopairindent.mov

Relevant .vimrc settings in this screencast:

filetype plugin indent on
set autoindent
set smartindent

And the filetype is set to css here.

Breaks '.'

I'm not sure if this is even fixable (and I've faced similar issues with other pairing plugins), but could it possibly be made to work with '.'.
Currently if I type ''i[Hello world]' and then hit '.' I only get the 'Hello World' and not the brackets. I understand they work as different actions, but unfortunately vim users are used to thinking of an insert action as a repeatable command.
This becomes even more tricky if you use this as part of a 'cw' (change word) type command, because it forgets the changing part of the action.

(maybe Vim bugs) sometimes press BS output strange words

if you have a buffer has content:

abc
ab|

now you press <C-N> to complete word, it becomes abc, (has popup menu of complete words), then press backspace, the text will become:

abc
abAutoPairsDelete()|

change line 290 of auto-pairs.vim from:
execute 'inoremap <buffer> <silent> <expr> <BS> AutoPairsDelete()'

to:
execute 'inoremap <buffer> <silent> <BS> <C-R>=AutoPairsDelete()<CR>'

seems solve this.

having errors with the double qoutes "

in gvim im having errors with "

error says:
E116: Invalid arguments for function AutoPairsInsert(""")
E15: Invalid expression: AutoPairsInsert(""")

my plugin installed:
pathogen
zencoding
NERDTree

ENTER not working with lone closing bracket at beginning of line

This is in Perl but I guess it is a more general problem.

What I want to end up with:

if () {

} elsif () {

}

However if you get to this point (cursor indicated by | )

if () {

} elsif (){|}

and hit ENTER, you get this:

if () {

}
|
elsif () {
}

i.e. the elsif is placed in a new line and the cursor is above it. What I would have expected is to have the cursor in the indented elsif block.

It works if you avoid the lone closing bracket at beginning of line, i.e. starting like this

if () {

}
elsif () {|}

hitting ENTER now produces

if () {

}
elsif () {

}

but the above (top of page) version with the closing bracket at the beginning of the line followed by elsif is a frequently used coding style in Perl, so this should work.
Thanks for looking into this and thanks for providing this very useful plugin!

Error when starting vim

I just updated auto-pairs to 0a79f50, which displays the following error when I start vim:
Screen Shot 2013-03-26 at 9 17 50 PM

I also see different errors when opening files. I found that when using d23864f and before, there are no errors. For now, I've reverted to d23864f and will try to patch and send a pull request when I can.

Add ; after closing } in javascript (.js) files

Is it possible to add the above described functionality, namely: while writing some JavaScript code I often have to write anonymous functions, like

EmployeeProvider.prototype.findById = function(id, callback){
  |
};

(let say the cursor is where | is )
Besides closing the brace and putting a line of gap between it would be really cool to put ; after }.

P.S.
Love this plugin :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.