Moving to start of a block - question

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Moving to start of a block - question

Rajesh Kannan-3
G'Day!

Say I have the following code:

L#
1  void main()
2  {
3    fun1()
4  }
5
6  void fun1(){
7  ...
8  }

If at L3 I type '[[' (without quotes) in command mode then vim takes
the cursor to L2.
If at L7 I type '[[' (without quotes) in command mode then vim takes
the cursor to L2. Should it not take me to L6 instead? Can anyone
suggest what setting would make vim work like latter?

Cheers!

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

To unsubscribe, reply using "remove me" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: Moving to start of a block - question

Karthick Gururaj
On Fri, Apr 2, 2010 at 12:07 PM, Rajesh Kannan <[hidden email]> wrote:
G'Day!

Say I have the following code:

L#
1  void main()
2  {
3    fun1()
4  }
5
6  void fun1(){
7  ...
8  }

If at L3 I type '[[' (without quotes) in command mode then vim takes
the cursor to L2.
If at L7 I type '[[' (without quotes) in command mode then vim takes
the cursor to L2. Should it not take me to L6 instead? Can anyone
suggest what setting would make vim work like latter?
"Command mode" is what you get once you type the ':', I think you mean normal mode.

From the help,
[[       [count] sections backward or to the previous '{' in the first column.
(note: "first" column) which explains the behaviour.

Maybe you want '[{' ?

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Moving to start of a block - question

David Lam
In reply to this post by Rajesh Kannan-3
On Thu, Apr 1, 2010 at 11:37 PM, Rajesh Kannan <[hidden email]> wrote:
G'Day!

Say I have the following code:

L#
1  void main()
2  {
3    fun1()
4  }
5
6  void fun1(){
7  ...
8  }

If at L3 I type '[[' (without quotes) in command mode then vim takes
the cursor to L2.
If at L7 I type '[[' (without quotes) in command mode then vim takes
the cursor to L2. Should it not take me to L6 instead? Can anyone
suggest what setting would make vim work like latter?


you can type instead [m to get to L6

not a setting... but i find 'autocmd BufEnter *.java map [[ [m' in my .vimrc pretty useful for this


 
Cheers!

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

To unsubscribe, reply using "remove me" as the subject.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Moving to start of a block - question

Tony Mechelynck
In reply to this post by Karthick Gururaj
On 02/04/10 09:53, Karthick Gururaj wrote:
> On Fri, Apr 2, 2010 at 12:07 PM, Rajesh Kannan <[hidden email]
> <mailto:[hidden email]>> wrote:
[...]
>>     If at L3 I type '[[' (without quotes) in command mode then vim takes
>>     the cursor to L2.
[...]
> "Command mode" is what you get once you type the ':', I think you mean
> normal mode.
[...]

No, the OP was right, see ":help command-mode". Personally I prefer
using the expression "Normal mode" to avoid ambiguity but "command mode"
is a synonym. What you get once you hit the colon key in Normal mode is
command-line mode (or Cmdline mode).


Best regards,
Tony.
--
If you perceive that there are four possible ways in which a procedure
can go wrong, and circumvent these, then a fifth way will promptly
develop.

--
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
Reply | Threaded
Open this post in threaded view
|

remove me

dgerman

On Apr 2, 2010, at 5:30 PM, Tony Mechelynck wrote:

> On 02/04/10 09:53, Karthick Gururaj wrote:
>> On Fri, Apr 2, 2010 at 12:07 PM, Rajesh Kannan <[hidden email]
>> <mailto:[hidden email]>> wrote:
> [...]
>>>    If at L3 I type '[[' (without quotes) in command mode then vim takes
>>>    the cursor to L2.
> [...]
>> "Command mode" is what you get once you type the ':', I think you mean
>> normal mode.
> [...]
>
> No, the OP was right, see ":help command-mode". Personally I prefer using the expression "Normal mode" to avoid ambiguity but "command mode" is a synonym. What you get once you hit the colon key in Normal mode is command-line mode (or Cmdline mode).
>
>
> Best regards,
> Tony.
> --
> If you perceive that there are four possible ways in which a procedure
> can go wrong, and circumvent these, then a fifth way will promptly
> develop.
>
> --
> 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 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

To unsubscribe, reply using "remove me" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: remove me

Tony Mechelynck
On 02/04/10 23:54, Dennis German wrote:
>
> On Apr 2, 2010, at 5:30 PM, Tony Mechelynck wrote:
[...]

Apparently the "remove me" trick didn't work this time. AFAICT dgermang
-at- Real-World-Systems.com is not subscribed to vim_use. I suppose that
either a different "From" address was used than the one to which list
mail is sent, or that this user was removed some other way (manual
action by a list Manager, user found
http://groups.google.com/groups/mysubs and unsubscribed there, ...).


Best regards,
Tony.
--
To be sure of hitting the target, shoot first and, whatever you hit,
call it the target.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Moving to start of a block - question

iler.ml
In reply to this post by Rajesh Kannan-3
On Apr 2, 8:37 am, Rajesh Kannan <[hidden email]> wrote:

> G'Day!
>
> Say I have the following code:
>
> L#
> 1  void main()
> 2  {
> 3    fun1()
> 4  }
> 5
> 6  void fun1(){
> 7  ...
> 8  }
>
> If at L3 I type '[[' (without quotes) in command mode then vim takes
> the cursor to L2.
> If at L7 I type '[[' (without quotes) in command mode then vim takes
> the cursor to L2. Should it not take me to L6 instead? Can anyone
> suggest what setting would make vim work like latter?

Do you want to jump to th beginning of *current function*, or
tothebeginning of current *block* ? Example:

int foo()       // enclosing function
{
    if(...) {     //enclosing block
            <-     you are here
    }
}

?

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

To unsubscribe, reply using "remove me" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: remove me

Bram Moolenaar
In reply to this post by Tony Mechelynck

Tony wrote:

> On 02/04/10 23:54, Dennis German wrote:
> >
> > On Apr 2, 2010, at 5:30 PM, Tony Mechelynck wrote:
> [...]
>
> Apparently the "remove me" trick didn't work this time. AFAICT dgermang
> -at- Real-World-Systems.com is not subscribed to vim_use. I suppose that
> either a different "From" address was used than the one to which list
> mail is sent, or that this user was removed some other way (manual
> action by a list Manager, user found
> http://groups.google.com/groups/mysubs and unsubscribed there, ...).

There are two spaces between "remove" and "me"...

--
"I love deadlines.  I especially like the whooshing sound they
make as they go flying by."
                         -- Douglas Adams

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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