[NCLUG] My vimrc.
Sean Reifschneider
jafo at tummy.com
Wed Sep 11 20:52:49 MDT 2013
Here are some of the things I do with my vimrc.
.vimrc Things
=============
* set list listchars=tab:>-,trail:-
Show me tabs and trailing spaces in most cases (unless overridden).
This visually indicates them as things like ">----".
* set nrformats=alpha
This fixes the problem mentioned last night where incrementing a 07, say
in a date, cause it to go to 010 (octal 8). It will still allow you to
increment a single alpha letter.
* autocmd FileType c set tabstop=3 shiftwidth=3 softtabstop=0 smarttab
noexpandtab nolist textwidth=0
If the file is detected as C code, I disable expanding tabs, and disable
the showing of tabs as ">--", etc...
* autocmd FileType html set indentexpr=
For HTML don't re-indent lines of code as I'm typing.
* autocmd BufRead,BufNewFile /tmp/tummyblog.*.md set spell tw=75 et ts=4
spellfile=~/vim/spell/blogentry.en.add
If I'm editing a blog entry, set up a special dictionary, expand tabs,
etc...
* autocmd BufRead,BufNewFile /etc/sudoers.tmp set textwidth=0
Don't wrap lines in the sudoers file.
* autocmd BufRead,BufNewFile /tmp/*.eml source $HOME/.vimrc-thunderbird
Read a special .vimrc when I edit a message in Thunderbird.
* set background=dark
Tweak the color scheme to work better on a terminal with a dark
background.
* let mapleader = ","
Set the leader character to comma instead of backslash.
* Set macros for twiddling syntax, paste, and turn off search
highlighting::
nmap <silent> <leader>s :silent :set syntax=off<CR>
nmap <silent> <leader>S :silent :set syntax=on<CR>
nmap <silent> <leader>p :set paste<CR>
nmap <silent> <leader>P :set nopaste<CR>
nmap <silent> <leader>n :silent :nohlsearch<CR>
* nmap <silent> <leader>$ :%s/\s\+$<CR>
Remove trailing whitespace.
* set t_ti= t_te=
Do not change to an alternate terminal, so when I exit vi I still have
text I was editing on my screen.
* set modeline
Look in the first few and last lines of a file for a "vim:" line that
specifies file-specific editing parameters.
* set autoindent
Indent automatically when I start a new line, based on the code above
it.
* set backspace=1
IIRC, this allows me to backspace over the beginning of a line, but only
up to the beginning of the current editing command.
* set directory=~/.vim-tmp
Put all my backup files under my home directory. This way, when my
system locks up, on reboot I have a cron job specified by "@reboot"
timespec, which renames this directory and makes a new one, so I don't
leave .swp files all over.
* set scrolloff=1
Leave a line of padding at the top and bottom of the window, so I an see
the next/prev line when working at the edges.
* set synmaxcol=600
Perform syntax highlighting on lines up to 600 characters long.
Otherwise syntax highlighting gets confused if you are editing files
with long lines.
Sean
More information about the NCLUG
mailing list