Vim Bang Bang
Contents
Let’s say we edit a file and we are in the 2nd line and want to do the math:
|
|
Hitting !! in normal mode puts you in command-line mode ready to type a shell command: :.!bc.
The input of the shell command will be the line where the cursor is (1+2).
It will send it to bc and by hitting Enter it will replace the line with the result:
|
|
The . means the line where the cursor is. You can pass a range if you want, let’s calculate both lines:
|
|
and the result:
|
|
Here is the vim documentation for the !! command:
|
|
You can run any shell command, convert this one line json input
|
|
to this
|
|