~ frogb /.vimrc

set nocompatible
set nowrap
set noexpandtab
set softtabstop=4
set tabstop=4
set shiftwidth=4
set fileencodings=iso-8859-1
set ignorecase
set smartcase
set nobackup
set hlsearch
set autoindent
set nomousehide

syntax enable

au BufEnter * set formatoptions-=ro

fun! DisableIndent()
        setlocal nocindent
        setlocal nosmartindent
        setlocal indentexpr=
endfun

autocmd BufEnter *.as call DisableIndent()
autocmd BufEnter *.mxml call DisableIndent()

au BufRead,BufNewFile *.as set syntax=javascript
au BufRead,BufNewFile *.mxml set syntax=javascript

if has("unix")
        au VimEnter * call CmdAlias("n", "noh")
end

if has("unix")
        au BufNewFile * ,!getcodeskel %
endif

au BufWinEnter *.java map <f9> :w<cr>:!javac % && java %:r<cr>
au BufWinEnter *.c map <f9> :w<cr>:!gcc % -o prog && ./prog<cr>
au BufWinEnter *.cpp map <f9> :w<cr>:!g++ % -o prog && ./prog<cr>
au BufWinEnter *.rb map <f9> :w<cr>:!./%<cr>

map! <f9> <esc><f9>

if has("unix")
        au BufWritePost *.rb !chmod u+x %
endif

fun! InsertTabWrapper()
        let col = col('.') - 1
        if !col || getline('.')[col - 1] !~ '\k'
                return "\<tab>"
        else
                return "\<c-p>"
        endif
endfun

fun! ShiftInsertTabWrapper()
        let col = col('.') - 1
        if !col || getline('.')[col - 1] !~ '\k'
                return "\<s-tab>"
        else
                return "\<c-n>"
        endif
endfun

inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <s-tab> <c-r>=ShiftInsertTabWrapper()<cr>

map <tab> >0
map <s-tab> <0

nmap <c-t> :tabnew<cr>
nmap <c-w> :close<cr>
map <a-1> 1gt
map <a-2> 2gt
map <a-3> 3gt
map <a-4> 4gt
map <a-5> 5gt
map <a-6> 6gt
map <a-7> 7gt
map <a-8> 8gt
map <a-9> 9gt
map <a-0> 10gt

"set listchars=tab:????,trail:??,extends:?
set listchars=tab:>-,trail:>,extends:>
map <c-l> :set list!<cr>

nnoremap <silent> <f8> :Tlist<cr>

filetype plugin on

noremap <c-n> <c-e>
noremap <c-p> <c-y>
nmap <c-left> b
nmap <c-right> e
imap <c-left> <esc>bi
imap <c-right> <esc>ea

map <c-e> :w<cr>:!!<cr>
map! <c-e> <esc><c-e>

"map  <c-h> <esc>:noh<cr>
"map! <c-h> <esc>:noh<cr>

if has("gui_running")
        set guioptions-=T

        colorscheme desert
        "colorscheme zellner
        set gfn=Courier\ New\ 9

        source $VIMRUNTIME/mswin.vim
        map <c-q> :confirm qa<cr>
        map! <c-q> <esc><c-q>
else
        color elflord
endif

"color mycolors  

if !has("unix")
        if has("gui_running")
                set guifont=Courier_New:h9:cANSI"
                colorscheme zellner
        endif

        set nu

        au BufWinEnter *.rb map <f9> :w<cr>:!compile<cr>
        au BufWinEnter *.mxml map <f9> :w<cr>:!compile<cr>
endif