From a given cursor position, how can I move vertically to the next non-whitespace character (in the same column), whether up or down?

Since I highly doubt this is a built-in motion command (if it is then great!), how can I map Ctrl-K and Ctrl-J to do this?

(This is inspired by the Excel feature, oddly enough.)

For a bonus: Make g followed by Ctrl-K and Ctrl-J work on soft-wrapped columns. Far less critical but it would be cool.

  • 4
    vi.stackexchange.com/questions/120/…? – muru May 16 '17 at 6:39
  • Do you want the cursor to skip past the current vertical "word", like the w motion (as implied by your title)? If so then this isn't a duplicate of the question muru links to (although it's obviously closely related), but I think you could clarify this in the question body. – Rich May 16 '17 at 13:25
  • @Rich good question. Yes, if currently on non whitespace I want to go past the next batch of white/empty columns to start of next "word," exactly like w command and b. – Wildcard May 16 '17 at 13:45
  • Hmm, missed the link before, this does look like a duplicate to me. How is this different from the linked question? – Antony May 16 '17 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.