comparison .vimrc @ 0:c30d68fbd368

Initial import from svn.
author Augie Fackler <durin42@gmail.com>
date Wed, 26 Nov 2008 10:56:09 -0600
parents
children 1921c0b85a82
comparison
equal deleted inserted replaced
-1:000000000000 0:c30d68fbd368
1 if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
2 set fileencodings=utf-8,latin1
3 endif
4
5 "set number " Show line number
6 set nocompatible " Use Vim defaults (much better!)
7 set bs=2 " allow backspacing over everything in insert mode
8 set autoindent
9 "set nosmartindent
10 "set backup " keep a backup file
11 set viminfo='20,\"50 " read/write a .viminfo file, don't store more
12 " than 50 lines of registers
13 set history=50 " keep 50 lines of command line history
14 set ruler " show the cursor position all the time
15 set hidden " allow background buffers that aren't written out
16 set wildmode=list:longest,full " be more like my shell
17
18
19 set ignorecase " unsure
20 set smartcase
21
22 set scrolloff=3 " keep 3 lines of context
23
24 set incsearch " search as you type
25
26
27
28 filetype plugin indent on
29 colorscheme gothic
30
31
32 " Only do this part when compiled with support for autocommands
33 if has("autocmd")
34 " python settings
35 autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
36 autocmd FileType python set tabstop=4|set softtabstop=4|set shiftwidth=4|set expandtab
37 autocmd FileType python setlocal noautoindent nosmartindent
38 "autocmd BufRead,BufNewFile *melange*/** call confirm(string([&filetype, expand('<amatch>')]))
39 autocmd BufRead,BufNewFile *melange*/*.py setlocal sw=2 ts=2
40
41 " In text files, always limit the width of text to 78 characters
42 autocmd BufRead *.txt set tw=78
43 " When editing a file, always jump to the last cursor position
44 autocmd BufReadPost * if line("'\"") > 0 && line ("'\"") <= line("$") | exe "normal g'\"" | endif
45 endif
46
47 if has("cscope")
48 set csprg=/usr/bin/cscope
49 set csto=0
50 set cst
51 set nocsverb
52 " add any database in current directory
53 if filereadable("cscope.out")
54 cs add cscope.out
55 " else add database pointed to by environment
56 elseif $CSCOPE_DB != ""
57 cs add $CSCOPE_DB
58 endif
59 set csverb
60 endif
61
62 " Switch syntax highlighting on, when the terminal has colors
63 " Also switch on highlighting the last used search pattern.
64 if &t_Co > 2 || has("gui_running")
65 syntax on
66 set hlsearch
67 endif
68
69 " Highlight trailing whitespace
70 "au Syntax * syn match Error /\s\+$/ | syn match Error /^\s* \t\s*/
71 " strip trailing whitespace on save
72 autocmd FileType c,cpp,java,php,python autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
73
74 " Highlight past column 80
75 :highlight Over80ColLimit term=inverse,bold cterm=bold ctermbg=red ctermfg=white gui=bold guibg=red guifg=white
76 :syntax match Over80ColLimit /\%81v.*/
77
78 if &term=="xterm"
79 set t_Co=8
80 set t_Sb=[4%dm
81 set t_Sf=[3%dm
82 endif
83
84 function! Find(name)
85 let l:_name = substitute(a:name, "\\s", "*", "g")
86 let l:list=system("find . -iname '*".l:_name."*' -not -name \"*.pyc\" -and -not -name \"*.o\" -and -not -name \"*.i\" -and -not -name \"*.class\" -and -not -name \"*.swp\" | perl -ne 'print \"$.\\t$_\"'")
87 let l:num=strlen(substitute(l:list, "[^\n]", "", "g"))
88 if l:num < 1
89 echo "'".a:name."' not found"
90 return
91 endif
92 if l:num != 1
93 echo l:list
94 let l:input=input("Which ? (<enter>=nothing)\n")
95 if strlen(l:input)==0
96 return
97 endif
98 if strlen(substitute(l:input, "[0-9]", "", "g"))>0
99 echo "Not a number"
100 return
101 endif
102 if l:input<1 || l:input>l:num
103 echo "Out of range"
104 return
105 endif
106 let l:line=matchstr("\n".l:list, "\n".l:input."\t[^\n]*")
107 else
108 let l:line=l:list
109 endif
110 let l:line=substitute(l:line, "^[^\t]*\t./", "", "")
111 execute ":e ".l:line
112 endfunction
113 command! -nargs=1 Find :call Find("<args>")
114
115 if has("ruby")
116 map ,f :FuzzyFinderTextMate<CR>
117 let g:fuzzy_ignore="*.pyc"
118 let g:fuzzy_matching_limit=50
119 else
120 map ,f :Find
121 endif
122