Created
September 6, 2009 23:29
-
-
Save kana/182049 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let n = 100000 | |
let t = reltime() | |
for i in range(n) | |
let _ = 0 < v:count ? v:count : 0 | |
endfor | |
echomsg reltimestr(reltime(t)) | |
let t = reltime() | |
for i in range(n) | |
let _ = v:count ? v:count : 0 | |
endfor | |
echomsg reltimestr(reltime(t)) | |
let t = reltime() | |
for i in range(n) | |
let _ = 0 < v:count ? v:count : 0 | |
endfor | |
echomsg reltimestr(reltime(t)) | |
let t = reltime() | |
for i in range(n) | |
let _ = v:count ? v:count : 0 | |
endfor | |
echomsg reltimestr(reltime(t)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" gitで現在開いているファイルの1つ前のバージョンを開く。(require metarw-git) | |
nnoremap <silent> eg :<C-u>call <SID>git_prev_rev()<CR> | |
function! s:git_prev_rev() | |
let path = expand('%') | |
let commit = "HEAD" | |
let l = matchlist(path, 'git:\([^:]\+\):\([^:]\+\)') | |
if len(l) > 0 | |
let commit = l[1] | |
let path = l[2] | |
endif | |
let output = system(printf('git log -n 1 --format="%%h %%s" %s -- %s', | |
\ shellescape(commit . '~'), | |
\ shellescape(path))) | |
if v:shell_error != 0 | |
echoerr 'git log failed with the following reason:' | |
echoerr output | |
return | |
endif | |
let [commit_id, subject] = matchlist(output, '^\(\S*\)\s\(.*\)$')[1:2] | |
silent edit `=printf('git:%s:%s', commit_id, path)` | |
" カーソル移動がしたい? すれば良いじゃない! | |
normal! 3339gghjklfofofofofo | |
echo subject | |
endfunction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.065487 | |
0.933179 | |
0.843261 | |
0.705416 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment