-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
115 lines (95 loc) · 2.67 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
set incsearch
set hlsearch
" perl -cw buffer, using a temp file, into a new window
function! PerlCW()
let l:tmpfile1 = tempname()
let l:tmpfile2 = tempname()
execute "normal:w!" . l:tmpfile1 . "\<CR>"
execute "normal:! perl -cw ".l:tmpfile1." \> ".l:tmpfile2." 2\>\&1 \<CR>"
execute "normal:new\<CR>"
execute "normal:edit " . l:tmpfile2 . "\<CR>"
endfunction
" perl buffer, using a temp file, into a new window
function! PerlOutput()
let l:tmpfile1 = tempname()
let l:tmpfile2 = tempname()
execute "normal:w!" . l:tmpfile1 . "\<CR>"
execute "normal:! perl ".l:tmpfile1." \> ".l:tmpfile2." 2\>\&1 \<CR>"
execute "normal:new\<CR>"
execute "normal:edit " . l:tmpfile2 . "\<CR>"
endfunction
" Settings for editing perl source (plus bind the above two functions)
function! MyPerlSettings()
if !did_filetype()
set filetype=perl
endif
set textwidth=80
set expandtab
set tabstop=2
set shiftwidth=2
set cindent
set comments=:#
set formatoptions=croql
set keywordprg=man\ -S\ 3
noremap <f1> <Esc>:call PerlCW()<CR><Esc>
noremap <f3> <Esc>:call PerlOutput()<CR><Esc>
endfunction
" Settings for editing python source
function! MyPythonSettings()
set expandtab
set tabstop=4
set shiftwidth=4
set comments=:#
endfunction
" Settings for editing perl source (plus bind the above two functions)
function! MyPhpSettings()
if !did_filetype()
set filetype=php
endif
set textwidth=80
set noexpandtab
set tabstop=4
set shiftwidth=4
set smartindent
set comments=:#
endfunction
" Settings for editing c/c++ source
function! MyCCppSettings()
if !did_filetype()
set filetype=c
endif
set textwidth=80
set noexpandtab
set tabstop=4
set shiftwidth=4
set smartindent
set comments=://
endfunction
" Settings for editing javascript source
function! MyJavaScriptSettings()
if !did_filetype()
set filetype=javascript
endif
set textwidth=80
set expandtab
set tabstop=2
set shiftwidth=2
set cindent
set comments=://
endfunction
set smartindent expandtab tabstop=4 shiftwidth=4
autocmd FileType perl :call MyPerlSettings()
autocmd FileType python :call MyPythonSettings()
autocmd FileType php :call MyPhpSettings()
autocmd FileType cpp :call MyCCppSettings()
autocmd FileType c :call MyCCppSettings()
autocmd FileType javascript :call MyJavaScriptSettings()
let g:easytags_file = './tags'
let g:loaded_easytags = 1
call pathogen#infect()
syntax on
"colorscheme darkblue
let curv = getcwd() . "/.vimrc"
if filereadable(curv) && curv != "/home/lex/.vimrc"
silent execute 'source ' . curv
endif