2

I want to select (e.g. to comment/uncomment) entire functions at a time in Neovim using the built-in LSP. I do this now by avoiding empty lines in functions so that I can vap to select the entire block, but this does not scale well to larger functions where spaces improve readability. I'd like for the editor to recognize and select entire functions.

How to use Neovim to do this?

1
  • What is the programming language you are using? Nov 25, 2023 at 0:56

1 Answer 1

1

v]M should select until the end of function. whether it works correctly, might depends on the language and the exact case.

Some plugins may implement this. Even some syntax files, I think. Another option is to rely upon ]= to select all lines that are of the same indentation.

'jeetsukumaran/vim-indentwise'

implements it.

I also think vim-targets has vaF to select functions. Not sure about implementation. I don't think it is related directly to LSP, though I might be surprised.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.