Tagged: vi

Change Default Editor at System Level

In a terminal type sudo apt-get install vim sudo update-alternatives –config editor Follow the instructions to choose vim.basic – your display will vary Debian Ubuntu Change Default Editor Nano VI Gedit at System Level sudo vi /etc/vim/vimrc uncomment line 20 – syntax on logout & login

VI Delete All Matching Lines

Delete all matching lines containing a string :g/46.223.1./d Replace all matching text in a file :.,$s/wrong/right/

vi cheat sheet

Command of the day :.,$s/find-this-string/replace-with-this-string/g     Quitting :x Exit, saving changes :wq Exit, saving changes :q Exit as long as there have been no changes ZZ Exit and save changes if any have been made :q! Exit and ignore any changes Motion h Move left j Move down k Move up l Move right w Move to next word...

Enable VI Colors on Debian 7 Wheezy

Debian and VI are different than other distros, such as Ubuntu. I found all kinds of other/newer advice that did not work. Hopefully this will save someone else some time beating around the Interbushes. Pre-requisite: If you have not already, install vim sudo apt-get install vim sudo vi /etc/profile Add this line to the end of the file alias vi=’vim’...