Function arguments broken over multiple lines with heavy indent don't match as expected
Given:
foobar(hello, world,
foo, bar)
Typing: jffdaa
I expect:
foobar(hello, world,
bar)
But what I get is:
foobar(hello, world,
foo)
@hgiesel: Thanks for this issue. The reason for this behavior is how by default a match within the cursor line is preferred over a multiline match. In this case , bar) is within the cursor line, while , foo, is not.
This can currently be disabled by setting the seekRanges option, see https://github.com/wellle/targets.vim#gtargets_seekranges
Prefer multiline targets around cursor over distant targets within cursor line:
let g:targets_seekRanges = 'cc cr cb cB lc ac Ac lr lb ar ab lB Ar aB Ab AB rr ll rb al rB Al bb aa bB Aa BB AA'
I do agree that this is counter intuitive in this example though. For context, this is an example which motivated the default settings:
func a(b) {
return c(b)
}
With the cursor on return, typing cib I want to change the b in c(b), not the full function body within {}. The key difference to your example is that here the target within the cursor line is fully contained within the multiline target. In your example that is not the case (the multiline target does not contain the one in the cursor line), so one could argue that it's somewhat more distant there. So I'm thinking of a way to do something in between, where it would still select the cursor line target in my example, but the multiline target in your example.