_vimrc
syn on colors koehler set ic set incsearch set hls set nu set nowrap set sw=4 set ts=4 set ai set bs=2 set tw=0 set colorcolumn=80 set nobackup autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif
On Windows, save it as %USERPROFILE%\_vimrc (that's underscore vimrc). On Linux and Mac it's .vimrc, and the dot hides the file from view with most utilities.
The Settings
syn on | Enable syntax highlighting |
colors koehler | Colorscheme: koehler |
set ic | Ignore case when searching |
set incsearch | Incremental search |
set hls | Highlight search results |
set nu | Display line numbers |
set nowrap | Don't wrap lines |
set sw=4 | Compress tabs |
set ts=4 | Compress tabs |
set ai | Automatically indent |
set bs=2 | Allow backspaces |
set tw=0 | Auto-wrap (disabled) |
set colorcolumn=80 | Highlight column 80 |
set nobackup | Omit~ annoying~ backup~ files~ |
Most of these are self-explanatory, but here are some details on selected items.
colors
There are other colorschemes. They're located in %ProgramFiles(x86)%\Vim\vim74\colors and Torte is a nice one.incsearch
Move the screen to display search hits as the search string is typed? Yes, please.tw=0
This was buried in my vimrc. With the setting at zero, it is disabled. But when the setting is something else, Vim automatically wraps lines to keep them at that setting or less in length. So, if you need to write Linux kernel code (to a strict 79-column limit), this can help keep you in line.colorcolumn=80
Paint a line down the 80th column. Again, keeping you in line in case you work with a bunch of kernel code-developing 79-column nazis (Jon, just kidding, actually I respect your coding style).
nobackup
Vim automatically writes annoying backup files named after the file you were editing with a tilde appended to them. They're a good idea, but they clutter the filesystem, and if you're a web administrator, they leave potential source code disclosure vulnerabilities lying around.
The autocmds
autocmd FileType python ...
Sets tab settings to read and write Python scripts the way most other developers expect them to be read and written. Since Python is sensitive to whitespace, this can be useful for keeping the files parseable by the Python interpreter.
autocmd BufReadPost *...
Puts the cursor in the position where it was when you last read the file (if you have ever read the file before).
Sets tab settings to read and write Python scripts the way most other developers expect them to be read and written. Since Python is sensitive to whitespace, this can be useful for keeping the files parseable by the Python interpreter.
autocmd BufReadPost *...
Puts the cursor in the position where it was when you last read the file (if you have ever read the file before).
Fin
Lazyblog, signing out. G'nite.