/zsh/zshrc.sh

https://github.com/adalisan/dotfiles_extra · Shell · 78 lines · 47 code · 18 blank · 13 comment · 5 complexity · 1bfecf7b6f1353d7c46d97e05274c3fd MD5 · raw file

  1. # How can I set my default shell to start up tmux https://unix.stackexchange.com/a/113768
  2. if command -v tmux>/dev/null; then
  3. [ -z "$TMUX" ] && exec tmux
  4. else
  5. echo "tmux not installed. Run ./deploy to configure dependencies"
  6. fi
  7. # Settings
  8. export ZSH_DIR=$HOME/configurations-linux/dotfiles_extra/zsh
  9. [[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'
  10. emulate sh -c 'source ~/.aliases'
  11. emulate sh -c 'source ~/.bash_aliases'
  12. #emulate sh -c 'source ~/.bashrc'
  13. source $ZSH_DIR/plugins/fixls.zsh
  14. source $ZSH_DIR/plugins/oh-my-zsh/lib/history.zsh
  15. source $ZSH_DIR/plugins/oh-my-zsh/lib/key-bindings.zsh
  16. source $ZSH_DIR/plugins/oh-my-zsh/lib/completion.zsh
  17. source $ZSH_DIR/plugins/vi-mode.plugin.zsh
  18. source $ZSH_DIR/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
  19. source $ZSH_DIR/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  20. source $ZSH_DIR/keybindings.sh
  21. source $ZSH_DIR/prompt.sh
  22. # Vars
  23. HISTFILE=~/.zsh_history
  24. setopt inc_append_history # To save every command before it is executed
  25. setopt share_history # setopt inc_append_history
  26. # Aliases
  27. alias v='eval $(command -v nvim)'
  28. alias cp='cp -iv' # 'cp' prompt and verbose
  29. alias mv='mv -iv' # 'mv' prompt and verbose
  30. mkdir -p /tmp/log
  31. # Functions
  32. # Custom cd (always ls when into a folder)
  33. c() {
  34. cd $1;
  35. ls;
  36. }
  37. alias cd="c"
  38. # git log alias
  39. alias gg="git log --graph --pretty=format:'%C(blue)%h%Creset%C(magenta)%d%Creset %C(bold)%s%Creset %C(yellow)<%an> %C(cyan)(%ci)%Creset' --abbrev-commit --date=iso"
  40. # Fzf git-log (interactive)
  41. # Source: https://gist.github.com/junegunn/f4fca918e937e6bf5bad
  42. ggshow() {
  43. if [ ! -d .git ];then
  44. echo >&2 "No git repository found."
  45. return 0
  46. fi
  47. gg |
  48. fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \
  49. --bind "ctrl-m:execute:
  50. (grep -o '[a-f0-9]\{7\}' | head -1 |
  51. xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
  52. {}
  53. FZF-EOF"
  54. }
  55. # ripgrep config file defined as an environment variable
  56. # Source: https://github.com/BurntSushi/ripgrep/blob/0.8.0/GUIDE.md#configuration-file
  57. export RIPGREP_CONFIG_PATH="$HOME"/.ripgreprc
  58. # fzf (managed by fzf):
  59. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
  60. export PATH=$HOME/bin:$HOME/.local/bin:$HOME/go/bin:$PATH