karbassi (owner)

Fork Of

Revisions

gist: 16448 Download_button fork
public
Public Clone URL: git://gist.github.com/16448.git
Embed All Files: show embed
.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
if has('win32')
    set backupdir=C:/cygwin_updated/var/vim/backup
    set directory=C:/cygwin_updated/var/vim/tmp
elseif has('win32unix')
    if exists("*mkdir")
        if !isdirectory('/var/vim/')
            mkdir('/var/vim/')
        endif
        if !isdirectory('/var/vim/backup/')
            mkdir('/var/vim/backup/')
        endif
        if !isdirectory('/var/vim/tmp/')
            mkdir('/var/vim/tmp/')
        endif
    endif
    set backupdir=/var/vim/backup
    set directory=/var/vim/tmp
elseif has('unix')
    if !isdirectory($HOME.'/.vim/')
        call mkdir($HOME . '/.vim/')
    endif
    if !isdirectory($HOME.'/.vim/backup/')
        call mkdir($HOME . '/.vim/backup')
    endif
    if !isdirectory($HOME.'/.vim/tmp/')
        call mkdir($HOME . '/.vim/tmp/')
    endif
    set backupdir=$HOME/.vim/backup
    set directory=$HOME/.vim/tmp
endif
 
" if gvim
if has('gui_running')
    
    "set guioptions-=T
    "set guioptions-=m
    set guioptions=
 
    " maximize
    if has('win32')
        au GUIEnter * simalt ~x
    endif
 
endif
 
" if cygwin
"if has('win32unix')
" "colorscheme elflord
" colorscheme darkblue
"else
" colorscheme darkblue
"endif
 
colorscheme darkblue
 
"options
set autoindent
set backspace=2
set backup
set expandtab
set fileformat=unix
set filetype=on
set foldenable
set foldmethod=marker
set guicursor=a:blinkon0
set hidden
set history=500
set hlsearch
set incsearch
set mouse=n
set nocompatible
set noerrorbells
set number
set ruler
set shiftwidth=4
set shortmess=filnxtToOI
set showcmd
set softtabstop=4
set tabstop=4
set undolevels=2000
set whichwrap=<,>,h,l
set wildmenu
set wildmode=list:full
"if has("statusline")
" set statusline=%<%F%=%([%M%R%H%W]\ %)%l,%c%V\ %P\ (%n)
"endif
 
" testing..nah
"set virtualedit=all
 
 
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
syntax on
 
"map
map <F2> :set hlsearch!<CR>:set hlsearch?<CR>
map <F3> :resize +10<CR>:echo '+10'<CR>
map <F4> :resize -10<CR>:echo '-10'<CR>
 
"autoindent on/off
map <F5> :set autoindent!<CR>:set autoindent?<CR>
map <F8> :set paste!<CR>:set paste?<CR>
 
"execute file
"map <F6> :execute '!' . expand('%:p')<CR>
 
" next/prev buffers
map <C-W>h :bprevious<CR>
map <C-W>l :bnext<CR>
 
" prevent man lookup
map K <UP>
 
" automatically highlight blocks..
noremap V V%
 
" netrw
"let g:netrw_ignorenetrc =0
 
 
 
function HTMLSetup()
    inoremap <buffer> =" =""<ESC>i
    inoremap <buffer> =' =''<ESC>i
endfunction
 
function PhpSetup()
    inoremap <buffer> [' ['']<ESC>hi
    inoremap <buffer> =<SPACE>" =<SPACE>"";<ESC>hi
    inoremap <buffer> =<SPACE>' =<SPACE>'';<ESC>hi
    inoremap <buffer> if<SPACE>( if<SPACE>()<SPACE>{<CR><CR>}<ESC>kkf(a
    inoremap <buffer> =" =""<ESC>i
    inoremap <buffer> =' =''<ESC>i
    inoremap <buffer> {<cr> {<cr>}<esc>O
 
    if filereadable($HOME.'/.vim/php-doc.vim')
        source $HOME/.vim/php-doc.vim
        inoremap <buffer> <C-O> <ESC>:call PhpDocSingle()<CR>i
        nnoremap <buffer> <C-O> :call PhpDocSingle()<CR>
        vnoremap <buffer> <C-O> :call PhpDocRange()<CR>
 
        let g:pdv_cfg_Package = ""
        let g:pdv_cfg_Version = "$id$"
        let g:pdv_cfg_Author = "Clayton Smith <ces.fci@gmail.com>"
        let g:pdv_cfg_Copyright = ""
        "let g:pdv_cfg_License = PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
        let g:pdv_cfg_License = ""
 
        "imap <C-o> :set paste<CR>:exe PhpDoc()<CR>:set nopaste<CR>i
    endif
endfunction
 
function RubySetup()
    inoremap <buffer> #{ #{}<ESC>i
endfunction
 
function OcamlSetup()
    " BUG
    "" If 'shellpipe' is empty, the {errorfile} part will be omitted. This is useful
    "" for compilers that write to an errorfile themselves (e.g., Manx's Amiga C).
    "set makeprg=ocaml\ %:p
    "map <F8> :make<CR>
    "run script
    map <buffer> <F7> :!ocaml %:p<CR>
endfunction
 
 
 
" same as autochdir but is portable
autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ /
 
" setup
autocmd BufEnter *.phtml,*.php,*.thtml :call PhpSetup()
autocmd BufEnter *.ml :call OcamlSetup()
autocmd BufEnter *.html :call HTMLSetup()
autocmd BufEnter *.rb :call RubySetup()
autocmd BufEnter *.phtml,*.thtml :set filetype=php
autocmd BufEnter *.as :set filetype=javascript
 
 
if version >= 700
    " easier cycling through tabs
    map tl :tabnext<CR>
    map th :tabprev<CR>
    map tn :tabnew<CR>
    map td :tabclose<CR>
 
    " create new tab, note: overrides tag stack, :h <CTRL-T> for details atat
    "nmap <C-t> :tabnew<CR>
 
    " move current buffer to new tab
    function MoveBufferToTab()
        let l:current = bufnr('%')
        close
        tablast
        tabnew
        exe "b ". l:current
    endfunction
    map to :call MoveBufferToTab()<CR>
 
endif