Skip to content

Instantly share code, notes, and snippets.

@moneal
Created July 14, 2010 23:53
Show Gist options
  • Save moneal/476289 to your computer and use it in GitHub Desktop.
Save moneal/476289 to your computer and use it in GitHub Desktop.
Vim config
if &term == 'Eterm'
:set t_Co=256
endif
" Custom templates
command Copy :exec ":r ~/.vim/templates/alpine-copyright/copyright.inc"
" HTML Vars
:let g:do_xhtml_mappings = '1'
:let g:no_html_tab_mapping = '1'
:let g:html_tag_case = 'lowercase'
:let g:html_authorname = "Morgan O'Neal"
:let g:html_authoremail = '[email protected]'
:let g:html_template= '~/.vim/templates/html-template/CS\ HTML\ Template.html'
":set t_AB=<ESC>[4%p1%dm
":set t_AF=<ESC>3%p1%dm
"
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Setting for looking up phpdocs
if v:progname =~? "vim"
if v:progname =~? "gvim"
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
"
set noignorecase
set nocompatible
set expandtab
set shiftwidth=4
set tabstop=4
set showmatch
set foldmethod=marker
set spell
func! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
" Remap the tab key to select action with InsertTabWrapper
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
" Set break on underscore
" Was causing more problems then it helped
" set iskeyword-=_
" Moneals cool little thing
" ctr-b to test php files
map <C-B> :w /tmp/phptmp<cr>:!php -l /tmp/phptmp <cr>:!rm /tmp/phptmp<cr>
" quick commit
map <C-C> :w<cr>:VCSCommit<cr>
" tab shortcuts like normal browser
" New tab
map <C-T> <Esc>:tabnew<cr>
" Tab next
map <C-Tab> <Esc>:tabn<cr>
" Tab prev
map <C-S-Tab> <Esc>:tabp<cr>
" ctr-o open browse dialog
map <C-O> <Esc>:browse confirm e<cr>
" Move tab left
map <silent> <C-S-Left> :exe "silent! tabmove " . (tabpagenr() - 2)<CR>
" Move tab right
map <silent> <C-S-Right> :exe "silent! tabmove " . tabpagenr()<CR>
",v brings up my .vimrc
"",V reloads it -- making all changes active (have to save first)
map ,v :sp ~/.vimrc<CR><C-W>_
map <silent> ,V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
" Set manprog for php docs
set keywordprg=~/bin/phplookup
"map <C-B> :!php %<cr>
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Trun on line numbering
set nu
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
"let Tlist_Ctags_Cmd='/usr/bin/ctags'
" Turn filetype on
filetype plugin on
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
" set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp
:amenu icon=FooIcon ToolBar.Foo :echo "Foo"<CR>
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
set background=dark
" Move tab right
":colorscheme oceandeep
:colorscheme oceanblack
:set guioptions-=T
endif
let g:no_html_toolbar=1
" let g:closetag_html_style=1
" :source ~/.vim/plugin/closetag.vim
" Only do this part when compiled with support for autocommands.
if has("autocmd")
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
au Filetype html,xml,xsl source ~/.vim/scripts/closetag.vim
au BufRead,BufNewFile *.scss set filetype=scss
"au FileType html,xhtml,xml so ~/.vim/ftplugin/html_autoclosetag.vim
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
" filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment