Created
August 6, 2012 21:59
-
-
Save gabeguz/3278859 to your computer and use it in GitHub Desktop.
vim configuration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
" MAIN CUSTOMIZATION FILE | |
" | |
set nocompatible | |
set rtp+=$GOROOT/misc/vim | |
" stupid konsole: | |
" set background=light | |
" built in autocomplete | |
autocmd FileType php set omnifunc=phpcomplete#CompletePHP | |
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS | |
"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | |
"autocmd FileType css set omnifunc=csscomplete#CompleteCSS | |
"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags | |
" random gabe tweaks | |
set hidden | |
set title | |
let mapleader = "," | |
set listchars=tab:>-,trail:·,eol:$ | |
nmap <silent> <leader>s :set nolist!<CR> | |
"php specific -- probably should be moved to ftplugin php.vim file | |
let php_sql_query = 1 | |
let php_baselib = 1 | |
let php_htmlInStrings = 1 | |
let php_noShortTags = 1 | |
let php_parent_error_close = 1 | |
let php_parent_error_open = 1 | |
let php_folding = 1 | |
" let php check for errors by typing :make should probably be moved to php.vim | |
set makeprg=php\ -l\ % | |
set errorformat=%m\ in\ %f\ on\ line\ %l | |
" Enable loading filetype and indentation plugins | |
filetype plugin on | |
filetype indent on | |
" Turn syntax highlighting on | |
syntax on | |
" | |
" GLOBAL SETTINGS | |
" | |
" Write contents of the file, if it has been modified, on buffer exit | |
set autowrite | |
" Allow backspacing over everything | |
set backspace=indent,eol,start | |
" Insert mode completion options | |
set completeopt=menu,longest,preview | |
" Use UTF-8 as the default buffer encoding | |
set enc=utf-8 | |
" Remember up to 100 'colon' commmands and search patterns | |
set history=100 | |
" Enable incremental search | |
set incsearch | |
" Always show status line, even for one window | |
set laststatus=2 | |
" Jump to matching bracket for 2/10th of a second (works with showmatch) | |
"set matchtime=2 | |
" Don't highlight results of a search | |
"set nohlsearch | |
" Do highlight results of a search | |
set hlsearch | |
" Enable CTRL-A/CTRL-X to work on octal and hex numbers, as well as characters | |
set nrformats=octal,hex,alpha | |
" Use F10 to toggle 'paste' mode | |
set pastetoggle=<F10> | |
" Show line, column number, and relative position within a file in the status line | |
set ruler | |
" Scroll when cursor gets within 3 characters of top/bottom edge | |
set scrolloff=3 | |
" Round indent to multiple of 'shiftwidth' for > and < commands | |
set shiftround | |
" Enable autoindent | |
set autoindent | |
" Enable smartindent | |
set smartindent | |
" Use 4 spaces for (auto)indent | |
set shiftwidth=4 | |
" Expand tabs (\t) to spaces | |
set expandtab | |
" Show (partial) commands (or size of selection in Visual mode) in the status line | |
set showcmd | |
" When a bracket is inserted, briefly jump to a matching one | |
set showmatch | |
" Don't request terminal version string (for xterm) | |
set t_RV= | |
" Use 4 spaces for <Tab> and :retab | |
set tabstop=4 | |
" Write swap file to disk after every 50 characters | |
set updatecount=50 | |
" Remember things between sessions | |
" | |
" '20 - remember marks for 20 previous files | |
" \"50 - save 50 lines for each register | |
" :20 - remember 20 items in command-line history | |
" % - remember the buffer list (if vim started without a file arg) | |
" n - set name of viminfo file | |
set viminfo='20,\"50,:20,%,n~/.viminfo | |
" Use menu to show command-line completion (in 'full' case) | |
set wildmenu | |
" Set command-line completion mode: | |
" - on first <Tab>, when more than one match, list all matches and complete | |
" the longest common string | |
" - on second <Tab>, complete the next full match and show menu | |
set wildmode=list:longest,full | |
" Go back to the position the cursor was on the last time this file was edited | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")|execute("normal `\"")|endif | |
" Fix my <Backspace> key (in Mac OS X Terminal) | |
"set t_kb= | |
"fixdel | |
" Avoid loading MatchParen plugin | |
let loaded_matchparen = 1 | |
" netRW: Open files in a split window | |
let g:netrw_browse_split = 1 | |
" | |
" MAPPINGS | |
" | |
" save changes | |
"map ,s :w<CR> | |
" exit vim without saving any changes | |
map ,q :q!<CR> | |
" exit vim saving changes | |
map ,w :x<CR> | |
" switch to upper/lower window quickly | |
map <C-J> <C-W>j | |
map <C-K> <C-W>k | |
" use CTRL-F for omni completion | |
imap <C-F> | |
" map CTRL-L to piece-wise copying of the line above the current one | |
imap <C-L> @@@<ESC>hhkywjl?@@@<CR>P/@@@<CR>3s | |
" map ,f to display all lines with keyword under cursor and ask which one to | |
" jump to | |
nmap ,f [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR> | |
" use <F6> to toggle line numbers | |
nmap <silent> <F6> :set number!<CR> | |
" page down with <Space> | |
"nmap <Space> <PageDown> | |
" open filename under cursor in a new window (use current file's working | |
" directory) | |
nmap gf :new %:p:h/<cfile><CR> | |
" map <Alt-p> and <Alt-P> to paste below/above and reformat | |
nnoremap <Esc>P P'[v']= | |
nnoremap <Esc>p p'[v']= | |
" visual shifting (does not exit Visual mode) | |
vnoremap < <gv | |
vnoremap > >gv | |
" Make it easy to remap tags | |
nmap <silent> <F4> | |
\ :!ectags -f ./tags | |
\ --langmap="php:+.inc" | |
\ -h ".php.inc" -R --totals=yes | |
\ --tag-relative=yes --PHP-kinds=+cf-v .<CR> | |
set tags=./tags,tags | |
" Generic highlight changes | |
"highlight Comment cterm=none ctermfg=Gray | |
"highlight IncSearch cterm=none ctermfg=Black ctermbg=DarkYellow | |
"highlight Search cterm=none ctermfg=Black ctermbg=DarkYellow | |
"highlight String cterm=none ctermfg=DarkGreen | |
"highlight treeDir cterm=none ctermfg=Cyan | |
"highlight treeUp cterm=none ctermfg=DarkYellow | |
"highlight treeCWD cterm=none ctermfg=DarkYellow | |
"highlight netrwDir cterm=none ctermfg=Cyan | |
" Set the <Leader> for combo commands | |
" | |
" gvim settings | |
colorscheme desert | |
set guioptions= | |
set guioptions+=ae |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment