Created
November 8, 2010 21:46
-
-
Save jreyes1108/668330 to your computer and use it in GitHub Desktop.
vimrc config file for VI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" VIMRC | |
" | |
" To use: copy to ~/.vimrc | |
" | |
" | |
" Last updated: 6/2009 | |
" Author: Juan C. Reyes | |
" [email protected] | |
" | |
"============================================================================ | |
" General settings | |
"============================================================================ | |
set nocompatible " Turn off vi compatibility | |
set undolevels=1000 " Lots and lots of undo | |
set history=50 " Size of :command history | |
set modelines=20 | |
set modeline " Turn on modelines | |
set showcmd " Display incomplete commands | |
set showmatch " Show matches on parens, bracketc, etc. | |
set visualbell | |
set noerrorbells | |
" Show hidden characters | |
" This will display tabs like >--- | |
" and a $ at the end of the line. | |
" To use type :set list | |
set list listchars=tab:>-,eol:$ | |
set list | |
set smartindent " smart indent | |
" About working with automatic indenting: | |
" -Any time you act on a line in an edit session with automatic indenting and | |
" you change that line's indentation manually, Vim flags that line and will | |
" no longer try to automatically define its indentation. | |
" -When you paste text into your file where automatic indenting is turned | |
" on, Vim considers this regular input and applies all automatic indentation | |
" rules. | |
set nobackup " do not keep a backup file, use versions instead | |
set ruler " show the cursor position all the time | |
set number " show the line number | |
" allow backspacing over everything in insert mode | |
set backspace=indent,eol,start | |
" Enable folding by fold markers | |
set foldmethod=marker | |
" Autoclose folds, when moving out of them | |
"set foldclose=all | |
" Fold methods are automatically saved | |
au BufWinLeave * mkview | |
au BufWinEnter * silent loadview | |
"============================================================================ | |
" Colorscheme | |
"============================================================================ | |
filetype on | |
syntax on | |
colorscheme default " blue, darkblue, default, delek, desert, elflord | |
" evening, koehler, morning, murphy, pablo, | |
" peachpuff, ron, shine, slate, torte, zellner | |
set background=light " dark or light | |
filetype plugin indent on " Enable file type detection. | |
" | |
" Set syntax on non-standard files | |
au BufRead,BufNewFile *.xpy set filetype=python | |
au BufRead,BufNewFile *.xpl set filetype=perl | |
au BufRead,BufNewFile *.pf set filetype=tcsh | |
"============================================================================ | |
" Tab standards. | |
"============================================================================ | |
"Sorry, 8 spaces are too much for nested loops! | |
set softtabstop=4 | |
set tabstop=4 | |
set shiftwidth=4 | |
set shiftround " indent/outdent to nearest tabstops | |
set expandtab " enter spaces when tab is pressed | |
"============================================================================ | |
" Statusline | |
"============================================================================ | |
set laststatus=2 " Always put a status line | |
"============================================================================ | |
" Search and Replace | |
"============================================================================ | |
set noincsearch " Don't show partial matches as search is entered | |
set hlsearch " Highlight search patterns | |
set ignorecase " Ignore case distinction when searching | |
set smartcase " ... unless there are capitals in the search string. | |
"set nowrapscan " Don't wrap to top of buffer when searching | |
"============================================================================ | |
" Commands | |
"============================================================================ | |
" Convenient command to see the difference between the current buffer and the | |
" file it was loaded from, thus the changes you made. | |
if !exists(":CompOrig") | |
command CompOrig vert new | set bt=nofile | r # | 0d_ | diffthis | |
\ | wincmd p | diffthis | |
endif | |
" call make on folder | |
nnoremap <F4> :!make install<cr> | |
" | |
" Paste toggle - when pasting something in, don't indent. | |
set pastetoggle=<F5> | |
" | |
" cycle through list mode | |
nnoremap <F6> :set list!<cr> | |
" | |
" cycle through number mode | |
nnoremap <F7> :set number!<cr> | |
" | |
" cycle through split windows, and <Shift>+<F6> to cycle backwards | |
nnoremap <F8> <C-W>w | |
nnoremap <S-F8> <C-W>W | |
" make tab in v mode ident code | |
vmap <tab> >gv | |
vmap <s-tab> <gv | |
" make tab in normal mode ident code | |
nmap <tab> I<tab><esc> | |
nmap <s-tab> ^i<bs><esc> | |
map <Space> :call SmoothPageScrollDown()<CR> | |
map <S-Space> :call SmoothPageScrollUp()<CR> | |
" When editing a file, always jump to the last known cursor position. | |
autocmd BufReadPost * | |
\ if line("'\"") > 1 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
" Restore the screen when we're exiting | |
if &term == "xterm" | |
let &t_ti = "\<Esc>[?47h" | |
let &t_te = "\<Esc>[?47l" | |
endif | |
"============================================================================ | |
" MODES | |
"============================================================================ | |
au FileType text call TextMode() | |
au FileType mail call TextMode() | |
au FileType perl call PerlMode() | |
au FileType python call PythonMode() | |
"============================================================================ | |
" Functions | |
"============================================================================ | |
function! TextMode() | |
set nosmartindent " Don't indent | |
set noshowmatch " Don't show matches on parens, brackets, etc. | |
set comments=n:>,n:#,fn:- " List of things to be treated as comments | |
set formatoptions=tcrq " Word wrap, format comments | |
endfunction | |
function! PythonMode() | |
set list | |
set nosmartindent " Don't "smart" indent | |
set cindent " Use C-indenting | |
"CINDENT options. | |
"set cinkeys=0{,0},!^F,o,O,e " Perl-friendly reindent keys | |
"set cinoptions=t0,+4,(0,)60,u0,*100 " All sorts of options | |
"set cinwords=if,else,while,do,for,elsif,sub | |
"set comments=n:# " Perlish comments | |
"set formatoptions=oncrql " Word wrap, format comments | |
endfunction | |
function! PerlMode() | |
set list | |
set nosmartindent " Don't "smart" indent | |
set cindent " Use C-indenting | |
"CINDENT options. | |
"set cinkeys=0{,0},!^F,o,O,e " Perl-friendly reindent keys | |
"set cinoptions=t0,+4,(0,)60,u0,*100 " All sorts of options | |
"set cinwords=if,else,while,do,for,elsif,sub | |
"set comments=n:# " Perlish comments | |
"set formatoptions=oncrql " Word wrap, format comments | |
colorscheme default " blue, darkblue, default, delek, desert, elflord | |
" evening, koehler, morning, murphy, pablo, | |
" peachpuff, ron, shine, slate, torte, zellner | |
" Very usefull... | |
" This will check the syntax of the script and then exit without executing it. | |
" To use... :make name_of_script | |
au FileType perl set makeprg=perl\ -c\ -I\"\$ANTELOPE/data/perl\"\ $* | |
"access the perl documentation and faq. Use 'K' over word | |
au FileType perl :noremap K :!perldoc <cword> <bar><bar> perldoc -f <cword><cr> | |
"let perl_fold=1 | |
let perl_include_pod=1 | |
" syntax color complex things like @{${"foo"}} | |
let perl_extended_vars = 1 | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment