How To Diff Two Files In Vim

Author: , February 5th, 2024

shell> vim file1 file2 Create a vertical split window: Control-w v Enable visual diff on the left side: :diffthis Move the cursor to the right side buffer: Control-w Right-arrow Enable visual diff on the left side: :diffthis You should now see the differences highlighted on both sides.

How To Disable VIM Mouse Automatic Visual Mode

Author: , July 27th, 2021

Current Session:

All Sessions: Add the following to your ~/.vimrc file:

How To Disable Automatic Comment Insertion In VIM

Author: , August 6th, 2020

Disable NOW in vim:

To disable auto-comments permanently, add the following line to ~/.vimrc:

To see the current settings:

Visit https://vim.fandom.com/wiki/Disable_automatic_comment_insertion for more information!

How To Force vim to Convert Tabs to Spaces

Author: , November 26th, 2019

To create indents with 4 space characters which are entered by pressing the TAB key:

To make the above settings permanent add to your ~/.vimrc file. For more details on any of these see :help ‘optionname’ in vim (e.g. :help ‘tabstop’) tabstop The width of a hard tabstop measured in “spaces” — effectively the […]

How To Prevent Vim From Auto-Commenting New Lines

Author: , August 4th, 2019

To prevent vim from added net comments, edit the .vimrc file in your home directory, and add:

How To Reformat or Re-indent Files in VIM

Author: , January 11th, 2019

In the normal vim mode, typing gg=G will reindent the entire file. == will re-indent just the current line. http://vim.wikia.com/wiki/Fix_indentation

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 Diff Two Files With SSH/SCP Using VimDiff

Author: , February 3rd, 2015

vimdiff /path/to/file.css scp://yourHost.com//path/to/file.css

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.