| Purpose | Command |
|---|---|
| How to open a file in Vim | vim test.txt |
| Open file in Insert Mode | vim -c "normal i" test.txt |
| Save a file and then exit | vim -c "wq" test.txt |
| Copy the current line | vim -c "normal yy" test.txt |
| Cut/Delete Current Line | vim -c "normal dd" test.txt |
| Paste after the cursor | vim -c "normal p" test.txt |
| searches for "Linux" in test.txt | vim -c "/Linux" test.txt |
| Replace word | vim -c "%s/old_text/new_text/g" test.txt |
The vim tool contains almost all possible options that you may combine in a single command.
Use the options above that are only required (carefully).
The generated command should update real time.
Once done, copy the command to your terminal.