Skip to content

Instantly share code, notes, and snippets.

@itochan
Created September 3, 2011 14:29
Show Gist options
  • Save itochan/1191265 to your computer and use it in GitHub Desktop.
Save itochan/1191265 to your computer and use it in GitHub Desktop.
"itochan's vimrc
set nocompatible
set number
set backspace=2
"indent settings {{{
set autoindent
set cindent
set tabstop=2
set shiftwidth=2
set smarttab
set expandtab
au FileType c set tabstop=8 shiftwidth=2 noexpandtab
"}}}
"- -> >>- ---> {{{
set list
set listchars=tab:>-,trail:-,extends:>,precedes:<
"}}}
"syntax settings
syntax on
"pathogen.vim settings
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
"ftplugin settings
filetype plugin on
"vimrcbox settings
let g:vimrcbox_user = "itochan315"
augroup VimRcBox
autocmd!
autocmd BufWritePost $MYVIMRC :RcbVimrc
autocmd BufWritePost $MYGVIMRC :RcbGVimrc
augroup END
"neocomplcache settings {{{
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
imap <C-k> <Plug>(neocomplcache_snippets_expand)
smap <C-k> <Plug>(neocomplcache_snippets_expand)
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
" SuperTab like snippets behavior.
"imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>"
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplcache#close_popup()
inoremap <expr><C-e> neocomplcache#cancel_popup()
" AutoComplPop like behavior.
"let g:neocomplcache_enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplcache_enable_auto_select = 1
"let g:neocomplcache_disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>"
"inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*'
let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::'
"}}}
"Rubyのオムニ補完を設定(ft-ruby-omni)
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1
"keymap settings
"http://twitter.com/#!/mactkg/statuses/78873595920646145
nmap <C-j> <C-d>
nmap <C-k> <C-u>
nmap <C-h> 0
nmap <C-l> $
"search settings
set ignorecase
set smartcase
set wrapscan
set incsearch
set hlsearch
nmap <Esc><Esc> :nohlsearch<CR><Esc>
"Tab completion
set wildmenu
set wildmode=list:longest
"backup settings
set backup
if has('win32') || has('win64')
set backupdir=%TEMP%
else
set backupdir=/tmp
endif
"undo settings
if has("persistent_undo")
set undodir=./.vimundo,~/.vimundo
augroup vimrc-undofile
autocmd!
autocmd BufReadPre ~/* setlocal undofile
augroup END
endif
"mouse settings
set mouse=i
"windows gvim settings
if (has('win32') || has('win64')) && has('gui_running')
set guifont=MeiryoKe_Gothic:h10
endif
"windows vim settings
if has('win32') || has('win64')
set fenc=utf-8 " 保存時の文字コード
set fencs=ucs_bom,utf-8,ios-2022-jp,euc-jp,cp932,utf-16,utf-16le " 文字コード自動判別候補
endif
if has('unix')
set fenc=utf-8
set fencs=utf-8,ios-2022-jp,euc-jp,cp932,utf-16,utf-16le
endif
"gvim settings
if has('gui_running')
"http://vim-users.jp/2010/01/hack120/
let g:save_window_file = expand('~/.vimwinpos')
augroup SaveWindow
autocmd!
autocmd VimLeavePre * call s:save_window()
function! s:save_window()
let options = [
\ 'set columns=' . &columns,
\ 'set lines=' . &lines,
\ 'winpos ' . getwinposx() . ' ' . getwinposy(),
\ ]
call writefile(options, g:save_window_file)
endfunction
augroup END
if filereadable(g:save_window_file)
execute 'source' g:save_window_file
endif
"clipboard settings
set clipboard=unnamed,autoselect
"mouse settings
set mouse=a
endif
"color settings
set t_Co=256
colorscheme mrkn256
"statusline settings
set laststatus=2
set statusline=%<%f\ %m\ %r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%y%=\ [%v,%l/%L]%8P
"vimproc settings
nnoremap :! :call vimproc#system('
"macvim settings
if has('gui_macvim')
let g:quickrun_config['*'].runmode = "async:remote:vimproc"}
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment