Skip to content

Instantly share code, notes, and snippets.

@naoty
Created September 17, 2011 16:56
Show Gist options
  • Save naoty/1224132 to your computer and use it in GitHub Desktop.
Save naoty/1224132 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible
" Display
" --------------------
set laststatus=2
set number
set nowrap
set showcmd
set showmatch
syntax on
colorscheme railscasts
" Edit
" --------------------
set autoindent smartindent
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=0
set wildmenu
set wildmode=list:full
" Search
" --------------------
set hlsearch
set incsearch
nnoremap n nzz
nnoremap N Nzz
nnoremap <Esc><Esc> :nohlsearch<CR><Esc>
" Vundle
" --------------------
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Shougo/neocomplcache'
Bundle 'Gist.vim'
Bundle 'Align'
Bundle 'ZenCoding.vim'
filetype plugin indent on
" neocomplcache
" --------------------
let g:neocomplcache_enable_at_startup = 1
highlight Pmenu ctermbg=8
highlight PmenuSel ctermbg=1
highlight PmenuSbar ctermbg=0
inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr><CR> neocomplcache#smart_close_popup()."\<CR>"
inoremap <expr><C-y> neocomplcache#close_popup()
inoremap <expr><C-e> neocomplcache#cancel_popup()
" Other Key Mappings
" --------------------
" move by one display line
nnoremap j gj
nnoremap k gk
" move to line head/end like mac
nnoremap <C-a> 0
nnoremap <C-e> $
" go to another window
nnoremap <space>h <C-w>h
nnoremap <space>j <C-w>j
nnoremap <space>k <C-w>k
nnoremap <space>l <C-w>l
" move the window to another position
nnoremap <space>H <C-w>H
nnoremap <space>J <C-w>J
nnoremap <space>K <C-w>K
nnoremap <space>L <C-w>L
" window width/height modification
nnoremap <space>+ <C-w>5+
nnoremap <space>- <C-w>5-
nnoremap <space>< <C-w>10>
nnoremap <space>> <C-w>10<
" hjkl move in insert mode
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
" Auto command
" --------------------
" automatically remove spaces end of the line
autocmd BufWritePre * :%s/\s\+$//ge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment