Code:
" ==== settings ====
syn on " Turn on syntax highlighting
set nocompatible " Allow for a lot more options
set expandtab " When you hit tab actually use spaces
set history=50 " keep 50 lines of command line history
set hlsearch " Switch on highlighting of the last used search pattern
set ignorecase " On searches
set smartcase " Works with ignorecase
set laststatus=2 " Make sure the status line is always displayed
set nobackup " Do not create backups
set nocompatible " Better for Vim features
set nu " turn on line numbers
set ruler " Display ruler
set shell=/bin/ksh " Set default shell
set showcmd " Show commands
set showmatch " Shiow matching brackets
set showmode " Display what mode you are in
set smartindent " Turn on file typed indenting
set tabstop=4 " Number of spaces when converting tabs
set shiftwidth=4 " Characters added for indentation
set viminfo='1000,f1,<500 " File information to Keep
set backspace=indent,eol,start " Expected backspace behavior
set pastetoggle=<F2> " Allows for proper pasting when indents would occur.
set background=dark " This is set for white on black
retab " When you open a file, convert all the tab characters into spaces.
" ==== Folding ====
" Disable folding by default, we'll enable it with a hotkey
function ForceFoldmethodIndent()
if &foldenable
se foldmethod=indent
endif
endfunction
nnoremap <F9> zi|call ForceFoldmethodIndent()
inoremap <F9> zi|call ForceFoldmethodIndent()
set nofoldenable " Disable folding by default, we'll enable it with a hotkey
" ==== File based settings ====
filetype plugin on
filetype indent on
if has("autocmd")
" Restore cursor position
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
" Filetypes (au = autocmd)
au FileType helpfile set nonumber " no line numbers when viewing help
au FileType helpfile nnoremap <buffer><cr> <c-]> " Enter selects subject
au FileType helpfile nnoremap <buffer><bs> <c-T> " Backspace to go back
" Rexx
au BufRead,BufNewFile *.zrx setfiletype rexx
au BufRead,BufNewFile *.rx setfiletype rexx
au BufRead,BufNewFile *.rexx setfiletype rexx
" C types - Set coding indents
au FileType cpp,c,java,sh,pl,php,asp set autoindent
au FileType cpp,c,java,sh,pl,php,asp set smartindent
au FileType cpp,c,java,sh,pl,php,asp set cindent
" Text files
au BufRead,BufNewFile *.txt setfiletype txt
au BufRead,BufNewFile *.log setfiletype txt
au BufRead,BufNewFile *.vcf setfiletype txt
" Automatically chmod +x Shell and Perl scripts
"au BufWritePost *.sh !chmod +x %
"au BufWritePost *.pl !chmod +x %
" File formats
" Misc types
au BufNewFile,BufRead *.pls set syntax=dosini
au BufNewFile,BufRead modprobe.conf set syntax=modconf
au BufNewFile,BufRead *.d set syntax=dtrace
" Shell scripts
endif
" ==== HUD ====
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set listchars=tab:\|\ ,trail:�,eol:<
" ==== Version 7 related ====
if version >= 700
"set spell " turn on spell check
au InsertEnter * hi StatusLine term=reverse ctermbg=5 gui=undercurl guisp=Magenta
au InsertLeave * hi StatusLine term=reverse ctermfg=0 ctermbg=2 gui=bold,reverse
endif
" DOS to Unix conversion (remove ^M)
" added mark (m) so we end up where we started
noremap <Leader>D mmHmt:%s/<C-V><CR>//ge<CR>'tzt'm
" Fixes color on AIX 5.3
if has("terminfo")
let &t_Co=8
let &t_Sf="\e[3%p1%dm"
let &t_Sb="\e[4%p1%dm"
else
let &t_Co=8
let &t_Sf="\e[3%dm"
let &t_Sb="\e[4%dm"
endif
" Fix for delete when it doesn't work right on AIX...
map! ^[[3~ <BS>