Skip to content

Instantly share code, notes, and snippets.

@kechol
Last active October 11, 2015 16:57
Show Gist options
  • Select an option

  • Save kechol/3890168 to your computer and use it in GitHub Desktop.

Select an option

Save kechol/3890168 to your computer and use it in GitHub Desktop.
my vimrc
"" encoding
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,cp932,iso-2022-jp,euc-jp,ucs2le,ucs-2
"" basic settings
set wrap
set wrapscan
set hlsearch
set number
set ruler
set expandtab
set tabstop=4
set shiftwidth=4
set smartcase
set smartindent
set smarttab
set shellslash
set showcmd
set showmode
set noerrorbells
set novisualbell
set cursorline
set autoread
set noswapfile
set nobackup
set nowb
set formatoptions+=mM
set ambiwidth=double
set display+=lastline
set laststatus=2
set history=1000
set list listchars=eol:$,extends:>,precedes:<,trail:-,tab:>-
set statusline=%<%f\ %m\ %h%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ [%{&fenc!=''?&fenc:&enc}][%{&ff}]\ %L%8P
"" key mappings
let g:mapleader=","
map <Enter> o
inoremap jj <ESC>
inoremap kk <ESC>
inoremap hh <ESC>
inoremap ll <ESC>
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
"" NeoBundle
set nocompatible
filetype off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
au ColorScheme * highlight ZenkakuSpace ctermfg=1 ctermbg=1 guifg=Red guibg=Red
au BufNewFile,BufRead * match ZenkakuSpace / /
"" global bundles
NeoBundle 'vim-scripts/sudo.vim'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/neocomplcache'
NeoBundle 'Shougo/neosnippet'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'mattn/zencoding-vim'
NeoBundle 'tpope/vim-rails'
filetype plugin indent on
"" solarized & color scheme
syntax on
let &t_Co=256
colorscheme solarized
set background=dark
let g:solarized_visibility="high"
let g:solarized_contrast="high"
"" unite.vim
let g:unite_enable_start_insert = 0
let g:unite_source_history_yank_enable = 1
call unite#set_buffer_name_option('default', 'ignorecase', 1)
call unite#set_buffer_name_option('default', 'smartcase', 1)
nnoremap <silent> <C-n> :<C-u>UniteWithCurrentDir -buffer-name=files file<CR>
inoremap <silent> <C-n> <ESC>:<C-u>UniteWithCurrentDir -buffer-name=files file<CR>
nnoremap <silent> <C-h> :<C-u>Unite buffer file_mru<CR>
nnoremap <silent> <C-y> :<C-u>Unite history/yank<CR>
inoremap <silent> <C-y> <ESC>:<C-u>Unite history/yank<CR>
au FileType unite nmap <buffer> <C-r> <Plug>(unite_delete_backward_path)
au FileType unite imap <buffer> <C-r> <Plug>(unite_delete_backward_path)
au FileType unite nmap <silent><buffer> <ESC><ESC> q
au FileType unite imap <silent><buffer> <ESC><ESC> <ESC>q
au FileType unite nnoremap <silent> <buffer> <expr> <C-s> unite#do_action('split')
au FileType unite inoremap <silent> <buffer> <expr> <C-s> unite#do_action('split')
au FileType unite nnoremap <silent> <buffer> <expr> <C-v> unite#do_action('vsplit')
au FileType unite inoremap <silent> <buffer> <expr> <C-v> unite#do_action('vsplit')
"" neocomplcache & neosnippets
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_smart_case = 1
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_min_syntax_length = 3
let g:use_zen_complete_tag = 1
let g:neosnippet#snippets_directory='~/.vim/snippets'
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ }
let g:neocomplcache_keyword_patterns = {
\ 'default' : '\h\w*',
\ }
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType ruby set omnifunc=rubycomplete#Complete
autocmd FileType perl set omnifunc=perlcomplete#Complete
"" fugitive
nnoremap <silent> <C-g> :<C-u>Gstatus<CR>
inoremap <silent> <C-g> :<C-u>Gstatus<CR>
"" syntastic
let g:syntastic_enable_balloons = 0
let g:syntastic_enable_highlighting = 1
let g:syntastic_auto_loc_list = 2
let g:syntastic_mode_map = {
\ 'mode' : 'active',
\ 'active_filetypes' : [],
\ 'passive_filetypes': ['html', 'css'] }
nnoremap <C-l> gg=G:<C-u>SyntasticCheck<CR>
"" easymotion
let g:EasyMotion_keys = 'hjklasdfgyuiopqwertnmzxcvbHJKLASDFGYUIOPQWERTNMZXCVB'
let g:EasyMotion_leader_key = ","
let g:EasyMotion_grouping = 1
nmap <C-j> <Leader>j
nmap <C-k> <Leader>k
hi EasyMotionTarget ctermbg=none ctermfg=Red
hi EasyMotionShade ctermbg=none ctermfg=gray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment