How to make the curly brace on the same line when press enter between them ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

How to make the curly brace on the same line when press enter between them ?

Zhe Lee
here is the thing:
{|}, | is my curve when I press enter now the curly braces will not on the same line.
How to fix it?  


![0126020710.png](http://7xpvdr.com1.z0.glb.clouddn.com/0126020710.png)

brace seems normal here
![0126020934.png](http://7xpvdr.com1.z0.glb.clouddn.com/0126020934.png)

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

0126020710.png (6K) Download Attachment
0126020934.png (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Tony Mechelynck
On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <[hidden email]> wrote:
> here is the thing:
> {|}, | is my curve when I press enter now the curly braces will not on the same line.
> How to fix it?
>

If you mean they are not in the same (vertical) _column_ then I'm not
sure; it may or may not be possible, check in particular the options
containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
then hit Tab until you come to an entry that looks promising).

OTOH, if what worries you is really that they aren't on the same
(horizontal) _line_ then the answer is simple: Dont hit Enter between
them, but possibly the space bar, the Tab key, or even nothing. Or
type them both one after the other, then hit Left-Arrow to bring the
cursor back between them.

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Tony Mechelynck
P.S. See also «:help 'cinoptions'» if it is a C-like language.

Best regards,
Tony.

On Wed, Jan 25, 2017 at 9:23 PM, Tony Mechelynck
<[hidden email]> wrote:

> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <[hidden email]> wrote:
>> here is the thing:
>> {|}, | is my curve when I press enter now the curly braces will not on the same line.
>> How to fix it?
>>
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Charles E Campbell Jr
Tony Mechelynck wrote:

> P.S. See also «:help 'cinoptions'» if it is a C-like language.
>
> Best regards,
> Tony.
>
> On Wed, Jan 25, 2017 at 9:23 PM, Tony Mechelynck
> <[hidden email]> wrote:
>> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <[hidden email]> wrote:
>>> here is the thing:
>>> {|}, | is my curve when I press enter now the curly braces will not on the same line.
>>> How to fix it?
>>>
>> If you mean they are not in the same (vertical) _column_ then I'm not
>> sure; it may or may not be possible, check in particular the options
>> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
>> then hit Tab until you come to an entry that looks promising).
>>
>> OTOH, if what worries you is really that they aren't on the same
>> (horizontal) _line_ then the answer is simple: Dont hit Enter between
>> them, but possibly the space bar, the Tab key, or even nothing. Or
>> type them both one after the other, then hit Left-Arrow to bring the
>> cursor back between them.
>>
This may be a question about a plugin which facilitates entry of things
like{...}.  A snippet,  perhaps?  If so, find the plugin author in the
documentation and ask him/her.

Chip Campbell

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Zhe Lee
On Thursday, January 26, 2017 at 7:36:31 AM UTC+8, DrChip wrote:

> Tony Mechelynck wrote:
> > P.S. See also «:help 'cinoptions'» if it is a C-like language.
> >
> > Best regards,
> > Tony.
> >
> > On Wed, Jan 25, 2017 at 9:23 PM, Tony Mechelynck
> > <[hidden email]> wrote:
> >> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <[hidden email]> wrote:
> >>> here is the thing:
> >>> {|}, | is my curve when I press enter now the curly braces will not on the same line.
> >>> How to fix it?
> >>>
> >> If you mean they are not in the same (vertical) _column_ then I'm not
> >> sure; it may or may not be possible, check in particular the options
> >> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> >> then hit Tab until you come to an entry that looks promising).
> >>
> >> OTOH, if what worries you is really that they aren't on the same
> >> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> >> them, but possibly the space bar, the Tab key, or even nothing. Or
> >> type them both one after the other, then hit Left-Arrow to bring the
> >> cursor back between them.
> >>
> This may be a question about a plugin which facilitates entry of things
> like{...}.  A snippet,  perhaps?  If so, find the plugin author in the
> documentation and ask him/her.
>
> Chip Campbell
It happens in the new buffer with no filetype, and I check the _.snippet file but there is no related snippet.

I try to debug the process by call the Testf() but it works normally this time.
I don't know why.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

0126093812.png (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Zhe Lee
In reply to this post by Tony Mechelynck
On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:

> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <[hidden email]> wrote:
> > here is the thing:
> > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > How to fix it?
> >
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.
yeah, I mean the curly braces not in the same column, plz check my update

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Zhe Lee
In reply to this post by Tony Mechelynck
On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:

> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <[hidden email]> wrote:
> > here is the thing:
> > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > How to fix it?
> >
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.
Yeah, I mean the same column, I try to debug the function testf()(which pic is in another post of mine below), and locate the problem but it worked normally this time.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Zhe Lee
In reply to this post by Tony Mechelynck
On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:

> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <[hidden email]> wrote:
> > here is the thing:
> > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > How to fix it?
> >
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.
I mean that when the cursor is between a pair of curly braces(the curly braces just at the beginning of the line), press enter now the right brace should be at the start of a newline, but it seems add a `tab` first and then insert the } at the new line.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Gary Johnson-4
On 2017-01-25, Zhe Lee wrote:

> On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> > On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee wrote:
> > > here is the thing:
> > > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > > How to fix it?
> > >
> >
> > If you mean they are not in the same (vertical) _column_ then I'm not
> > sure; it may or may not be possible, check in particular the options
> > containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> > then hit Tab until you come to an entry that looks promising).
> >
> > OTOH, if what worries you is really that they aren't on the same
> > (horizontal) _line_ then the answer is simple: Dont hit Enter between
> > them, but possibly the space bar, the Tab key, or even nothing. Or
> > type them both one after the other, then hit Left-Arrow to bring the
> > cursor back between them.
> >
> > Best regards,
> > Tony.
>
> I mean that when the cursor is between a pair of curly braces(the
> curly braces just at the beginning of the line), press enter now
> the right brace should be at the start of a newline, but it seems
> add a `tab` first and then insert the } at the new line.

That behavior is controlled by the indent settings made in your
~/.vimrc or in the indent plugin for the file type you are editing.
What do you see when you execute this?

    :verbose ft? cindent? cinoptions? indentexpr?

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Zhe Lee
In reply to this post by Tony Mechelynck
On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:

> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <[hidden email]> wrote:
> > here is the thing:
> > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > How to fix it?
> >
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.
Oh if in vimrc file the result will be normal:
{
}

but if in a new buffer it will be:
{
    }

Is there a way to debug what happened in the process ? Like use the debug ?

just use debug call Testf() doesn't work here.

function! Testf()
    " execute "norm i{}\<left>\<CR>"
    execute "norm i{\<CR>"
endfunction

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Zhe Lee
In reply to this post by Gary Johnson-4
On Thursday, January 26, 2017 at 10:06:09 AM UTC+8, Gary Johnson wrote:

> On 2017-01-25, Zhe Lee wrote:
> > On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> > > On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee wrote:
> > > > here is the thing:
> > > > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > > > How to fix it?
> > > >
> > >
> > > If you mean they are not in the same (vertical) _column_ then I'm not
> > > sure; it may or may not be possible, check in particular the options
> > > containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> > > then hit Tab until you come to an entry that looks promising).
> > >
> > > OTOH, if what worries you is really that they aren't on the same
> > > (horizontal) _line_ then the answer is simple: Dont hit Enter between
> > > them, but possibly the space bar, the Tab key, or even nothing. Or
> > > type them both one after the other, then hit Left-Arrow to bring the
> > > cursor back between them.
> > >
> > > Best regards,
> > > Tony.
> >
> > I mean that when the cursor is between a pair of curly braces(the
> > curly braces just at the beginning of the line), press enter now
> > the right brace should be at the start of a newline, but it seems
> > add a `tab` first and then insert the } at the new line.
>
> That behavior is controlled by the indent settings made in your
> ~/.vimrc or in the indent plugin for the file type you are editing.
> What do you see when you execute this?
>
>     :verbose ft? cindent? cinoptions? indentexpr?
>
> Regards,
> Gary
yeah as for me is about the settiing of the  indentexpr?  thx~

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to make the curly brace on the same line when press enter between them ?

Gary Johnson-4
On 2017-01-25, Zhe Lee wrote:

> On Thursday, January 26, 2017 at 10:06:09 AM UTC+8, Gary Johnson wrote:
> > On 2017-01-25, Zhe Lee wrote:
> > > On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> > > > On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee wrote:
> > > > > here is the thing:
> > > > > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > > > > How to fix it?
> > > > >
> > > >
> > > > If you mean they are not in the same (vertical) _column_ then I'm not
> > > > sure; it may or may not be possible, check in particular the options
> > > > containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> > > > then hit Tab until you come to an entry that looks promising).
> > > >
> > > > OTOH, if what worries you is really that they aren't on the same
> > > > (horizontal) _line_ then the answer is simple: Dont hit Enter between
> > > > them, but possibly the space bar, the Tab key, or even nothing. Or
> > > > type them both one after the other, then hit Left-Arrow to bring the
> > > > cursor back between them.
> > > >
> > > > Best regards,
> > > > Tony.
> > >
> > > I mean that when the cursor is between a pair of curly braces(the
> > > curly braces just at the beginning of the line), press enter now
> > > the right brace should be at the start of a newline, but it seems
> > > add a `tab` first and then insert the } at the new line.
> >
> > That behavior is controlled by the indent settings made in your
> > ~/.vimrc or in the indent plugin for the file type you are editing.
> > What do you see when you execute this?
> >
> >     :verbose ft? cindent? cinoptions? indentexpr?
> >
> > Regards,
> > Gary
>
> yeah as for me is about the settiing of the  indentexpr?  thx~

Just to satisfy my own curiosity, what did you discover?

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.