Alot of the more useful features on vim are not initially turned on. Using the vim config file, you can turn on these features, and you can shape/configure vim to your preferences. A configuration file or a config file arranges the settings for a computer program. These types of files can modify settings, and be set to run specific commands during the startup of the program. The configuration file for VIM is written in ASCI.
Where to find the vim configuration file:
The vim configuration file can be found in your home directory with the following command:
ls -la
The vim config file will be labeled ".vimrc", and it can be edited by using the command:
vim .vimrc
From this editing screen you can add as many features/commands as one may please to vim. Every command/feature gets its own separate line. For example you shouldn't put a command like spell check on the same line as a command for indentation.
The vim config file is sourced/applied everytime you open vim. The vim source file is sourced by default. Any other file used would have to be manually sourced from vim using the command ":so <filename>.vim" while vim is in command mode.
Some cool features:
Are you horrible at spell checking?:
set spell
Are your indents not automatic?:
set autoindent
To set indentation to a certain # of characters:
set shiftwidth=<#>
Aren't line numbers helpful when trying to find the right line?:
set number
Do you hate those annoying backup files clogging up your directory?
set backupdir=~/.vim/backup,/tmp
Want to set the tab stop to certain amount x spaces?
set ts=x
Have you ever searched for something in vim and wanted to see pattern matches as you typed?:
set incsearch
Want to make searching even easier?
set ignorecase
set smartcase
(These two options, when set together, will make
/
-style searches case-sensitive only if there is a capital letter in the search expression. *
-style searches continue to be consistently case-sensitive.)want vim to remember a longer history? (say X number of commands?)
set history=X by default, vim only remembers the last 20 commands
Is your background dark and you can't see your text? (Lighten your text with)
set background=dark
Is your background light and you can't see your text? (Darken your text with)
set backgorund=light
And we ALL want to use our mouse in vim:
set mouse=a
your entries should look something like this:
When you are satisfied with your configurations, Exit inset mode, go to command mode, and then type in:
:wq
If you later wish to change some settings, or add new settings, simply go back into the .vimrc file again.
If you want to delete a setting simply delete the line it is located in from vimrc