Is there a way in Vim in which I could navigate to the next differing indent level?
So from here to there for example:
-> var a = 1;
var b = 2;
var func = function(){
-> return a + b;
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This should work for indents made up of spaces (not tabs):
This is made up of two regular expressions:
^ \{0,'.eval(indent(".")-1).'}\Smatches a smaller indent, using the\{n,m}construction matching fromntomof the preceding space.^ \{'.eval(indent(".")+1).',}\S'matches a larger indent, using the\{n,}construction matching at leastnof the preceding space.The regexes are sandwiched between
^and\Sto apply only to the leading whitespace on the line. Then they are joined by the\|(‘OR’) operator.Of course the
search()call could be mapped to a key combination for convenience.EDIT
Chris Johnsen points out that the calls to
eval()are superfluous, so the command can be reduced to this: