When VIM starts up, it reads your personal settings before it does anything interesting.
To create personal settings, you can edit a file named
.vimrc
in your home directory.The instructions up until now give you enough information that you should be able to edit your .vimrc file and add all the commands listed below.
The idea is to enter the commands in the leftmost column of the table.
You will have to type them, and correct any spelling errors.
Once the file has been created, you will save and exit and the next you start VIM it will have your settings.
You can edit this file at any time.
There is very fine magic in VIM. However, it often comes without the magic turned on. Command line completion, color syntax highlighting, the file explorer, and many other features are "missing" unless you turn them on in
~/.vimrc
.There is a very nice guide to the various settings in vim, and even an interactive display so that you can turn them on and off. This is not very well-known, I suspect, because I only learned it this year. I wish I had known when I was first starting.
:options |
:browse options |
:browse set |
In this window, you can browse through all the available options, and can even set them. You can read the short help messages associated with each, or you can hit the enter button on any short help to see the longer help text. If you press the enter key on an option, it will toggle that option or set a new value.
Each of these commands has a shortcut, but you can learn those later.
Try entering just the first five commands (one-per-line), save the file, and then edit it again to add the other commands.
You will find that the second session will have color syntax highlighting, and will give you more hints and help as you work.
Command in .vimrc | Meaning |
---|---|
syntax enable | turn on all the magic, including Explorer and syntax highlighting |
set showmode | Show me when I'm in insert/overtype mode |
set showcmd | When a command is in progress, show it in the status bar |
set wildmenu | magic for completion at the : command line. |
set ruler< | turn on the "ruler" (status info) at the bottom of the screen. |
runtime ftplugin/man.vim | Turn on man pages (type :Man |
set autoindent | indent in a smart way, instead of returning to the left margin all the time |
set expandtab | expand tabs to spaces |
set nowrap | Don't wrap text (makes windows ugly) |
set hlsearch | Highlight all matches in text when you search |
set showmatch | Show matches for braces, parens, etc. |
set ignorecase | do case-insensitive searching |
set smartcase | When a search phrase has uppercase, don't be case insensitive |
set path=.,..,/usr/include/**,/usr/share/** | Tell the editor where to search for files |
set spelllang=en_us | when I want spell-checking, I want it to be english |
No comments:
Post a Comment