Posts [ 8 ]

Re: [[ and ]]

Howdy folks, I have a quick question. I noticed [[ and ]] use column zero to move between curly brackets. Can I use the same command on other columns? I tried but it didn't work. I guess I'm trying to find a quick way to move through blocks of code inside classes. I did a find and move next on { and then % to flip flop but didn't know if I could change the behavior of [[ and ]] too move to the next level of curly brackets. Thanks

Re: [[ and ]]

Hi Paul,

The column-0 behavior is implemented the same as in vi and vim. [[ and ]] in vi and vim, actually, understand other interpretations of a 'section', such that they look for certain patterns of parentheses in lisp source, and also understand form-feed characters. That behavior is not implemented in ViEmu (yet).

One option you might have overlooked are the [{ and ]} motions, implemented in ViEmu, which move to the previous/next unmatched open/close brace. It's not exactly what you are looking for, but it may help.

If anyone else knows about a quick way to do what you want in vi/vim, I'll be happy to learn about it and make sure ViEmu supports it.

Re: [[ and ]]

Thanks for the quick response. I didn't know if there was another shortcut. I've been using find on either { or 'public', 'protected', etc. to quickly move from function to function. I just wanted to see if there was a shortcut I didn't know about. My Vim is a little rusty but already I've saved so much time editing.

Re: [[ and ]]

JNG wrote:

Hi Paul,

The column-0 behavior is implemented the same as in vi and vim. [[ and ]] in vi and vim, actually, understand other interpretations of a 'section', such that they look for certain patterns of parentheses in lisp source, and also understand form-feed characters. That behavior is not implemented in ViEmu (yet).

One option you might have overlooked are the [{ and ]} motions, implemented in ViEmu, which move to the previous/next unmatched open/close brace. It's not exactly what you are looking for, but it may help.

If anyone else knows about a quick way to do what you want in vi/vim, I'll be happy to learn about it and make sure ViEmu supports it.

Can I specify a column number when searching? For example if I could do /{ but limit it to only look in a certain column number I could jump from function to function. Wasn't sure if that is something I could do. Thanks

Re: [[ and ]]

There is support in vim's regular expressions for a specific column #:

/\%4c{

would only match an opening brace at column 4. But ViEmu's regular expression engine doesn't (yet) support it. On the other hand, I think it's not comfortable.

I think something different is necessary for what you are asking. I'd be willing to implement something along the line, accessible as g} and g{ for example, but I'd need a good definition of what is needed.

And you want to move along the 1's and 2's... am I right? g{ and g} may accept a count of how many indent levels or spaces to look for, but I'm not sure that's what you need. Can you come up with a pattern so that it will be reasonably simple to find?

Re: [[ and ]]

Thanks for the quick response. The pattern you described is what I'm looking for.

{ ......... { //1 ............ } //end 1

{ //2 ......... } //end 2}

What I'm looking for is a way to jump from //1 to //2 etc. Doing mainly C# these days [[ ]] gives me the brackets for the namespaces but if I could specify a column I could jump to the depth I need whether it be moving from class to class or function to function. Let me know if that helps. Thanks.

Re: [[ and ]]

I'll give a try to Ng} and Ng{ where N is the number of spaces (with tabs counted as the number of spaces they represent). g} and g{ then would just do the same as ]] and [[. I'll let you know when it's ready.