Mercurial > dotfiles
annotate .vimrc @ 247:4313117237ed
hg: stop defining hostfingerprints now that ssl config works for me
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Thu, 09 Jun 2011 20:17:53 -0500 |
parents | 2233cb266ab0 |
children |
rev | line source |
---|---|
0 | 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 | |
3 | 26 " buffer switching/management, might as well use those keys for something |
27 " useful | |
4
d30122122d4f
This was driving me crazy in the end.
Augie Fackler <durin42@gmail.com>
parents:
3
diff
changeset
|
28 "map <Right> :bnext<CR> |
d30122122d4f
This was driving me crazy in the end.
Augie Fackler <durin42@gmail.com>
parents:
3
diff
changeset
|
29 "imap <Right> <ESC>:bnext<CR> |
d30122122d4f
This was driving me crazy in the end.
Augie Fackler <durin42@gmail.com>
parents:
3
diff
changeset
|
30 "map <Left> :bprev<CR> |
d30122122d4f
This was driving me crazy in the end.
Augie Fackler <durin42@gmail.com>
parents:
3
diff
changeset
|
31 "imap <Left> <ESC>:bprev<CR> |
d30122122d4f
This was driving me crazy in the end.
Augie Fackler <durin42@gmail.com>
parents:
3
diff
changeset
|
32 "map <Del> :bd<CR> |
0 | 33 |
34 filetype plugin indent on | |
35 colorscheme gothic | |
36 | |
37 | |
38 " Only do this part when compiled with support for autocommands | |
39 if has("autocmd") | |
40 " python settings | |
41 autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class | |
42 autocmd FileType python set tabstop=4|set softtabstop=4|set shiftwidth=4|set expandtab | |
43 autocmd FileType python setlocal noautoindent nosmartindent | |
44 "autocmd BufRead,BufNewFile *melange*/** call confirm(string([&filetype, expand('<amatch>')])) | |
45 autocmd BufRead,BufNewFile *melange*/*.py setlocal sw=2 ts=2 | |
46 | |
47 " In text files, always limit the width of text to 78 characters | |
48 autocmd BufRead *.txt set tw=78 | |
49 " When editing a file, always jump to the last cursor position | |
50 autocmd BufReadPost * if line("'\"") > 0 && line ("'\"") <= line("$") | exe "normal g'\"" | endif | |
51 endif | |
52 | |
53 if has("cscope") | |
54 set csprg=/usr/bin/cscope | |
55 set csto=0 | |
56 set cst | |
57 set nocsverb | |
58 " add any database in current directory | |
59 if filereadable("cscope.out") | |
60 cs add cscope.out | |
61 " else add database pointed to by environment | |
62 elseif $CSCOPE_DB != "" | |
63 cs add $CSCOPE_DB | |
64 endif | |
65 set csverb | |
66 endif | |
67 | |
68 " Switch syntax highlighting on, when the terminal has colors | |
69 " Also switch on highlighting the last used search pattern. | |
70 if &t_Co > 2 || has("gui_running") | |
71 syntax on | |
72 set hlsearch | |
73 endif | |
74 | |
75 " Highlight trailing whitespace | |
76 "au Syntax * syn match Error /\s\+$/ | syn match Error /^\s* \t\s*/ | |
77 " strip trailing whitespace on save | |
78 autocmd FileType c,cpp,java,php,python autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")')) | |
79 | |
80 " Highlight past column 80 | |
81 :highlight Over80ColLimit term=inverse,bold cterm=bold ctermbg=red ctermfg=white gui=bold guibg=red guifg=white | |
82 :syntax match Over80ColLimit /\%81v.*/ | |
83 | |
84 if &term=="xterm" | |
85 set t_Co=8 | |
86 set t_Sb=[4%dm | |
87 set t_Sf=[3%dm | |
88 endif | |
89 | |
90 function! Find(name) | |
91 let l:_name = substitute(a:name, "\\s", "*", "g") | |
92 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$_\"'") | |
93 let l:num=strlen(substitute(l:list, "[^\n]", "", "g")) | |
94 if l:num < 1 | |
95 echo "'".a:name."' not found" | |
96 return | |
97 endif | |
98 if l:num != 1 | |
99 echo l:list | |
100 let l:input=input("Which ? (<enter>=nothing)\n") | |
101 if strlen(l:input)==0 | |
102 return | |
103 endif | |
104 if strlen(substitute(l:input, "[0-9]", "", "g"))>0 | |
105 echo "Not a number" | |
106 return | |
107 endif | |
108 if l:input<1 || l:input>l:num | |
109 echo "Out of range" | |
110 return | |
111 endif | |
112 let l:line=matchstr("\n".l:list, "\n".l:input."\t[^\n]*") | |
113 else | |
114 let l:line=l:list | |
115 endif | |
116 let l:line=substitute(l:line, "^[^\t]*\t./", "", "") | |
117 execute ":e ".l:line | |
118 endfunction | |
119 command! -nargs=1 Find :call Find("<args>") |