alexyeh /.vimrc

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /tmp/crontab.* set nowritebackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /etc/pw.* set nowritebackup

" Only do this part when compiled with support for autocommands.
if has("autocmd")
  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent on
  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
    au!
    " For all text files set 'textwidth' to 78 characters.
    autocmd FileType text setlocal textwidth=78
    " When editing a file, always jump to the last known cursor position.
    " Don't do it when the position is invalid or when inside an event handler
    " (happens when dropping a file on gvim).
    autocmd BufReadPost *
          \ if line("'\"") > 0 && line("'\"") <= line("$") |
          \   exe "normal! g`\"" |
          \ endif
  augroup END
else
  set autoindent
  set smartindent
endif " has("autocmd")

"=========================================================================
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
      \ | wincmd p | diffthis
"=========================================================================

set directory=~/.vim/swp
" A few extra settings I like (^_^)

colorscheme darkblue "Nice colorscheme for 8 bit terminals.
set backspace=2         " more powerful backspacing
set ch=2		" Make command line two lines high
set enc=utf-8
set expandtab
set foldcolumn=1
set ignorecase
set incsearch
set laststatus=2 " gives every window a statusline (what emacs users call a modeline).
set mouse=a " In many terminal emulators the mouse works just fine, thus, enable it.
set mousehide		" Hide the mouse when typing text
set nohlsearch
set nosmarttab
set nowrap "best for coders
set number
set ruler		" show the cursor position all the time
set shiftround
set shiftwidth=2
set shortmess=a
set showcmd		" display incomplete commands
set showmatch
set showmode
set smartcase
set softtabstop=2
set statusline=%<%02n\ %t%(\ %m%r%y[%{&ff}][%{&fenc}]\ \ \ \ %{mode()}%)\ %a%=\ col\ %c\ \ line\ %l/%L\ \ %P
set tabstop=2
set tenc=macroman
set ul=10000 "undo up to 10,000 changes!
set vb "visual bell
set viminfo=!,'25,\"1000,n~/.viminfo "Some useful viminfo options
set wildmenu
set wildmode=full
set wildmode=list:full
syntax on
win 102 32

let Tlist_Ctags_Cmd = '/usr/bin/ctags'

" Make shift-insert work like in Xterm
map  
map!  
noremap  

" Use arrow keys for scrolling
noremap  
noremap  z
noremap  z

noremap  :so ~/.vimrc
command Preview :!firefox %

" I never use Ex mode, so why no make Q do something useful?
map Q @q
" A little correction ;)
map q: :q

"  Moving up/down by function, unfolding current function but folding all else
noremap [[  [[zMzvz.
noremap ]]  ]]zMzvz.

" Transferring blocks of text between vim sessions
nmap xr   :r $HOME/.vimxfer
nmap xw   :'a,.w! $HOME/.vimxfer
vmap xw   :w! $HOME/.vimxfer
nmap xa   :'a,.w>> $HOME/.vimxfer
vmap xa   :w>> $HOME/.vimxfer
nmap xy   :'a,.y *
vmap xy   :y *