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
# unique MRC(most recently checkouted, like MRU) checkouted branchs or commit hashs -> branch name or commit hash | |
_gm() { | |
is_in_git_repo || return | |
git --no-pager reflog | awk '$3 == "checkout:" && /moving from/ {print $8}' | uniq | \ | |
awk ' | |
BEGIN { memo[0]=""; results[0]=""; } { if(!($0 in memo)) | |
{ memo[$0] = 1; results[length(results)] = $0; } } | |
END { for(i=1; i<length(results); i++) print results[i] } | |
' | \ | |
fzf-down -m --preview 'git show --color=always {1}' --prompt="refs> " |
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
" source | |
function! s:list_commits() abort | |
let l:res = system('git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --color=always') | |
return split(l:res, "\n") | |
endfunction | |
" sink | |
function! s:select_commits(commit_hash) abort | |
let l:list = split(a:commit_hash, ' ') | |
let l:execute_command = 'Git show ' . l:list[1] . ':%' | |
execute l:execute_command |
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
" deletes buffers by fzf | |
" ref: https://github.com/junegunn/fzf.vim/pull/733#issuecomment-559720813 | |
function! s:list_buffers_customized() | |
redir => list | |
silent ls | |
redir END | |
let l:res = [] | |
let l:raw_lines = split(list, "\n") | |
for l:raw_line in raw_lines |
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
" show zsh command history | |
if getftype(expand('$HOME') . '/.zhistory') != "" | |
function! s:showShellHistory(...) | |
execute 'botright' 10 'new' | |
setlocal nobuflisted bufhidden=unload buftype=nofile | |
silent read !cat $HOME/.zhistory | cut -b 16- | head -n 5000 | |
if a:0 == 1 | |
let l:exe_com = 'v/' . a:1 . '/d' | |
execute l:exe_com | |
endif |
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
if executable('trans') | |
function! s:printToTempBuffer(exe_command) | |
execute 'botright' 10 'new' | |
setlocal nobuflisted bufhidden=unload buftype=nofile | |
execute a:exe_command | |
norm gg | |
setlocal nomodified | |
endfunction | |
function! s:engToJapa(arg) |
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
if executable('nkf') | |
function! s:nkf(has_bang, ...) abort range | |
execute 'silent' a:firstline ',' a:lastline '!nkf -Z0' | |
endfunction | |
command! -bar -bang -range=% -nargs=? Nkf <line1>,<line2>call s:nkf(<bang>0, <f-args>) | |
endif |
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
function! s:buildGitHubPRSearchURL(...) | |
" GitHub PR search link | |
let l:shell_one_liner = 'git remote -v | ' | |
\ . 'grep "github" | ' | |
\ . 'cut -d":" -f2 | ' | |
\ . 'cut -d"." -f1 | ' | |
\ . 'sort | uniq | ' | |
\ . 'awk ''{ printf "https://github.com/%s/pulls?q=is:pr is:closed ", $1 }''' | |
let l:command_result = system(l:shell_one_liner) |
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
# TodoList | |
* [x] ボタンを押すとコーラが出る | |
* お金 100円 を入れてボタンを押すとコーラが出る。 100円以外は受け付けない。 | |
* [x] 自販機の構造体を作る | |
* [x] コーラボタンを作る | |
* [x] 100円を入れる | |
* [x] 10円を入れる | |
* [x] 100円が入っているかどうかを判定する | |
* [x] 100円が入っている状態でボタンを押すとコーラが出る |