home ~ socials ~ projects ~ rss

Execute A Shell Command On Multiple Lines In Neovim

August 2023

This is how you do it with hitting ":" but you can just hit "!" and not have to type it.

  1. Add some text
  2. Select it visually
  3. Hit the :

    It'll show something like:

    '<,'>

  4. Add a ! then the command you want to run. For example, this sorts the selected lines:
'<,'>! sort
end of line
Share link:
https://www.alanwsmith.com/en/2t/a7/me/7f/?execute-a-shell-command-on-multiple-lines-in-neovim