Skip to content

Commit

Permalink
Merge pull request #6 from circled9/feature/2020
Browse files Browse the repository at this point in the history
俺の設定 2020
  • Loading branch information
Matsui Masashi authored Mar 18, 2020
2 parents bf7263b + cbce8b0 commit 81c7e45
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 141 deletions.
22 changes: 22 additions & 0 deletions .bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ alias ll='ls -al'
alias ls='ls -G'
alias vi='vim'

case ${OSTYPE} in
darwin*)
alias code='open -b com.microsoft.VSCODE'
alias subl='open -b com.sublimetext.3'
alias smerge='open -b com.sublimemerge'
alias stree='open -b com.torusknot.SourceTreeNotMAS'
;;
esac

function cd-fzf() {
moveto=./$(ls -d */ | fzf --reverse)
cd $moveto
Expand All @@ -17,6 +26,19 @@ function vi-fzf() {
vim $moveto
}

function nodenv-fzf() {
nodenv versions | fzf --reverse | sed -e 's/* //g' | xargs nodenv local && nodenv version
}
function rbenv-fzf() {
rbenv versions | fzf --reverse | sed -e 's/* //g' | xargs rbenv local && rbenv version
}
function pyenv-fzf() {
pyenv versions | fzf --reverse | sed -e 's/* //g' | xargs pyenv local && pyenv version
}

alias fcd=cd-fzf
alias cr=ghq-fzf
alias fvi=vi-fzf
alias fjs=nodenv-fzf
alias frb=rbenv-fzf
alias fpy=pyenv-fzf
61 changes: 0 additions & 61 deletions .bash_function

This file was deleted.

52 changes: 3 additions & 49 deletions .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,6 @@ if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
fi
}

# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
if [ "${renamed}" == "0" ]; then
bits=">${bits}"
fi
if [ "${ahead}" == "0" ]; then
bits="*${bits}"
fi
if [ "${newfile}" == "0" ]; then
bits="+${bits}"
fi
if [ "${untracked}" == "0" ]; then
bits="?${bits}"
fi
if [ "${deleted}" == "0" ]; then
bits="x${bits}"
fi
if [ "${dirty}" == "0" ]; then
bits="!${bits}"
fi
if [ ! "${bits}" == "" ]; then
echo " ${bits}"
else
echo ""
fi
}

export PS1="\[\e[33m\]\u@\h\[\e[0m\] \W \[\e[35m\]\`parse_git_branch\`\[\e[0m\]\n\$ "
export LSCOLORS=gxfxcxdxbxegedabagacad
export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
eval "$(starship init bash)"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
backup/
20 changes: 4 additions & 16 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
if [ -f ~/.bash_function ]; then
. ~/.bash_function
fi

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "%F{yellow}!"
zstyle ':vcs_info:git:*' unstagedstr "%F{red}+"
zstyle ':vcs_info:*' formats "%F{green}%c%u[%b]%f"
zstyle ':vcs_info:*' actionformats '[%b|%a]'
precmd () { vcs_info }

PROMPT='%F{green}%n@%m%f %. ${vcs_info_msg_0_}
%# '

export PATH="/usr/local/opt/curl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/curl/lib"
export CPPFLAGS="-I/usr/local/opt/curl/include"

export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
eval "$(starship init zsh)"
Empty file added backup/.keep
Empty file.
25 changes: 10 additions & 15 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,15 @@ if ! type anyenv >/dev/null 2>&1; then
git clone https://github.com/riywo/anyenv ~/.anyenv
fi

if [ -e '~/.bashrc' ]; then
mv ~/.bashrc ~/.bashrc.`date "+%Y%m%d_%H%M%S"`
echo '.bashrc backed up !'
fi

if [ -e '~/.bash_profile' ]; then
mv ~/.bash_profile ~/.bash_profile.`date "+%Y%m%d_%H%M%S"`
echo '.bash_profile backed up !'
fi

cp ./.bashrc ~/.bashrc
echo '.bashrc copied !'

cp ./.bash_profile ~/.bash_profile
echo '.bash_profile copied !'
files=(".zshrc" ".bashrc" ".bash_profile" ".bash_aliases")
for file in ${files[@]}
do
if [ -e ~/${file} ]; then
mv ~/${file} ./backup/${file}
echo mv ~/${file} ./backup/${file}
fi
cp ./${file} ~/${file}
echo cp ./${file} ~/${file}
done

exec $SHELL -l
10 changes: 10 additions & 0 deletions import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

targets=(".zshrc" ".bashrc" ".bash_profile" ".bash_aliases")
for target in ${targets[@]}
do
if [ -e ~/${target} ]; then
cp ~/${target} ./${target}
echo cp ~/${target} ./${target}
fi
done

0 comments on commit 81c7e45

Please sign in to comment.