Advertisement
pharmokan

bash.rc mac

Feb 26th, 2021 (edited)
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. [ -f /Users/${USER}/.fzf.zsh ] && source /Users/${USER}/.fzf.zsh
  2. [ -f $(brew --prefix)/etc/profile.d/autojump.sh ] && . $(brew --prefix)/etc/profile.d/autojump.sh
  3. export ZSH="/Users/${USER}/.oh-my-zsh/"
  4. export PATH="${HOME}/bin:${PATH}"
  5.  
  6. HISTSIZE=100000
  7. SAVEHIST=100000
  8.  
  9. source $ZSH/oh-my-zsh.sh
  10. source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
  11.  
  12. plugins=(zsh-autosuggestions)
  13.  
  14. alias src='source ~/.zshrc'
  15. alias bashrc='sublime ~/.zshrc'
  16. alias karabiner='sublime ~/.config/karabiner.edn'
  17. alias cf='den env exec -T php-fpm n98-magerun c:f'
  18. alias sup='den env exec -T php-fpm bin/magento setup:upgrade --keep-generated'
  19. alias db='den env exec -T php-fpm n98-magerun db:cons'
  20. alias gs='git status'
  21. alias gp='git pull'
  22.  
  23.  
  24. export NVM_DIR="$HOME/.nvm"
  25. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  26. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
  27.  
  28.  
  29. parse_git_branch() {
  30. git_status="$(git status 2> /dev/null)"
  31. pattern="On branch ([^[:space:]]*)"
  32.  
  33. if [[ ${git_status} =~ ${pattern} ]]; then
  34. branch=${match[1]}
  35. branch_cut=${branch:0:29}
  36. if (( ${#branch} > ${#branch_cut} )); then
  37. echo "[${branch_cut}…]"
  38. else
  39. echo "[${branch}]"
  40. fi
  41. fi
  42. }
  43.  
  44. setopt PROMPT_SUBST
  45. PROMPT='%{%F{red}%}%9c%{%F{none}%}%{%F{green}%} $(parse_git_branch) %{%F{none}%} $ '
  46.  
  47. fzfg ()
  48. {
  49. setopt localoptions noglobsubst noposixbuiltins pipefail 2> /dev/null;
  50. rg -n '' $@ | sed -e 's/:/+/' -e 's/:/\t/' -e 's/+/:/' -e 's/\\/\//g' | fzf | cut -f 1 | cut -d ':' -f 1 | xargs sublime
  51. }
  52.  
  53. fzfd ()
  54. {
  55. fd -t d . | fzf | pbcopy
  56. }
  57.  
  58. gf ()
  59. {
  60. git branch | grep -i $1
  61. }
  62.  
  63. gcb ()
  64. {
  65. git checkout -b $1
  66. }
  67.  
  68. gcp ()
  69. {
  70. git cherry-pick $1
  71. }
  72.  
  73. ff ()
  74. {
  75. find . -name "*$1*";
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement