Last active
March 9, 2020 05:59
-
-
Save sawa2d2/d09d5718254509cf35cacbb5cda11935 to your computer and use it in GitHub Desktop.
fish script
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
| # peco_ghq.fish | |
| # https://public-constructor.com/fish-ghq/ | |
| function ghq_peco_repo | |
| set selected_repository (ghq list -p | peco --query "$LBUFFER") | |
| if [ -n "$selected_repository" ] | |
| cd $selected_repository | |
| echo "$selected_repository" | |
| commandline -f repaint | |
| end | |
| end |
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 fish_user_key_bindings | |
| bind \cr 'peco_select_history (commandline -b)' | |
| bind \cg ghq_peco_repo | |
| bind \c] peco_change_directory # Bind for prco change directory to Ctrl+] | |
| end |
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
| # peco_change_directory.fish | |
| # https://qiita.com/susieyy/items/ac2133e249f252dc9a34 | |
| function _peco_change_directory | |
| if [ (count $argv) ] | |
| peco --layout=bottom-up --query "$argv "|perl -pe 's/([ ()])/\\\\$1/g'|read foo | |
| else | |
| peco --layout=bottom-up |perl -pe 's/([ ()])/\\\\$1/g'|read foo | |
| end | |
| if [ $foo ] | |
| builtin cd $foo | |
| else | |
| commandline '' | |
| end | |
| end | |
| function peco_change_directory | |
| begin | |
| echo $HOME/Documents | |
| echo $HOME/Desktop | |
| echo $HOME/.config | |
| ls -ad */|perl -pe "s#^#$PWD/#"|egrep -v "^$PWD/\."|head -n 5 | |
| sort -r -t '|' -k 3 ~/.z|sed -e 's/\|.*//' | |
| ghq list -p | |
| ls -ad */|perl -pe "s#^#$PWD/#"|grep -v \.git | |
| end | sed -e 's/\/$//' | awk '!a[$0]++' | _peco_change_directory $argv | |
| end |
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
| # oh-my-fish | |
| curl -L https://get.oh-my.fish | fish | |
| # bobthefish | |
| fisher add oh-my-fish/theme-bobthefish | |
| # peco (選択型インタフェース) | |
| brew install peco | |
| fisher add oh-my-fish/plugin-peco | |
| echo "function fish_user_key_bindings"\n" bind \cr 'peco_select_history (commandline -b)'"\n"end" > ~/.config/fish/conf.d/peco.fish | |
| # keybind for peco | |
| mkdir ~/.peco | |
| echo '{'\n' "Keymap": {'\n' "C-j": "peco.SelectDown",'\n' "C-k": "peco.SelectUp"'\n' }'\n'}' > ~/.peco/config.json | |
| # z (cdの移動履歴から移動) | |
| fisher add jethrokuan/z | |
| # ghq (リポジトリを一元管理) | |
| go get github.com/motemen/ghq | |
| echo 'function ghq_peco_repo'\n' set selected_repository (ghq list -p | peco --query "$LBUFFER")'\n' if [ -n "$selected_repository" ]'\n' cd $selected_repository'\n' echo "$selected_repository"'\n' commandline -f repaint'\n' end'\n'end'\n\n'function fish_user_key_bindings'\n' bind /cg ghq_peco_repo #<Ctrl-g>'\n'end' > ~/.config/fish/conf.d/peco_ghq.fish | |
| # bass ("bass [command]" でbash用コマンドをfish上で実行) | |
| fisher add edc/bass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment