Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created February 5, 2014 09:22
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 rhysd/8819941 to your computer and use it in GitHub Desktop.
Save rhysd/8819941 to your computer and use it in GitHub Desktop.
diff --git a/gitconfig b/gitconfig
index 660103e..8c7682d 100644
--- a/gitconfig
+++ b/gitconfig
@@ -52,3 +52,5 @@
email = lin90162@yahoo.co.jp
[push]
default = simple
+[github]
+ user = rhysd
diff --git a/vimrc b/vimrc
index 6ccd972..c00dbb3 100644
--- a/vimrc
+++ b/vimrc
@@ -453,6 +453,24 @@ function! s:open_calendar_app()
endif
endfunction
+" typo したファイル名を検出
+Autocmd BufWriteCmd *[,*] call s:write_check_typo(expand('<afile>'))
+function! s:write_check_typo(file)
+ let writecmd = 'write'.(v:cmdbang ? '!' : '').' '.a:file
+ if exists('b:write_check_typo_nocheck')
+ execute writecmd
+ return
+ endif
+ let prompt = "possible typo: really want to write to '" . a:file . "'?(y/n):"
+ let input = input(prompt)
+ if input ==# 'YES'
+ execute writecmd
+ let b:write_check_typo_nocheck = 1
+ elseif input =~? '^y\(es\)\=$'
+ execute writecmd
+ endif
+endfunction
+
" 基本マッピング {{{
" ; と : をスワップ
noremap : ;
@@ -590,12 +608,18 @@ inoremap <C-r>+ <C-o>:set paste<CR><C-r>+<C-o>:set nopaste<CR>
" コンマ後には空白を入れる
inoremap , ,<Space>
" 賢く行頭・非空白行頭・行末の移動
-nnoremap <silent>M :<C-u>call <SID>smart_move('g^')<CR>
-nnoremap <silent>H :<C-u>call <SID>smart_move('g0')<CR>
-nnoremap <silent>L :<C-u>call <SID>smart_move('g$')<CR>
+nnoremap <silent>M :<C-u>call <SID>rotate_horizontal_move('g^')<CR>
+nnoremap <silent>H :<C-u>call <SID>rotate_horizontal_move('g0')<CR>
+nnoremap <silent>L :<C-u>call <SID>rotate_horizontal_move('g$')<CR>
+nnoremap gM ^
+nnoremap gH 0
+nnoremap gL $
vnoremap M g^
vnoremap H g0
vnoremap L g$
+vnoremap gM ^
+vnoremap gH 0
+vnoremap gL $
" スクリーン内移動
nnoremap gh H
nnoremap gl L
@@ -678,7 +702,7 @@ AutocmdFT gitrebase nnoremap <buffer><C-f> :<C-u>Fixup<CR>
" 初回のみ a:cmd の動きをして,それ以降は行内をローテートする
let s:smart_line_pos = -1
-function! s:smart_move(cmd)
+function! s:rotate_horizontal_move(cmd)
let line = line('.')
if s:smart_line_pos == line . a:cmd
call <SID>rotate_in_line()
@@ -772,7 +796,6 @@ NeoBundle 'kana/vim-smartinput'
NeoBundle 'kana/vim-niceblock'
NeoBundle 'thinca/vim-scouter'
NeoBundle 'h1mesuke/vim-alignta'
-NeoBundle 'rhysd/gem-gist.vim'
NeoBundle 'rhysd/clever-f.vim', 'dev'
NeoBundle 'rhysd/unite-zsh-cdr.vim'
NeoBundle 'mhinz/vim-signify'
@@ -1089,6 +1112,12 @@ NeoBundleLazy 'daisuzu/rainbowcyclone.vim', {
\ },
\ }
+NeoBundleLazy 'mattn/gist-vim', {
+ \ 'depends' : 'mattn/webapi-vim',
+ \ 'autoload' : {
+ \ 'commands' : 'Gist',
+ \ }
+ \ }
" if_lua プラグイン
let s:meet_neocomplete_requirements = has('lua') && (v:version > 703 || (v:version == 703 && has('patch885')))
@@ -3340,6 +3369,10 @@ endfunction
AutocmdFT python call <SID>jedi_settings()
" }}}
+" gist-vim
+let g:gist_open_browser_after_post = 1
+let g:gist_update_on_write = 0
+
" プラットフォーム依存な設定をロードする "{{{
function! SourceIfExist(path)
if filereadable(a:path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment