I've been authoring a lot of F# in Vim lately. Like Python it is pretty strictly indentation-based. However, unlike Python mode for Vim, it does not appear that the standard F# Vim plugin supports any kinds of motions. I would like the ability to rapidly navigate over modules and functions, in the spirit of what is done with motions for classes and functions in Python mode:
[M Jump to previous class or method (normal, visual, operator modes) ]M Jump to next class or method (normal, visual, operator modes) aC Select a class. Ex: vaC, daC, yaC, caC (normal, operator modes) iC Select inner class. Ex: viC, diC, yiC, ciC (normal, operator modes) aM Select a function or method. Ex: vaM, daM, yaM, caM (normal, operator modes) iM Select inner function or method. Ex: viM, diM, yiM, ciM (normal, operator modes)
So specifically, given some code like this:
module Foobar =
let private foo'() =
bar'()
|> baz'()
|> qux'()
let foo() =
bar()
|> baz()
|> qux()
I would like to be able to quick jump to the beginning and end of functions and modules.
I can write some code to do this based on Python mode, but before jumping to that I was wondering, since Vim comes with so many motions built in, Is there a way to say, "move to the first place where there is a nonblank line that is set back n indentation levels from current line"?
I have not been able to find anything, maybe because Vim was built originally more for C-style code, but I wanted to know if there was any existing functionality (or existing plugin for that matter) that handled this case, because if so that would probably take care of 95% of what I need without having to implement the motions for F#-specific semantics.