How to insert the contents of a file in VI
Friday, February 27th, 2009To insert the contents of a file called /tmp/myfile.txt below the cursor, type: :r /tmp/myfile.txt or :read /tmp/myfile.txt
To insert the contents of a file called /tmp/myfile.txt below the cursor, type: :r /tmp/myfile.txt or :read /tmp/myfile.txt
To change VIM’s current working directory, type: :cd NEW_DIRECTORY To display the current working directory, type: :pwd To change the working directory to that of the file that is open at the moment, type: :cd %:h
I find vim’s matching parenthesis highlighting feature useful, but the default colors drive me nuts! It highlights the matching brace/bracket so vividly, I keep on getting confused with the cursor position! Here are a few solutions to this annoyance. Change the matching parenthesis font color and/or text-style To customize the font color, background color and/or [...]
This is a quick tip for Linux/UNIX users who are familiar with the vi editor. Here’s how to remove those annoying ^M characters, that show up at the end of lines, in files that were created or modified in DOS/Windows. Open the file using vi, and type: :%s/[CTRL+v][CTRL+m]//g The [CTRL+v][CTRL+m] means holding down the CTRL [...]