Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

Vimrc Examples

News See Also Recommended Links Reference .exrc Humor History Etc
"--- _vimrc -------------------------------------------------------------------
"function: Vim initialization file
"credits:  FVu

   " Configure CTRL-hjkl keys to move between windows in (miniBufExplorer plugin)
let g:miniBufExplMapWindowNavVim = 1
  " Configure CTRL-arrow keys to move between windows (miniBufExplorer plugin)
let g:miniBufExplMapWindowNavArrows = 1
   " Configure (SHIFT)-CTRL-TAB to switch through open windows (miniBufExplorer plugin)
let g:miniBufExplMapCTabSwitchBuffs = 1
   " Point to location of exuberant ctags utility
let Tlist_Ctags_Cmd="C:/Windows/System32/ctags.exe"
   " Use Vim's extended capabilities
set nocompatible
   " Default to window of 101 x 50
set lines=50
set columns=101
   " Enter 'Visual' mode when selecting text with mouse
behave xterm
   " Use windows clipboard for 'unnamed' register
set clipboard+=unnamed
   " Set indents to a 3 space width
set shiftwidth=2
set tabstop=2
   " Use indentation from current line when starting a new line
set autoindent
   " Allow backspacing over everything in insert mode
set backspace=indent,eol,start
   " Move cursor to matched string, while typing search string
set incsearch
   " Set alternate caption of VIM window: <filename> (<path>)
set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
   " Add additional file types
"let myfiletypefile = "$VIM/myFileTypes.vim"
   " Add additional syntax files
"let mysyntaxfile = "$VIM/mySyntaxFile.vim"
   " Allow for syntax highlighting
syntax on
   " Include additional commands when editting HTML or ASP files
:autocmd FileType html,php,embPerl,xml   call FileType_Html()
   " Include additional commands when editting POD files
:autocmd FileType pod                   call FileType_Pod()
   " Set directory for swap files
set directory=E:/Tmp/Vim
   " Show cursor position all the time
set ruler
   " Display incomplete commands
set showcmd
   " Use silent (-s) make, to avoid echo'd commands being interpreted as errors
set makeprg=make\ -s
   " Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc>

   " 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

  " 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

endif " has("autocmd")

"--- FileType_Html() ----------------------------------------------------------
"function: Set additional Vim configurations when editting HTML or ASP files.
"credits:  20001008, FVu

function FileType_Html()
   echo $VIM
      " Use additional macros from 'closeTag.vim'
   so $VIM/vimfiles/closeTag.vim
      " Use additional macros from 'xmlEdit.vim'
   so $VIM/vimfiles/xmledit.vim
      " Expand tabs to spaces
   set expandtab
endfunction  " FileType_Html()


"--- FileType_Pod() -----------------------------------------------------------
"function: Set additional Vim configurations when editting POD files.
"credits:  20010620, FVu

function FileType_Pod()
      " Expand tabs to spaces when editing POD files
   set expandtab
      " Set indents to a 4 space width
   set shiftwidth=4
   set tabstop=4
endfunction  " FileType_Html()


Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Disclaimer:

Last modified: August 14, 2009