Coder Social home page Coder Social logo

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

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.

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.

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 ?

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!

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)

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

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.

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 :-(

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

(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.

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.

关于使用<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

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.

{<enter> instead of {{

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

{
||
V
{

}

same with other brackets.

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.

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!

"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.

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.

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.

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!

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

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?

无法输入中文

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

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!

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.

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.

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.

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.

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 :)

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;
})

??

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]|);

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.

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.

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.

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.

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 :-)

<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 :-(

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.

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()

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.