Skip to content

Instantly share code, notes, and snippets.

@naoty
Created October 31, 2011 07:40
Show Gist options
  • Save naoty/1327084 to your computer and use it in GitHub Desktop.
Save naoty/1327084 to your computer and use it in GitHub Desktop.
set nocompatible
" Display
" --------------------
set laststatus=2
set number
set nowrap
set ruler
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>
" Vundle
" --------------------
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Shougo/neocomplcache'
Bundle 'Gist.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()
" gist.vim
" --------------------
let g:gist_clip_command = 'pbcopy'
" Other Key Mappings
" --------------------
" save
nnoremap <space>w :<C-u>write<CR>
" 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
" adjust the window height/width
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>
" Scouter
" -------
function! Scouter(file, ...)
let pat = '^\s*$\|^\s*"'
let lines = readfile(a:file)
if !a:0 || !a:1
let lines = split(substitute(join(lines, "\n"), '\n\s*\\', '', 'g'), "\n")
endif
return len(filter(lines,'v:val !~ pat'))
endfunction
command! -bar -bang -nargs=? -complete=file Scouter
\ echo Scouter(empty(<q-args>) ? $MYVIMRC : expand(<q-args>), <bang>0)
command! -bar -bang -nargs=? -complete=file GScouter
\ echo Scouter(empty(<q-args>) ? $MYGVIMRC : expand(<q-args>), <bang>0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment