" encoding set encoding=utf-8 scriptencoding utf-8 " これで開こうとする set fileencodings=utf-8,cp932,sjis,euc-jp " これで保存しようとする set fileencoding=utf-8 set termencoding=utf-8 nnoremap ' let g:mapleader = "'" " https://github.com/rhysd/dotfiles augroup MyVimrc autocmd! augroup END command! -nargs=* AutoCmd autocmd MyVimrc " 多分これ壊れてる command! NXOmap -nargs=+ nmap | xmap | omap if has('vim_starting') set runtimepath+=~/.vim/bundle/neobundle.vim/ endif let g:neobundle#install_max_processes = 20 call neobundle#begin(expand('~/.vim/bundle/')) function! s:load_bundles() NeoBundleFetch 'Shougo/neobundle.vim' " 補完 NeoBundle 'Shougo/neocomplete', { \ 'depends': ['Shougo/context_filetype.vim', 'ujihisa/neco-look', 'Shougo/neco-syntax'], \ } NeoBundle 'Shougo/neosnippet' NeoBundle 'Shougo/neosnippet-snippets' NeoBundleFetch 'tekkoc/PHPSnippetsCreator' NeoBundle 'pocke/neosnippet-incomment' NeoBundle 'pocke/iro.vim' NeoBundleLazy 'kana/vim-smartinput', { \ 'on_i': 1, \ } NeoBundle 'mattn/emmet-vim' function! TextobjConfig(mappings) abort return { \ 'depends': 'kana/vim-textobj-user', \ 'on_map': map(a:mappings, '["xo", v:val]'), \ } endfunction NeoBundleLazy 'terryma/vim-expand-region', { \ 'on_map': ['(expand_region_'], \ } NeoBundleLazy 'kana/vim-textobj-user' NeoBundleLazy 'kana/vim-textobj-entire', \ TextobjConfig(['ae', 'ie']) NeoBundleLazy 'whatyouhide/vim-textobj-xmlattr', \ TextobjConfig(['ax', 'ix']) delfunction TextobjConfig function! OperatorConfig(mappings) return { \ 'depends': 'kana/vim-operator-user', \ 'on_map': a:mappings, \ } endfunction NeoBundleLazy 'kana/vim-operator-user' NeoBundleLazy 'rhysd/vim-operator-surround', \ OperatorConfig('(operator-surround-') NeoBundleLazy 'emonkak/vim-operator-comment', \ OperatorConfig(['(operator-comment)', '(operator-uncomment)', '(operator-uncomment)(operator-uncomment)', '(operator-comment)(operator-comment)']) NeoBundleLazy 'tyru/operator-camelize.vim', \ OperatorConfig('(operator-camelize-toggle)') NeoBundleLazy 'kana/vim-operator-replace', \ OperatorConfig('(operator-replace)') NeoBundleLazy 'pocke/vim-operator-trailing-space', \ OperatorConfig('(operator-trailing-space') delfunction OperatorConfig NeoBundle 'thinca/vim-splash' NeoBundle 'pocke/ansi_color.vim' NeoBundle 'itchyny/lightline.vim' NeoBundleLazy 'haya14busa/incsearch.vim', { \ 'on_map': ['(incsearch-'], \ } NeoBundle 'w0ng/vim-hybrid' " ぬるぬるスクロール NeoBundle 'yuttie/comfortable-motion.vim' NeoBundleLazy 'easymotion/vim-easymotion', { \ 'on_map': ['(easymotion-'] \ } NeoBundle 'haya14busa/vim-edgemotion' NeoBundleLazy 'rhysd/clever-f.vim', { \ 'on_map': ['f', 'F', 't'] \ } function! FiletypeConfig(ft) return { \ 'on_ft': a:ft, \ } endfunction NeoBundleLazy 'jelera/vim-javascript-syntax', \ FiletypeConfig("javascript") NeoBundle 'jason0x43/vim-js-indent' NeoBundleLazy 'kchmck/vim-coffee-script', \ FiletypeConfig("coffee") NeoBundleLazy 'AndrewRadev/vim-eco', { \ 'on_ft': 'eco', \ 'depends': ['kchmck/vim-coffee-script'] \ } NeoBundleLazy 'leafgarland/typescript-vim', \ FiletypeConfig("typescript") NeoBundleLazy 'Quramy/tsuquyomi', \ FiletypeConfig("typescript") NeoBundleLazy 'hail2u/vim-css3-syntax', \ FiletypeConfig("css") NeoBundleLazy 'groenewege/vim-less', \ FiletypeConfig("less") NeoBundleLazy 'wavded/vim-stylus', \ FiletypeConfig("stylus") NeoBundleLazy 'slim-template/vim-slim', \ FiletypeConfig("slim") NeoBundleLazy 'othree/html5.vim', \ FiletypeConfig("html") NeoBundleLazy 'derekwyatt/vim-scala', \ FiletypeConfig("scala") NeoBundleLazy 'derekwyatt/vim-sbt', \ FiletypeConfig("sbt") NeoBundleLazy 'fatih/vim-go', \ FiletypeConfig("go") NeoBundleLazy 'yosssi/vim-ace', \ FiletypeConfig("ace") NeoBundleLazy 'cespare/vim-toml', \ FiletypeConfig("toml") " If lazy, compound filetype is wrong... NeoBundleLazy 'PProvost/vim-ps1', \ FiletypeConfig("ps1") NeoBundleLazy 'keith/tmux.vim', \ FiletypeConfig("tmux") NeoBundleLazy 'OrangeT/vim-csharp', \ FiletypeConfig(['cs', 'csi', 'csx']) NeoBundleLazy 'keith/swift.vim', \ FiletypeConfig('swift') NeoBundleLazy 'pocke/swift-ide-test-comp.vim', \ FiletypeConfig('swift') NeoBundleLazy 'davidhalter/jedi-vim', \ FiletypeConfig('python') NeoBundleLazy 'rgrinberg/vim-ocaml', \ FiletypeConfig(['ocaml', 'oasis', 'ocamlbuild_tags', 'omake', 'opam', 'sexplib']) NeoBundleLazy 'msteinert/vim-ragel', \ FiletypeConfig('ragel') NeoBundleLazy 'google/vim-jsonnet', \ FiletypeConfig('jsonnet') NeoBundleLazy 'evanphx/kpeg/', {'on_ft': 'kpeg', 'rtp': 'vim/syntax_kpeg'} NeoBundleLazy 'Shougo/denite.nvim', { \ 'on_cmd': [ "Denite"], \ 'depends': ['nixprime/cpsm/'], \ } NeoBundleLazy 'nixprime/cpsm', { \ 'build': 'sh -c "PY3=ON ./install.sh"' \ } NeoBundle 'sudo.vim' NeoBundleLazy 'editorconfig/editorconfig-vim' " 非同期処理 NeoBundle 'Shougo/vimproc.vim', { \ 'build' : { \ 'windows' : 'make -f make_mingw32.mak', \ 'cygwin' : 'make -f make_cygwin.mak', \ 'mac' : 'make -f make_mac.mak', \ 'unix' : 'make -f make_unix.mak' \ } \ } NeoBundleLazy 'tyru/open-browser.vim' NeoBundleLazy 'tyru/open-browser-github.vim', { \ 'on_cmd': ['OpenGithubFile'], \ 'depends': ['tyru/open-browser.vim'], \ } " コマンド実行 NeoBundleLazy 'thinca/vim-quickrun', { \ 'on_map': [['nxo', '(quickrun)']], \ 'on_cmd': 'QuickRun', \ } " 構文チェック NeoBundleLazy 'osyo-manga/vim-watchdogs', { \ 'on_cmd': ['WatchdogsRun'], \ 'depends': [ \ 'thinca/vim-quickrun', \ 'Shougo/vimproc.vim', \ 'osyo-manga/shabadou.vim', \ 'pocke/vim-hier', \ 'dannyob/quickfixstatus' \ ] \ } NeoBundle 'prettier/vim-prettier', {'build': 'yarn install'} " Visual Mode でも * で検索 NeoBundleLazy 'haya14busa/vim-asterisk', { \ 'on_map': ['(incsearch-nohl)(asterisk-'], \ 'depends': ['haya14busa/incsearch.vim'] \ } " git NeoBundle 'rhysd/committia.vim' " window管理 NeoBundle 'pocke/vim-automatic', { \ 'depends': ['osyo-manga/vim-gift'] \ } " Buffer移動 NeoBundleLazy 'kana/vim-altr', { \ 'on_map': '(altr-', \ } NeoBundleLazy 'vim-jp/vimdoc-ja' "}}} NeoBundle 'mopp/autodirmake.vim' NeoBundle 'kana/vim-arpeggio' NeoBundle 'vim-jp/vital.vim' endfunction call s:load_bundles() call neobundle#end() filetype plugin indent on " Required! "}}} call arpeggio#load() if neobundle#tap('neocomplete') " 起動時に有効化 let g:neocomplete#enable_at_startup = 1 " 大文字が入力されるまで大文字小文字の区別を無視する let g:neocomplete#enable_smart_case = 1 " _(アンダースコア)区切りの補完を有効化 let g:neocomplete#enable_underbar_completion = 1 let g:neocomplete#enable_camel_case_completion = 1 " ポップアップメニューで表示される候補の数 let g:neocomplete#max_list = 20 " シンタックスをキャッシュするときの最小文字長 let g:neocomplete#sources#syntax#min_keyword_length = 3 " 補完を表示する最小文字数 let g:neocomplete#auto_completion_start_length = 2 " preview window を閉じない let g:neocomplete#enable_auto_close_preview = 0 let g:neocomplete#max_keyword_width = 10000 let g:neocomplete#sources#tags#cache_limit_size = 10000000 if !exists('g:neocomplete#delimiter_patterns') let g:neocomplete#delimiter_patterns= {} endif let g:neocomplete#delimiter_patterns.ruby = ['::'] if !exists('g:neocomplete#same_filetypes') let g:neocomplete#same_filetypes = {} endif let g:neocomplete#same_filetypes.ruby = 'eruby' if !exists('g:neocomplete#force_omni_input_patterns') let g:neocomplete#force_omni_input_patterns = {} endif let g:neocomplete#force_omni_input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\w*\|\h\w*::\w*' let g:neocomplete#force_omni_input_patterns.typescript = '[^. \t]\.\%(\h\w*\)\?' " Same as JavaScript let g:neocomplete#force_omni_input_patterns.go = '[^. \t]\.\%(\h\w*\)\?' " Same as JavaScript let s:neco_dicts_dir = $HOME . '/ghq/github.com/pocke/dicts/' if isdirectory(s:neco_dicts_dir) let g:neocomplete#sources#dictionary#dictionaries = { \ 'ruby': s:neco_dicts_dir . '/ruby.dict', \ 'javascript': s:neco_dicts_dir . '/jquery.dict', \ } endif let g:neocomplete#data_directory = $HOME . '/.vim/cache/neocomplete' call neocomplete#custom#source('look', 'min_pattern_length', 1) call neobundle#untap() endif "}}} if neobundle#tap('neosnippet') "http://kazuph.hateblo.jp/entry/2013/01/19/193745 " : completion. inoremap pumvisible() ? "\" : "\" " Plugin key-mappings. imap :let g:neosnippet_expanding_or_jumpping = 1a(neosnippet_expand_or_jump) smap (neosnippet_expand_or_jump) " SuperTab like snippets behavior. imap pumvisible() ? "\" : neosnippet#jumpable() ? "\(neosnippet_expand_or_jump)" : "\" smap neosnippet#jumpable() ? "\(neosnippet_expand_or_jump)" : "\" " For snippet_complete marker. if has('conceal') set conceallevel=2 concealcursor=i endif " Enable snipMate compatibility feature. let g:neosnippet#enable_snipmate_compatibility = 1 let g:neosnippet#snippets_directory='~/dotfiles/snippets' AutoCmd InsertLeave * syntax clear neosnippetConcealExpandSnippets AutoCmd FileType php NeoSnippetSource ~/.vim/bundle/PHPSnippetsCreator/dist/php_functions.snip AutoCmd BufNewFile,BufRead Gemfile NeoSnippetSource ~/dotfiles/snippets/Gemfile.snip AutoCmd BufNewFile,BufRead *db/migrate* NeoSnippetSource ~/dotfiles/snippets/rails_migration.snip AutoCmd BufNewFile,BufRead * let b:neosnippet_disable_snippet_triggers = ['fname', 'path'] call neobundle#untap() endif "}}} if neobundle#tap('vim-smartinput') function! neobundle#tapped.hooks.on_source(bundle) call smartinput#define_rule({ \ 'at': '\s\+\%#', \ 'char': '', \ 'input': ":call setline('.', substitute(getline('.'), '\\s\\+$', '', ''))", \ }) call smartinput#map_to_trigger('i', '#', '#', '#') call smartinput#define_rule({ \ 'at': '\v(''[^"]*)@', \ 'filetype': ['ruby', 'ruby.rspec'], \ 'syntax': ['Constant', 'Special'], \ }) call smartinput#map_to_trigger('i', '', '', '') call smartinput#define_rule({ \ 'at': '\({\|\\)\s*\%#', \ 'char': '', \ 'input': '', \ 'filetype': ['ruby', 'ruby.rspec'], \ }) call smartinput#map_to_trigger('i', '(smartinput_CR)', '', '') endfunction call neobundle#untap() endif if neobundle#tap('vim-trip') nmap (trip-increment) nmap (trip-decrement) call neobundle#untap() endif if neobundle#tap('vim-expand-region') map (expand_region_expand) map (expand_region_shrink) function! neobundle#tapped.hooks.on_source(bundle) let g:expand_region_text_objects = { \ "i'": 0, \ 'i"': 0, \ "i`": 0, \ 'i)': 0, \ 'i}': 0, \ 'i]': 0, \ 'ae': 1, \ } let g:expand_region_text_objects_html = copy(g:expand_region_text_objects) let g:expand_region_text_objects_html.it = 1 let g:expand_region_text_objects_html.ax = 1 endfunction call neobundle#untap() endif if neobundle#tap('vim-operator-surround') Arpeggio map sa (operator-surround-append) Arpeggio map sd (operator-surround-delete) Arpeggio map sr (operator-surround-replace) call neobundle#untap() endif if neobundle#tap('vim-operator-comment') Arpeggio map co (operator-comment) Arpeggio map cu (operator-uncomment) Arpeggio map CO (operator-comment)(operator-comment) Arpeggio map CU (operator-uncomment)(operator-uncomment) call neobundle#untap() endif if neobundle#tap('operator-camelize.vim') Arpeggio map ca (operator-camelize-toggle) call neobundle#untap() endif if neobundle#tap('vim-operator-replace') map - (operator-replace) call neobundle#untap() endif if neobundle#tap('vim-operator-trailing-space') map (operator-trailing-space) call neobundle#untap() endif if neobundle#tap('vim-splash') let g:splash#path = $HOME . '/dotfiles/octocat.txt' " Don't work starting 'vim -t {tag}' autocmd BufReadPre * autocmd! plugin-splash VimEnter call neobundle#untap() endif if neobundle#tap('lightline.vim') let g:lightline = { \ 'active': { \ 'left': [ \ ['mode'], \ ['readonly', 'filename', 'modified'], \ ] \ }, \ 'component': {}, \ 'component_visible_condition': {}, \ } call neobundle#untap() endif if neobundle#tap('incsearch.vim') map / (incsearch-forward) map g/ (incsearch-stay) function neobundle#tapped.hooks.on_post_source(bundle) let g:incsearch#magic = '\v' let g:incsearch#auto_nohlsearch = 1 NXOmap n (incsearch-nohl-n)zz NXOmap N (incsearch-nohl-N)zz IncSearchNoreMap zz IncSearchNoreMap endfunction call neobundle#untap() endif if neobundle#tap('comfortable-motion.vim') nnoremap :call comfortable_motion#flick(100) nnoremap :call comfortable_motion#flick(-100) nnoremap :call comfortable_motion#flick(400) nnoremap :call comfortable_motion#flick(-400) endif if neobundle#tap('vim-easymotion') let g:EasyMotion_smartcase = 1 let g:EasyMotion_use_migemo = 1 nmap e (easymotion-s2) call neobundle#untap() endif if neobundle#tap('clever-f.vim') function! neobundle#tapped.hooks.on_source(bundle) let g:clever_f_ignore_case = 1 let g:clever_f_fix_key_direction = 1 let g:clever_f_chars_match_any_signs = "\" endfunction call neobundle#untap() endif if neobundle#tap('vim-edgemotion') map j (edgemotion-j) map k (edgemotion-k) call neobundle#untap() endif if neobundle#tap('clever-f.vim') function! neobundle#tapped.hooks.on_source(bundle) let g:clever_f_ignore_case = 1 let g:clever_f_fix_key_direction = 1 let g:clever_f_chars_match_any_signs = "\" endfunction call neobundle#untap() endif let g:tsuquyomi_disable_quickfix = 1 let g:tsuquyomi_completion_detail = 1 if neobundle#tap('vim-css3-syntax') AutoCmd FileType css setlocal iskeyword+=- call neobundle#untap() endif if neobundle#tap('vim-go') function! neobundle#tapped.hooks.on_source(bundle) let g:go_gocode_unimported_packages = 1 if executable("goimports") let g:go_fmt_command = "goimports" endif function! s:go_cmd_alias() abort command! -nargs=1 -buffer -complete=customlist,go#package#Complete Import GoImport command! -nargs=? -buffer Rename GoRename nmap ? (go-info) endfunction AutoCmd FileType go call s:go_cmd_alias() let $GOGC='off' endfunction call neobundle#untap() endif if neobundle#tap('denite.nvim') function! neobundle#tapped.hooks.on_source(bundle) call denite#custom#map('insert', "", "", 'noremap') call denite#custom#map('insert', "", "", 'noremap') call denite#custom#source( \ 'file_rec', 'matchers', ['matcher_cpsm']) if executable('rg') call denite#custom#var('grep', 'command', ['rg']) call denite#custom#var('grep', 'recursive_opts', []) call denite#custom#var('grep', 'final_opts', []) call denite#custom#var('grep', 'separator', ['--']) call denite#custom#var('grep', 'default_opts', \ ['--vimgrep', '--no-heading']) endif call denite#custom#alias('source', 'file_rec/git', 'file_rec') call denite#custom#var('file_rec/git', 'command', \ ['git', 'ls-files', '-co', '--exclude-standard']) endfunction nnoremap (denite) nmap u (denite) nnoremap (denite)t :Denite -default-action=tabswitch `finddir('.git', ';') != '' ? 'file_rec/git' : 'file_rec'` nnoremap (denite)u :Denite -default-action=switch `finddir('.git', ';') != '' ? 'file_rec/git' : 'file_rec'` nnoremap (denite)v :vs:Denite `finddir('.git', ';') != '' ? 'file_rec/git' : 'file_rec'` nnoremap (denite)s :sp:Denite `finddir('.git', ';') != '' ? 'file_rec/git' : 'file_rec'` nnoremap (denite)G :Denite -default-action=tabopen grep nnoremap (denite)g :DeniteCursorWord -default-action=tabopen grep nnoremap (denite)b :Denite buffer -default-action=switch call neobundle#untap() endif if neobundle#tap('vim-ref') silent! nmap K (ref-keyword) silent! vmap K (ref-keyword) let g:ref_cache_dir = $HOME . '/.vim/cache/vim-ref' AutoCmd FileType ref nnoremap q c call neobundle#untap() endif if neobundle#tap('editorconfig-vim') function! s:load_editorconfig() if findfile('.editorconfig', '.;') != '' NeoBundleSource editorconfig-vim EditorConfigReload endif endfunction AutoCmd VimEnter * call s:load_editorconfig() call neobundle#untap() endif if neobundle#tap('open-browser.vim') let s:cmd = has('mac') ? 'open' : 'xdg-open' let g:openbrowser_browser_commands = [{ \ "name": s:cmd, \ "args": ["{browser}", "{uri}"] \ }] unlet s:cmd call neobundle#untap() endif if neobundle#tap('vim-quickrun') let g:quickrun_config = { \ '_': { \ 'runner': 'vimproc', \ 'runner/vimproc/updatetime': 60, \ 'tempfile': '%{expand("%:p:h") . "/" . system("echo -n $(uuidgen)")}' \ }, \ 'markdown': { \ 'type': 'markdown/gfm', \ 'outputter': 'browser' \ }, \ } AutoCmd FileType quickrun AnsiEsc nnoremap r :QuickRun call neobundle#untap() endif if neobundle#tap('vim-watchdogs') augroup source-watchdogs autocmd! autocmd BufWritePre * NeoBundleSource vim-watchdogs autocmd BufWritePre * autocmd! source-watchdogs augroup END AutoCmd FileType go command! -buffer Build WatchdogsRun watchdogs_checker/go_build AutoCmd FileType go command! -buffer Test WatchdogsRun watchdogs_checker/go_test AutoCmd FileType ruby command! -buffer Rubocop WatchdogsRun watchdogs_checker/rubocop let g:hier_highlight_group_qf = 'Error' function! neobundle#tapped.hooks.on_source(bundle) try let s:quickfix4watchdogs = quickrun#outputter#loclist#new() catch /s:save_cpo/ let s:quickfix4watchdogs = quickrun#outputter#loclist#new() endtry function! s:quickfix4watchdogs.finish(session) call call(quickrun#outputter#quickfix#new().finish, [a:session], self) HierUpdate QuickfixStatusEnable endfunction let s:quickfix4watchdogs.name = 'quickfix4watchdogs' let s:quickfix4watchdogs.kind = 'outputter' call quickrun#module#register(s:quickfix4watchdogs) let g:quickrun_config['watchdogs_checker/_'] = { \ "outputter": "quickfix4watchdogs" \ } let g:quickrun_config['watchdogs_checker/go_build'] = { \ 'command': 'go', \ 'exec': '%c build %o ./%s:.:h', \ "errorformat" : '%f:%l: %m,%-G%.%#', \ } let g:quickrun_config['watchdogs_checker/go_test'] = { \ 'command': 'go', \ 'exec': '%c test %o ./%s:.:h', \ "errorformat" : '%f:%l: %m,%-G%.%#', \ } let g:quickrun_config['watchdogs_checker/go_metalinter'] = { \ 'command': 'gometalinter', \ 'exec': '%c --fast --disable=golint --disable=gas --dupl-threshold 100 %o ./%s:.:h', \ 'errorformat': '%f:%l:%c:%*[^:]:%m,%f:%l::%*[^:]:%m' \ } let g:quickrun_config['c/watchdogs_checker'] = { \ "type": "watchdogs_checker/gcc", \ "cmdopt": '%{PathToGccOpt()}', \ } let g:quickrun_config['watchdogs_checker/ruby'] = { \ "command" : "ruby", \ "exec" : "%c %o -c %s:p > /dev/null", \ } let g:quickrun_config['watchdogs_checker/jsonlint'] = { \ "command" : "jsonlint", \ "exec" : "%c %o -c %s:p > /dev/null", \ "errorformat" : '%f: line %l\\, col %c\\, %m', \ } let g:quickrun_config['ruby.rspec/watchdogs_checker'] = {'type': 'watchdogs_checker/ruby'} let g:quickrun_config['go/watchdogs_checker'] = {'type': 'watchdogs_checker/go_metalinter'} let g:quickrun_config['javascript/watchdogs_checker'] = {'type': ''} let g:watchdogs_check_BufWritePost_enable = 1 call watchdogs#setup(g:quickrun_config) function! PathToGccOpt() let p = &path let sp = split(p, ',') let sp = map(sp, '"-I" . v:val') let result = join(sp, ' ') return result endfunction endfunction call neobundle#untap() endif let g:prettier#autoformat = 0 AutoCmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue call s:run_prettier() function! s:run_prettier() abort let package_json = findfile('package.json', expand('%:p:h') . ';') if package_json == '' return endif let content = readfile(package_json) let enabled = v:false for line in content if line =~# 'prettier' let enabled = v:true break endif endfor if enabled Prettier endif endfunction if neobundle#tap('vim-asterisk') map * (incsearch-nohl)(asterisk-*) map z* (incsearch-nohl)(asterisk-z*) call neobundle#untap() endif if neobundle#tap('committia.vim') let g:committia_hooks = {} function! g:committia_hooks.edit_open(info) setlocal spell imap (committia-scroll-diff-down-half) imap (committia-scroll-diff-up-half) nmap (committia-scroll-diff-down-half) nmap (committia-scroll-diff-up-half) endfunction call neobundle#untap() endif if neobundle#tap('vim-automatic') function! s:my_temp_win_init(config, context) nnoremap q :q endfunction let g:automatic_default_set_config = { \ 'apply': function('s:my_temp_win_init'), \ 'height': '60%', \ 'move': 'bottom' \ } let g:automatic_config = [ \ { \ 'match': { \ 'filetype': 'help', \ 'buftype': 'help' \ }, \ 'set': { \ 'width': 80, \ 'move': 'right', \ 'height': '100%' \ } \ }, \ { \ 'match': { 'bufname': '\V[quickrun output]' }, \ 'set': { \ 'height': 8, \ } \ }, \ ] call neobundle#untap() endif if neobundle#tap('vim-altr') nmap (altr-forward) nmap (altr-back) function neobundle#tapped.hooks.on_source(bundle) " For rails tdd call altr#define('app/%/%.rb', 'spec/%/%_spec.rb') call altr#define('config/locales/%en.%yml', 'config/locales/%ja.%yml') call altr#define('test/test_%.rb', 'test/%_test.rb', 'lib/%.rb', 'spec/%_spec.rb') " For golang test call altr#define('%.go', '%_test.go') call altr#define('db/migrate/*.rb') endfunction call neobundle#untap() endif let g:netrw_http_xcmd = '-L -o' syntax enable " 256色 if $TERM == 'xterm' || $TERM == 'screen-256color' set t_Co=256 endif " カラースキーム colorscheme p set foldcolumn=1 " 何行目の何列目にカーソルがいるか表示 set ruler " 新しい行のインデントを現在行と同じに set autoindent " K で:help set keywordprg="" " 折りたたみ-展開 set foldmethod=manual set nofoldenable set foldlevel=99 set conceallevel=0 " Shift-oで待たされるのを改善 set ttimeoutlen=10 " swapファイルを作らない set noswapfile set helplang=ja,en "indent set expandtab set tabstop=2 set softtabstop=2 set shiftwidth=2 set list set listchars=tab:>- set breakindent " ノーマルモードでoOで改行した時にコメントを追加しない AutoCmd FileType * setlocal formatoptions-=o " インサートモード時にバックスペースを使う set backspace=indent,eol,start " search " 大文字小文字を区別しない " 但し、両方が含まれていれば区別する set ignorecase set smartcase " インクリメンタルサーチ set incsearch " 検索文字の強調 " http://haya14busa.com/vim_highlight_search/ set hlsearch | nohlsearch "titleを表示 set title " 入力中のコマンドを表示 set showcmd " 余裕を持ってスクロール set scrolloff=4 " コマンドラインでの補完を強くする set wildmenu set wildmode=longest:full,full set wildignorecase set history=1000 " ファイルを閉じてもundo if has('persistent_undo') set undodir=~/.vim/undo if ! isdirectory(&undodir) call mkdir(&undodir, 'p') endif set undofile endif " statuslineを表示 set laststatus=2 set noshowmode " 沢山表示 set display& display+=lastline " ビープ音を鳴らさない set visualbell t_vb= set noerrorbells set updatetime=1000 set tabpagemax=1000 " h clipboard-excludeを参照。excludeは一番最後じゃないとだめ set clipboard& clipboard^=unnamedplus if has('mac') set clipboard& clipboard^=unnamed endif set mouse=a set spelllang+=cjk set tildeop if has('mac') set rubydll=/Users/pocke/.rbenv/versions/trunk/lib/libruby.dylib else set rubydll=/home/pocke/.rbenv/versions/trunk/lib/libruby.so endif " Vim script で \ を入力した時にインデントしない let g:vim_indent_cont = 0 " 前回終了したカーソル行に移動 AutoCmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g`\"" | endif " filetype AutoCmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown AutoCmd BufNewFile,BufRead ISSUE_EDITMSG set filetype=markdown AutoCmd BufNewFile,BufRead *.jbuilder set filetype=ruby AutoCmd BufNewFile,BufRead *.jb set filetype=ruby AutoCmd BufNewFile,BufRead Guardfile set filetype=ruby AutoCmd BufNewFile,BufRead .pryrc set filetype=ruby AutoCmd BufNewFile,BufRead *_spec.rb set filetype=ruby.rspec AutoCmd FileType eruby exec 'set filetype=' . 'eruby.' . b:eruby_subtype AutoCmd FileType qf nnoremap | setlocal cursorline AutoCmd CmdwinEnter * nnoremap | setlocal cursorline AutoCmd CmdwinEnter * nnoremap q :q AutoCmd FileType godoc nnoremap q :q AutoCmd FileType qf nnoremap q :q AutoCmd FileType gitcommit if getline(1) == '' | startinsert | endif " TODO: kramdownを書いていると、markdownItalic ではないところで_を使えるが、 " そのような場合にだけ markdownItalic を無効にしたい。 AutoCmd Syntax markdown syntax clear markdownItalic AutoCmd Syntax markdown syntax sync fromstart AutoCmd FileType markdown,text,gitcommit setl spell AutoCmd BufNewFile,BufRead config/locales/*.yml setl spell " 長いFiletypeを省略する AutoCmd FileType js nested setlocal ft=javascript AutoCmd FileType md nested setlocal ft=markdown AutoCmd FileType ruby setl iskeyword+=? let g:ruby_path = "" AutoCmd FileType javascript,typescript setlocal suffixesadd=.js,.jsx,.ts,.tsx " help key mappings AutoCmd FileType help call s:set_help_keymap() function! s:set_help_keymap() if &buftype != 'help' return endif nnoremap nnoremap endfunction AutoCmd VimResized * wincmd = AutoCmd BufWritePost *.go silent call system('go build &') highlight link deniteMatchedChar Normal nnoremap ; : vnoremap ; : " コマンドラインでのC-n|p と Up, Downの入れ替え cnoremap cnoremap cnoremap cnoremap inoremap inoremap cnoremap cnoremap " Esc 2回で強調を解除 " Can't use noh in function function! s:hier_clear() if exists(':HierClear') HierClear endif endfunction nnoremap :nohlsearch:call hier_clear() " タブ移動 nnoremap :tabnext nnoremap :tabprevious " タグジャンプを新しいタブで開く " nnoremap :tab stj =expand('')zz nnoremap :%s/// vnoremap :s/// nnoremap :silent! !tig blame +=line('.') %:redraw! nnoremap w :w nnoremap q :q noremap h ^ noremap l $ nnoremap h nnoremap j nnoremap k nnoremap l nnoremap < nnoremap - nnoremap + nnoremap > inoremap inoremap   nnoremap Q @q nnoremap Y y$ nnoremap :set spell! nnoremap :set cursorcolumn!:set cursorline! vnoremap :set cursorcolumn!:set cursorline! nnoremap x "_x snoremap a iabbrev stirng string iabbrev Ingeter Integer iabbrev cosnt const iabbrev retrun return iabbrev laod load iabbrev recieve receive iabbrev recieved received iabbrev have_recieved have_received iabbrev TOOD TODO iabbrev destory destroy " http://hail2u.net/blog/software/vim-auto-close-quickfix-window.html function! s:auto_close_quickfix() if winnr('$') == 1 && getbufvar(winbufnr(0), '&buftype') == 'quickfix' quit endif endfunction AutoCmd WinEnter * call s:auto_close_quickfix() function! OperatorGoogle(mosion_wize) NeoBundleSource open-browser.vim if line("'[") != line("']") return endif let start = col("'[") - 1 let end = col("']") let sel = strpart(getline('.'), start, end - start) call openbrowser#search(sel) endfunction NeoBundleSource vim-operator-user call operator#user#define('google-search', 'OperatorGoogle') map go (operator-google-search) set rtp+=~/ghq/github.com/the-lambda-church/merlin/vim/merlin set rtp+=~/go/src/github.com/pocke/whichpr/ silent mkspell! ~/.vim/spell/en.utf-8.add let g:iro#enabled_filetypes = { \ 'ruby': 1, \ 'yaml': 1, \ } " TOOD: " - Improve function names " - Use blacklist " - Improve performance " - Plugin-ize function! Define() abort let lowers = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] for ch in lowers execute 'inoremap ' . ch . ' K("' . ch . '")' endfor endfunction function! K(ch) abort let whitelist = ['CR', 'JR', 'RS'] let line = getline('.') let col_n = col('.') if line !~# '\v[A-Z][A-Z]%' . string(col_n) . 'c' return a:ch endif for w in whitelist if line =~# '\V' . w . '\v%' . string(col_n) . 'c' return a:ch endif endfor return "\\" . line[col_n-3] . tolower(line[col_n-2]) . a:ch endfunction call Define() " vim:set foldmethod=marker: