How To Move in vim Using the Keyboard

Author: , March 21st, 2018

h move one character left j move one row down k move one row up l move one character right w move to beginning of next word b move to previous beginning of word e move to end of word W move to beginning of next word after a whitespace B move to beginning of […]

How To Find Non-ASCII Characters in Vi

Author: , July 7th, 2015

To search for non-ASCII characters: /[^\d0-\d127] Use the substitute function to clean them up: :%s/[^\d0-\d127]/ /g

How To Fix Indentation in Vi

Author: , July 30th, 2014

gg=G gg to get to the top of the file, = to indent, and G to the go to the end of the file.

How To Delete Blank Lines Using vim

Author: , June 19th, 2014

1 :g/^$/d :g/^$/d

How To Change Cursor-position-based Window Scrolling In VIM

Author: , September 30th, 2011

To force VIM to keep the cursor vertically centered in the window while the text scrolls, place this directive in your ~/.vimrc file: 1 set so=999 set so=999 To disable it, comment the line out with a double-quote or remove it completely: 1 "set so=999 “set so=999

How To Turn Off Auto-Comment In Vim

Author: , September 29th, 2011

Put the following line in your .vimrc file: autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o Or, use this one-off command when in VIM: :set formatoptions-=c formatoptions-=r formatoptions-=o

How To Enable A Repo Using Perl

Author: , September 4th, 2011

Normally, I have to specify the desired repo on the command line: yum –enablerepo=remi,remi-test install {package name here} To enable the Remi repo so you do not have to specify it on the command line: # perl -pi -e ‘s/enabled=0/enabled=1/g’ /etc/yum.repos.d/remi.repo To disable the Remi repo so you do not have to specify it on […]