Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 207 lines (162 sloc) 5.853 kB
d9da825 @garybernhardt Initial commit
authored
1 " An example for a vimrc file.
2 "
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
4 " Last change: 2002 Sep 19
5 "
6 " To use it, copy it to
7 " for Unix and OS/2: ~/.vimrc
8 " for Amiga: s:.vimrc
9 " for MS-DOS and Win32: $VIM\_vimrc
10 " for OpenVMS: sys$login:.vimrc
11
12 " When started as "evim", evim.vim will already have done these settings.
13 if v:progname =~? "evim"
14 finish
15 endif
16
17 " Use Vim settings, rather then Vi settings (much better!).
18 " This must be first, because it changes other options as a side effect.
19 set nocompatible
20
21 " Allow backgrounding buffers without writing them, and remember marks/undo
22 " for backgrounded buffers
23 set hidden
24
25 " Remember more commands and search history
26 set history=1000
27
28 " Make tab completion for files/buffers act like bash
29 set wildmenu
30 set wildmode=list:longest
31
32 " Make searches case-sensitive only if they contain upper-case characters
33 set ignorecase
34 set smartcase
35
36 " Keep more context when scrolling off the end of a buffer
37 set scrolloff=3
38
39 " Store temporary files in a central spot
40 set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
41 set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
42
43 " allow backspacing over everything in insert mode
44 set backspace=indent,eol,start
45
46 if has("vms")
47 set nobackup " do not keep a backup file, use versions instead
48 else
49 set backup " keep a backup file
50 endif
51 set history=50 " keep 50 lines of command line history
52 set ruler " show the cursor position all the time
53 set showcmd " display incomplete commands
54 set incsearch " do incremental searching
55
56 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
57 " let &guioptions = substitute(&guioptions, "t", "", "g")
58
59 " Don't use Ex mode, use Q for formatting
60 map Q gq
61
62 " This is an alternative that also works in block mode, but the deleted
63 " text is lost and it only works for putting the current register.
64 "vnoremap p "_dp
65
66 " Switch syntax highlighting on, when the terminal has colors
67 " Also switch on highlighting the last used search pattern.
68 if &t_Co > 2 || has("gui_running")
69 syntax on
70 set hlsearch
71 endif
72
73 " Only do this part when compiled with support for autocommands.
74 if has("autocmd")
75
76 " Enable file type detection.
77 " Use the default filetype settings, so that mail gets 'tw' set to 72,
78 " 'cindent' is on in C files, etc.
79 " Also load indent files, to automatically do language-dependent indenting.
80 filetype plugin indent on
81
82 " Put these in an autocmd group, so that we can delete them easily.
83 augroup vimrcEx
84 au!
85
86 " For all text files set 'textwidth' to 78 characters.
87 autocmd FileType text setlocal textwidth=78
88
89 " When editing a file, always jump to the last known cursor position.
90 " Don't do it when the position is invalid or when inside an event handler
91 " (happens when dropping a file on gvim).
92 autocmd BufReadPost *
93 \ if line("'\"") > 0 && line("'\"") <= line("$") |
94 \ exe "normal g`\"" |
95 \ endif
96
97 augroup END
98
99 else
100
101 set autoindent " always set autoindenting on
102
103 endif " has("autocmd")
104
105
106 " GRB: sane editing configuration"
107 set expandtab
108 set tabstop=4
109 set shiftwidth=4
110 set softtabstop=4
111 set autoindent
112 " set smartindent
113 set laststatus=2
114 set showmatch
115 set incsearch
116
117 " GRB: wrap lines at 78 characters
118 set textwidth=78
119
120 " GRB: highlighting search"
121 set hls
122
123 if has("gui_running")
124 " GRB: set font"
125 ":set nomacatsui anti enc=utf-8 gfn=Monaco:h12
126
127 " GRB: set window size"
128 :set lines=100
129 :set columns=157
130
131 " GRB: highlight current line"
132 :set cursorline
133 endif
134
135 " GRB: set the color scheme
136 if !has("gui_running")
49d264b @garybernhardt Switched to slate color scheme in vim
authored
137 :color slate
d9da825 @garybernhardt Initial commit
authored
138 endif
139
140 " GRB: add pydoc command
141 :command -nargs=+ Pydoc :call ShowPydoc("<args>")
142 function ShowPydoc(module, ...)
143 let fPath = "/tmp/pyHelp_" . a:module . ".pydoc"
144 :execute ":!pydoc " . a:module . " > " . fPath
145 :execute ":sp ".fPath
146 endfunction
147
148 " GRB: Always source python.vim for Python files
149 au FileType python source ~/.vim/scripts/python.vim
150
151 " GRB: Use custom python.vim syntax file
152 au! Syntax python source ~/.vim/syntax/python.vim
153 let python_highlight_all = 1
154 let python_slow_sync = 1
155
156 " GRB: Add to syntax/python.vim to highlight more errors
157 syn match pythonError "^\s*def\s\+\w\+(.*)\s*$" display
158 syn match pythonError "^\s*class\s\+\w\+(.*)\s*$" display
159 syn match pythonError "^\s*for\s.*[^:]$" display
160 syn match pythonError "^\s*except\s*$" display
161 syn match pythonError "^\s*finally\s*$" display
162 syn match pythonError "^\s*try\s*$" display
163 syn match pythonError "^\s*else\s*$" display
164 syn match pythonError "^\s*else\s*[^:].*" display
165 syn match pythonError "^\s*if\s.*[^\:]$" display
166 syn match pythonError "^\s*except\s.*[^\:]$" display
167 syn match pythonError "[;]$" display
168 syn keyword pythonError do
169
170 " GRB: use emacs-style tab completion when selecting files, etc
171 set wildmode=longest,list
172
173 " GRB: Put useful info in status line
174 :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b'
175 :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red
176
177 " GRB: clear the search buffer when hitting return
178 :nnoremap <CR> :nohlsearch<CR>/<BS>
179
a6543a3 @garybernhardt Moved snippet completion to semicolon in vim
authored
180 " Remap the tab key to do autocompletion or indentation depending on the
181 " context (from http://www.vim.org/tips/tip.php?tip_id=102)
182 function InsertTabWrapper()
d9da825 @garybernhardt Initial commit
authored
183 let col = col('.') - 1
184 if !col || getline('.')[col - 1] !~ '\k'
185 return "\<tab>"
186 else
a6543a3 @garybernhardt Moved snippet completion to semicolon in vim
authored
187 return "\<c-p>"
d9da825 @garybernhardt Initial commit
authored
188 endif
189 endfunction
a6543a3 @garybernhardt Moved snippet completion to semicolon in vim
authored
190 inoremap <tab> <c-r>=InsertTabWrapper()<cr>
191 inoremap <s-tab> <c-n>
192
193 " Use semicolon for snippets
194 let g:snippetsEmu_key = ';'
d9da825 @garybernhardt Initial commit
authored
195
196 if version >= 700
197 autocmd FileType python set omnifunc=pythoncomplete#Complete
198 let Tlist_Ctags_Cmd='~/bin/ctags'
199 endif
200
a68ddbe @garybernhardt Made :bd not close splits
authored
201 " GRB: use fancy buffer closing that doesn't close the split
202 cnoremap <expr> bd (getcmdtype() == ':' ? 'Bclose' : 'bd')
203
8ae7a06 @garybernhardt Made vim use nose when doing :make
authored
204 " GRB: use nose when doing 'make'
205 set makeprg=nosetests\ --with-doctest\ --machine-out\ -x
206
Something went wrong with that request. Please try again.