Skip to content

Instantly share code, notes, and snippets.

@akira093
Created September 22, 2013 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akira093/6656153 to your computer and use it in GitHub Desktop.
Save akira093/6656153 to your computer and use it in GitHub Desktop.
autocmd!
" neovundle
set nocompatible
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/neobundle-vim-scripts'
" Completion
NeoBundle 'Shougo/neocomplcache'
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_ignore_case = 1
let g:neocomplcache_enable_smartcase = 1
let g:neocomplcache_disable_auto_complete = 0
let g:neocomplcache_enable_auto_select = 1
let g:neocomplcache_enable_cursor_hold_i = 0
let g:neocomplcache_enable_camel_case_completion = 0
let g:neocomplcache_enable_underbar_completion = 0
let g:NeoComplCache_EnableInfo = 1
let g:neocomplcache_auto_completion_start_length = 2
let g:neocomplcache_min_keyword_length = 1
let g:neocomplcache_min_syntax_length = 1
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'scala' : $HOME . '/.vim/dict/scala.dict',
\}
inoremap <expr><C-n> neocomplcache#start_manual_complete()
inoremap <expr><C-e> neocomplcache#cancel_popup()
NeoBundle 'ujihisa/neco-look'
" Snippet
NeoBundle 'Shougo/neosnippet'
" Tell Neosnippet about the other snippets
let g:neosnippet#snippets_directory='~/.vim/autoload/snippets'
let g:neosnippet#enable_snipmate_compatibility=1
"" Plugin key-mappings.
"imap <C-k> <Plug>(neosnippet_expand_or_jump)
"smap <C-k> <Plug>(neosnippet_expand_or_jump)
" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable() <Bar><bar> neosnippet#jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable() <Bar><bar> neosnippet#jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"
" Unite
NeoBundle 'Shougo/unite.vim'
"Unite config
" バッファ一覧
nnoremap fb :Unite buffer<CR>
" ファイル一覧
nnoremap <silent> ff :<C-U>UniteWithCurrentDir -buffer-name=files file<CR>
nnoremap <silent> FF :<C-U>Unite -buffer-name=files file_rec<CR>
" 最近使用したファイル一覧
nnoremap <silent> fm :<C-U>Unite file_mru<CR>
" unite outline
NeoBundle 'h1mesuke/unite-outline'
nnoremap <silent> fo :<C-U>Unite outline<CR>
" unite quickfix
nnoremap <silent> fq :<C-U>Unite quickfix<CR>
NeoBundle "osyo-manga/unite-quickfix"
" unite grep
nnoremap <silent> fg :<C-u>Unite grep:.: -no-quit<CR>
nnoremap <silent> FG :<C-u>Unite grep:.::<C-r><C-w><CR>
let g:unite_source_grep_default_opts = '-iRHEn'
" unite register
nnoremap <silent> fr :<C-U>Unite register<CR>
" unite file/new
nnoremap <silent> FR :<C-U>UniteResume<CR>
" unite line
nnoremap <silent> fl :<C-u>Unite -buffer-name=search line -start-insert -no-quit<CR>
" unite tag
NeoBundle 'tsukkee/unite-tag'
nnoremap <silent> FT :<C-U>Unite tag<CR>
" Unite message
let g:unite_source_alias_aliases = {
\ 'message' : {
\ 'source': 'output',
\ 'args': 'message',
\ },
\}
call unite#custom_source('message', 'sorters', 'sorter_reverse')
" Unite snippet
nnoremap <silent> fs :<C-U>Unite snippet<CR>
NeoBundle 'unite-colorscheme' " 1.0 A Unite.vim plugin for changing your colorscheme.
NeoBundle 'osyo-manga/unite-filetype'
NeoBundle 'tsukkee/unite-help'
au FileType unite nnoremap <silent> <buffer> <expr> <S-E> unite#do_action('right')
au FileType unite inoremap <silent> <buffer> <expr> <S-E> unite#do_action('right')
au FileType unite nnoremap <silent> <buffer> <expr> <S-Y> unite#do_action('yank')
au FileType unite inoremap <silent> <buffer> <expr> <S-Y> unite#do_action('yank')
au FileType unite nnoremap <silent> <buffer> <expr> <S-V> unite#do_action('vimfiler')
au FileType unite inoremap <silent> <buffer> <expr> <S-V> unite#do_action('vimfiler')
"let g:unite_enable_split_vertically=1
"let g:unite_winwidth=40
let g:unite_enable_start_insert=0
" vimfiler
NeoBundle 'Shougo/vimfiler'
nnoremap <silent> fv :VimFilerBufferDir<CR>
let g:vimfiler_as_default_explorer=1
let g:vimfiler_execute_file_list={}
let g:vimfiler_execute_file_list["_"]="vim"
let g:vimfiler_edit_action="vsplit"
let g:vimfiler_directory_display_top=1
let g:vimfiler_safe_mode_by_default=0
let g:vimfiler_enable_auto_cd=1
" Quickrun
NeoBundle 'thinca/vim-quickrun'
" quickrun config
let g:quickrun_config={}
let g:quickrun_config['_'] = {
\ 'runner' : 'vimproc',
\ 'runner/vimproc/updatetime' : 200,
\ "outputter" : 'buffer',
\ 'outputter/multi/targets':['buffer', 'quickfix'],
\ 'outputter/buffer/append' : 0,
\ 'outputter/buffer/into' : 1,
\ 'outputter/buffer/running_mark' : "i'm running :-)",
\ 'outputter/buffer/close_on_empty' : 1,
\ }
let g:quickrun_config['coffee'] = {'command' : 'coffee', 'exec' : ['%c -cbp %s']}
let g:quickrun_config['c'] = {'command' : 'gcc', 'exec' : ['%c %s -lm -O2 -o %s.out', '%s.out']}
"let g:quickrun_config['markdown'] = {'type': 'markdown/pandoc', 'cmdopt': '-s', 'outputter': 'browser'}
let g:quickrun_config['markdown'] = {'type': 'markdown/pandoc', 'exec': ['%c %s -s -o %s.htm --mathjax', 'chromium-browser %s.htm'], 'tempfile' : '%s'}
let g:quickrun_config['tex'] = {
\ 'tempfile' : 'temp','command' : 'platex', 'cmdopt' : '-interaction=nonstopmode',
\'exec' : ['%c %o %s', 'dvipdfm %s:r.dvi', 'rm %s:r.aux %s:r.log %s:r.dvi']
\}
let g:quickrun_config['html'] = {'command' : 'xdg-open', 'exec' : ['%c %s']}
let g:quickrun_config['xhtml'] = {'command' : 'xdg-open', 'exec' : ['%c %s']}
let g:quickrun_config['py2'] = {'command' : 'python2', 'exec' : ['%c %s']}
let g:quickrun_config['py3'] = {'command' : 'python3', 'exec' : ['%c %s']}
let g:quickrun_config['scala'] = {'exec' : ['%c %s']}
let g:quickrun_config['haskell'] = {'command' : 'ghc' , 'exec' : ['%c -O2 %s -o %s.out', '%s.out']}
let g:quickrun_config['haskell_compile'] = {'command' : 'ghc' , 'exec' : ['%c -o %s.out %s -threaded']}
let g:quickrun_config['sh'] = {'command' : 'bash' , 'exec' : ['%c %s']}
nnoremap <expr><silent> <C-c> quickrun#is_running() ? quickrun#sweep_sessions() : "\<C-c>"
" Tweetvim
NeoBundle 'basyura/TweetVim'
nnoremap ft :<C-U>TweetVimHomeTimeline<CR>
nnoremap tw :<C-U>TweetVimSay<CR>
let g:tweetvim_tweet_per_page = 50
let g:tweetvim_footer="(・´ェ`・)"
NeoBundle 'basyura/twibill.vim'
" vim-automatic
NeoBundle 'osyo-manga/vim-automatic'
" etc
NeoBundle 'scrooloose/nerdcommenter'
NeoBundle 'nathanaelkane/vim-indent-guides'
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_guide_size=4
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
NeoBundle 'Shougo/vinarise'
let g:vinarise_enable_auto_detect=1
NeoBundle 'Shougo/vimshell'
let g:vimshell_prompt = "vimshell%"
let g:vimshell_right_prompt = 'getcwd()'
let g:vimshell_popup_command = 'vs'
nnoremap <S-h> <Plug>(vimshell_split_switch)
NeoBundle 'mattn/webapi-vim'
NeoBundle 'mattn/gist-vim'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
NeoBundle 'tyru/open-browser.vim'
"let g:openbrowser_open_commands=['chromium-browser']
"let g:openbrowser_open_rules={'chromium-browser' : '{browser} {shellescape(uri)}'}
NeoBundle 'thinca/vim-ref'
NeoBundle 'glidenote/memolist.vim'
let g:memolist_unite = 1
let g:memolist_unite_source = "file_rec"
NeoBundle 'vim-jp/vimdoc-ja'
NeoBundle 'SrcExpl'
let g:SrcExpl_UpdateTags = 1
"NeoBundle 'taglist.vim'
"autocmd BufWritePost * :TlistUpdate
""let g:Tlist_Auto_Open = 1
"let tlist_tex_settings='latex;c:chapter;s:section;l:label;b:bibitem;'
NeoBundle 'kana/vim-submode'
"winsize
call submode#enter_with('winsize', 'n', '', '<C-w>>', '<C-w>>')
call submode#enter_with('winsize', 'n', '', '<C-w><', '<C-w><')
call submode#enter_with('winsize', 'n', '', '<C-w>+', '<C-w>-')
call submode#enter_with('winsize', 'n', '', '<C-w>-', '<C-w>+')
call submode#map('winsize', 'n', '', '>', '<C-w>>')
call submode#map('winsize', 'n', '', '<', '<C-w><')
call submode#map('winsize', 'n', '', '+', '<C-w>-')
call submode#map('winsize', 'n', '', '-', '<C-w>+')
"change tab
function! s:SIDP()
return '<SNR>' . matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SIDP$') . '_'
endfunction
function! s:movetab(nr)
execute 'tabmove' g:V.modulo(tabpagenr() + a:nr - 1, tabpagenr('$'))
endfunction
let s:movetab = ':<C-u>call ' . s:SIDP() . 'movetab(%d)<CR>'
call submode#enter_with('movetab', 'n', '', 'gt', printf(s:movetab, 1))
call submode#enter_with('movetab', 'n', '', 'gT', printf(s:movetab, -1))
call submode#map('movetab', 'n', '', 't', printf(s:movetab, 1))
call submode#map('movetab', 'n', '', 'T', printf(s:movetab, -1))
unlet s:movetab
NeoBundle 'kana/vim-textobj-user' " Vim plugin: Create your own text objects
NeoBundle 'osyo-manga/vim-textobj-multiblock'
omap ab <Plug>(textobj-multiblock-a)
omap ib <Plug>(textobj-multiblock-i)
vmap ab <Plug>(textobj-multiblock-a)
vmap ib <Plug>(textobj-multiblock-i)
NeoBundle 'thinca/vim-splash'
NeoBundle 'sudo.vim' " 1.0 Allows one to edit a file with prevledges from an unprivledged session.
NeoBundle 'Trinity'
nnoremap <Leader>t :<C-U>TrinityToggleAll<CR>
NeoBundle 'matchit.zip' " 1.0 extended % matching for HTML, LaTeX, and many other languages
NeoBundle 'h1mesuke/vim-alignta'
NeoBundle 'kmnk/vim-unite-giti'
nnoremap <Leader>g :Unite giti<CR>
NeoBundle 'vim-jp/vital.vim'
" colorscheme
NeoBundle 'vim-scripts/molokai'
NeoBundle 'vim-scripts/newspaper.vim'
NeoBundle 'nanotech/jellybeans.vim'
NeoBundle 'w0ng/vim-hybrid'
NeoBundle 'jonathanfilip/vim-lucius'
NeoBundle 'jpo/vim-railscasts-theme'
NeoBundle 'vim-scripts/rdark'
NeoBundle 'kossnocorp/perfect.vim'
colorscheme molokai
" syntastic
NeoBundle 'scrooloose/syntastic'
let $PATH = $PATH . ':' . 'usr/local/bin'
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=0
let g:syntastic_error_symbol='x'
let g:syntastic_warning_symbol='!'
let g:syntastic_enable_balloons = 0
let g:syntastic_auto_loc_list=1
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': [] }
let g:syntastic_python_checkers = ['pylint', 'pyflakes']
" surround.vim
NeoBundle 'surround.vim'
" my surround option
let g:surround_45 = "<% \r %>" "-
let g:surround_61 = "<%= \r %>" "=
"let g:surround_96 = '${\\rm \r}$' "`
let g:surround_123 = "{\r}" "{
let g:surround_91 = "[\r]" "[
let g:surround_82 = "{\\rm \r}" "R
" Filetype
" Ruby
NeoBundle "rhysd/unite-ruby-require.vim"
NeoBundle "rhysd/neco-ruby-keyword-args"
autocmd FileType ruby let b:indent_guides_guide_size=2
autocmd FileType ruby setl shiftwidth=2
autocmd FileType ruby setl softtabstop=2
" Scala
NeoBundle "derekwyatt/vim-scala"
autocmd FileType scala setl tags+=~/.vim/tags/scala.tag
autocmd FileType scala nnoremap <buffer> <F5> :<C-u>call <SID>execScalac()<CR>
autocmd FileType scala nnoremap <buffer> <F6> :<C-u>call <SID>runScala()<CR>
autocmd FileType scala let b:indent_guides_guide_size=2
autocmd FileType scala setl shiftwidth=2
autocmd FileType scala setl softtabstop=2
function! s:execScalac()
:w
exe ":!scalac %"
endfunction
function! s:runScala()
exe ':!scala %:r.class'
endfunction
" Haskell
NeoBundle "ujihisa/neco-ghc"
let $PATH = $PATH . ':' . expand("~/.cabal/bin")
"NeoBundle 'haskell.vim'
NeoBundle 'dag/vim2hs'
"let g:haskell_conceal_wide = 0
NeoBundle 'eagletmt/ghcmod-vim'
"NeoBundle 'eagletmt/unite-haddock'
autocmd FileType haskell nnoremap <buffer> K :<C-U>OpenBrowser http://www.haskell.org/hoogle/?hoogle=<C-r><c-w><CR>
autocmd FileType haskell nnoremap <buffer> <F4> :<C-U>HLint<CR>
autocmd FileType haskell nnoremap <buffer> <F5> :<C-u>call <SID>execGHC()<CR>
autocmd FileType haskell nnoremap <buffer> <F6> :<C-u>call <SID>runHS()<CR>
function! s:execGHC()
:w
exe "!ghc --make -O3 % -o %.out"
endfunction
function! s:runHS()
exe ':!./%.out'
endfunction
" markdown
autocmd BufRead,BufNewFile *.mkd setfiletype markdown
autocmd BufRead,BufNewFile *.md setfiletype markdown
autocmd BufRead,BufNewFile *.markdown setfiletype markdown
autocmd BufNewFile *.md 0r ~/.vim/template/markdown.txt
" TeX
autocmd BufRead,BufNewFile *.tex setfiletype tex
autocmd BufNewFile *.tex 0r ~/.vim/template/tex.txt
au FileType tex setl fenc=euc-jp
au FileType tex nnoremap <buffer> \r :w<CR>:QuickRun<CR>
" vim
autocmd FileType vim setl foldlevel=0
autocmd FileType vim nnoremap <buffer> K :<C-U>help <C-r><c-w><CR>
" make
autocmd FileType make setl noexpandtab
" quick quit
au FileType help nnoremap <buffer> q :q<CR>
au FileType ref-pydoc nnoremap <buffer> q :q<CR>
au FileType quickfix-window nnoremap <buffer> q :q<CR>
au FileType quickrun-output nnoremap <buffer> q :q<CR>
" C
autocmd FileType c nnoremap <buffer> <F5> :call <SID>execGcc()<CR>
autocmd FileType c nnoremap <buffer> <F6> :call <SID>runC()<CR>
autocmd FileType c nnoremap <buffer> <F7> :call <SID>runCToFile()<CR>
function! s:execGcc()
:w
exe ":!gcc % -lm -O2 -o %.out"
endfunction
function! s:runC()
exe ':!' . expand('%') . '.out'
endfunction
function! s:runCToFile()
exe ":!./%.out > %.data"
endfunction
" python
autocmd FileType python nnoremap <buffer> <F4> :<C-U>call <SID>ExecPep8()<CR>
autocmd FileType python nnoremap <buffer> <F6> :<C-U>call <SID>ExecPyi()<CR>
autocmd FileType python nnoremap <buffer> <F5> :<C-U>call <SID>ExecPy()<CR>
autocmd BufNewFile *.py 0r ~/.vim/template/python.txt
function! s:ExecPy()
:w
exe "!python". " %"
endfunction
function! s:ExecPep8()
:w
exe "!" . "pep8" . " %"
endfunction
function! s:ExecPyi()
:w
exe "!ipython -i". " %"
endfunction
" other
filetype plugin indent on
set nobackup
" encoding
set encoding=utf8
set fileencodings=ucs-bom,utf-8,iso-2022-jp,sjis,cp932,euc-jp,cp20932
set fileformats=unix,dos,mac
set hidden
set autoread
set whichwrap=b,s
" folding
set foldmethod=indent
set foldminlines=5
set foldnestmax=2
set foldlevel=1
set mouse=a
set ttymouse=xterm2
set splitright
let g:netrw_liststyle = 3
let g:shellcmdflag = "-ic"
"set autochdir
" mappings
noremap <CR> i<CR><ESC>
"nnoremap j gj
"nnoremap k gk
"nnoremap <Down> gj
"nnoremap <Up> gk
" brackets
"inoremap { {}<LEFT>
"inoremap [ []<LEFT>
"inoremap ( ()<LEFT>
"inoremap " ""<LEFT>
"inoremap ' ''<LEFT>
"inoremap [5 [% %]<LEFT><LEFT><LEFT>
" search
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
nnoremap <C-i> :<C-u>help<Space>
nnoremap <C-i><C-i> :<C-u>help<Space><C-r><C-w><CR>
nmap <ESC><ESC> :nohlsearch<CR><ESC>
" X clipboard
map <leader>cp :w !xsel -i -b<CR>
map <leader>pp :r!xsel -b<CR>
nnoremap <Leader>gg :<C-U>!git cola<CR>
" Command
" edit temp files
command! -nargs=1 Tmp edit ~/.vim/vim_tmp/tmp.<args>
command! -nargs=1 Temp edit ~/.vim/vim_tmp/tmp.<args>
" search
set history=1000
set ignorecase
set smartcase
set wrapscan
set incsearch
set hlsearch
" display
set title
set number
set ruler
set foldcolumn=1
set showcmd
set wildmenu
set wildchar=<tab>
set wrap
set cursorline
set t_Co=256
hi CursorLine term=reverse cterm=none ctermbg=242
set laststatus=2
set statusline=%F%m%r%h%w[%{&ff}][%{&fileencoding}][%Y][A=\%03.3b][H=\%02.2B][%04l,%04v][%p%%][LEN=%L]%#warningmsg#%{SyntasticStatuslineFlag()}%*
highlight StatusLine term=NONE cterm=NONE ctermfg=black ctermbg=white
set showmatch
set matchtime=2
set textwidth=0
syntax on
" zenkaku space, trail tab
set list
set listchars=tab:»-,trail:-,eol:↲,extends:»,precedes:«,nbsp:%
if has('multi_byte_ime')
highlight Cursor guifg=NONE guibg=Green
highlight CursorIM guifg=NONE guibg=Purple
endif
if has("syntax")
" PODバグ対策
syn sync fromstart
function! ActivateInvisibleIndicator()
syntax match InvisibleJISX0208Space " " display containedin=ALL
highlight InvisibleJISX0208Space term=underline ctermbg=Blue guibg=darkgray gui=underline
endf
augroup invisible
autocmd! invisible
autocmd BufNew,BufRead * call ActivateInvisibleIndicator()
augroup END
endif
set completeopt=menu
if exists('&ambiwidth')
set ambiwidth=double
endif
" if has gui
if has('gui_running')
set guifont=Ricty\ 11
set guioptions-=m " disables menubar
set guioptions-=T " disables toolbar
set guioptions+=c " disables pop up dialog
set cursorline
endif
" edit
set cindent
set tabstop=8
set softtabstop=4
set shiftwidth=4
set expandtab
set smarttab
set backspace=indent,eol,start
set clipboard=unnamed
"autosave
"let g:latest_time = localtime()
"function! g:autosave()
"let now = localtime()
"if (now - g:latest_time) > 300
"echom "auto-save"
"execute "wa"
"let g:latest_time = now
"endif
"endfunction
"autocmd CursorHold * call g:autosave()
" functions
function! s:change_current_dir()
execute ':lcd ' . expand("%:p:h")
endfunction
nnoremap <silent> gc :<C-U>call <SID>change_current_dir()<CR>
function! s:change_kbd()
exe ':!setxkbmap -model jp106 -layout jp'
endfunction
nnoremap <silent> gs :<C-U>call <SID>change_kbd()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment