shell for mac
This commit is contained in:
@@ -34,8 +34,8 @@ alias ll='ls -palFh --color=auto'
|
|||||||
alias mkdir='mkdir -pv'
|
alias mkdir='mkdir -pv'
|
||||||
alias where='whereis' # zsh builtin
|
alias where='whereis' # zsh builtin
|
||||||
|
|
||||||
alias ps='ps auxf'
|
# alias ps='ps auxf'
|
||||||
alias psg='ps aux | grep -v grep | grep -i -e VSZ -e'
|
# alias psg='ps aux | grep -v grep | grep -i -e VSZ -e'
|
||||||
|
|
||||||
alias wine='LANG=ru_RU.utf8 wine'
|
alias wine='LANG=ru_RU.utf8 wine'
|
||||||
alias wine64='LANG=ru_RU.utf8 wine64'
|
alias wine64='LANG=ru_RU.utf8 wine64'
|
||||||
|
|||||||
@@ -16,13 +16,56 @@ fi
|
|||||||
|
|
||||||
### AAA ##########################################
|
### AAA ##########################################
|
||||||
|
|
||||||
|
isMac() { uname -s | grep -q "Darwin"; }
|
||||||
|
isLinux() { uname -s | grep -q "Linux"; }
|
||||||
|
addPath() { [ -d "$1" ] && export PATH="$1:$PATH"; }
|
||||||
|
safeSource() { [ -s "$1" ] && source "$1" 2>/dev/null || true; }
|
||||||
|
|
||||||
export EDITOR="nano"
|
export EDITOR="nano"
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
export GOPATH="$HOME/.go"
|
||||||
|
|
||||||
|
### MacBook section
|
||||||
|
if isMac; then
|
||||||
|
# brew software
|
||||||
|
if [ -d "/opt/homebrew/bin/" ]; then
|
||||||
|
# brew itself
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv zsh)"
|
||||||
|
addPath "/opt/homebrew/bin/"
|
||||||
|
|
||||||
|
# nvm (not nvim!)
|
||||||
|
safeSource "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
|
||||||
|
safeSource "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
|
||||||
|
fi
|
||||||
|
|
||||||
|
# jbtoolbox
|
||||||
|
addPath "$HOME/Library/Application Support/JetBrains/Toolbox/scripts"
|
||||||
|
|
||||||
|
# orbstack
|
||||||
|
safeSource "$HOME/.orbstack/shell/init.zsh"
|
||||||
|
fi
|
||||||
|
### MacBook section end
|
||||||
|
|
||||||
|
### Ubuntu section
|
||||||
|
if isLinux; then
|
||||||
|
# golang
|
||||||
|
export PATH="$PATH:/usr/local/go/bin"
|
||||||
|
# export GOPATH="$HOME/.go"
|
||||||
|
|
||||||
|
# java
|
||||||
# export JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64"
|
# export JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64"
|
||||||
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
|
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
|
||||||
export PATH="$JAVA_HOME/bin/:$PATH"
|
export PATH="$JAVA_HOME/bin/:$PATH"
|
||||||
export PATH="$PATH:/opt/nvim/bin/"
|
|
||||||
export PATH="$PATH:$HOME/.local/bin/"
|
# nvim (not nvm!)
|
||||||
export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts/"
|
[ -d "/opt/nvim/bin/" ] && export PATH="$PATH:/opt/nvim/bin/"
|
||||||
|
|
||||||
|
# rust cargo
|
||||||
|
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
|
||||||
|
|
||||||
|
# nvm (not nvim!)
|
||||||
|
safeSource "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
|
safeSource "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
|
||||||
if hash composer >/dev/null; then
|
if hash composer >/dev/null; then
|
||||||
composer_home=$(composer config -g home 2>/dev/null)
|
composer_home=$(composer config -g home 2>/dev/null)
|
||||||
@@ -34,23 +77,17 @@ fi
|
|||||||
# export PHPBREW_RC_ENABLE=1
|
# export PHPBREW_RC_ENABLE=1
|
||||||
# [ -f $HOME/.phpbrew/bashrc ] && source $HOME/.phpbrew/bashrc
|
# [ -f $HOME/.phpbrew/bashrc ] && source $HOME/.phpbrew/bashrc
|
||||||
|
|
||||||
# golang
|
|
||||||
export PATH="$PATH:/usr/local/go/bin"
|
|
||||||
export GOPATH="$HOME/.go"
|
|
||||||
|
|
||||||
# rust cargo
|
|
||||||
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
|
|
||||||
|
|
||||||
# nvm
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
|
||||||
|
|
||||||
# The next line updates PATH for Yandex Cloud CLI.
|
# The next line updates PATH for Yandex Cloud CLI.
|
||||||
[ -f "$HOME/yandex-cloud/path.bash.inc" ] && source "$HOME/yandex-cloud/path.bash.inc"
|
[ -f "$HOME/yandex-cloud/path.bash.inc" ] && source "$HOME/yandex-cloud/path.bash.inc"
|
||||||
|
|
||||||
# The next line enables shell command completion for yc.
|
# The next line enables shell command completion for yc.
|
||||||
[ -f "$HOME/yandex-cloud/completion.zsh.inc" ] && source "$HOME/yandex-cloud/completion.zsh.inc"
|
[ -f "$HOME/yandex-cloud/completion.zsh.inc" ] && source "$HOME/yandex-cloud/completion.zsh.inc"
|
||||||
|
|
||||||
# misc
|
# jbtoolbox
|
||||||
[[ -f "$HOME/.profile.local" ]] && source "$HOME/.profile.local"
|
if [ -d "$HOME/.local/share/JetBrains/Toolbox/scripts/" ]; then
|
||||||
|
export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts/"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
### Ubuntu section end
|
||||||
|
|
||||||
|
safeSource "$HOME/.profile.local"
|
||||||
|
|||||||
40
shell/.zshrc
40
shell/.zshrc
@@ -6,13 +6,13 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# If you come from bash you might have to change your $PATH.
|
# If you come from bash you might have to change your $PATH.
|
||||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||||
|
|
||||||
# Path to your oh-my-zsh installation.
|
# Path to your Oh My Zsh installation.
|
||||||
export ZSH="$HOME/.oh-my-zsh"
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
|
||||||
# Set name of the theme to load --- if set to "random", it will
|
# Set name of the theme to load --- if set to "random", it will
|
||||||
# load a random theme each time oh-my-zsh is loaded, in which case,
|
# load a random theme each time Oh My Zsh is loaded, in which case,
|
||||||
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
||||||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
||||||
ZSH_THEME="powerlevel10k/powerlevel10k"
|
ZSH_THEME="powerlevel10k/powerlevel10k"
|
||||||
@@ -77,13 +77,43 @@ ZSH_THEME="powerlevel10k/powerlevel10k"
|
|||||||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
||||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||||
# Add wisely, as too many plugins slow down shell startup.
|
# Add wisely, as too many plugins slow down shell startup.
|
||||||
plugins=(git docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting laravel)
|
plugins=(git docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
# User configuration
|
||||||
|
|
||||||
|
# export MANPATH="/usr/local/man:$MANPATH"
|
||||||
|
|
||||||
|
# You may need to manually set your language environment
|
||||||
|
# export LANG=en_US.UTF-8
|
||||||
|
|
||||||
|
# Preferred editor for local and remote sessions
|
||||||
|
# if [[ -n $SSH_CONNECTION ]]; then
|
||||||
|
# export EDITOR='vim'
|
||||||
|
# else
|
||||||
|
# export EDITOR='nvim'
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# Compilation flags
|
||||||
|
# export ARCHFLAGS="-arch $(uname -m)"
|
||||||
|
|
||||||
|
# Set personal aliases, overriding those provided by Oh My Zsh libs,
|
||||||
|
# plugins, and themes. Aliases can be placed here, though Oh My Zsh
|
||||||
|
# users are encouraged to define aliases within a top-level file in
|
||||||
|
# the $ZSH_CUSTOM folder, with .zsh extension. Examples:
|
||||||
|
# - $ZSH_CUSTOM/aliases.zsh
|
||||||
|
# - $ZSH_CUSTOM/macos.zsh
|
||||||
|
# For a full list of active aliases, run `alias`.
|
||||||
|
#
|
||||||
|
# Example aliases
|
||||||
|
# alias zshconfig="mate ~/.zshrc"
|
||||||
|
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||||
|
|
||||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||||
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
|
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
|
||||||
|
|
||||||
|
### AAA
|
||||||
|
|
||||||
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
|
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
|
||||||
# [[ -f ~/.bashrc.local ]] && source ~/.bashrc.local
|
|
||||||
[[ -f ~/.profile ]] && source ~/.profile
|
[[ -f ~/.profile ]] && source ~/.profile
|
||||||
|
|||||||
40
shell/README.md
Normal file
40
shell/README.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
## Краткое описание файлов
|
||||||
|
|
||||||
|
- `.bashrc` — bash для интерактивного non-login: история, prompt, aliases, completion.
|
||||||
|
- `.zshrc` — zsh для интерактивного shell: плагины, тема, инициализация окружения.
|
||||||
|
- `.profile` — общие login-настройки: PATH, переменные, platform-specific config.
|
||||||
|
- `.bash_aliases` — набор пользовательских aliases для удобной навигации и команд.
|
||||||
|
- `.p10k.zsh` — конфигурация темы Powerlevel10k.
|
||||||
|
|
||||||
|
## Иерархия загрузки
|
||||||
|
|
||||||
|
```
|
||||||
|
ИНТЕРАКТИВНЫЙ ШЕЛЛ
|
||||||
|
├── bash
|
||||||
|
│ ├── .bashrc
|
||||||
|
│ │ ├── .bash_aliases
|
||||||
|
│ │ └── .profile
|
||||||
|
│ └── .profile
|
||||||
|
└── zsh
|
||||||
|
├── .zshrc
|
||||||
|
│ ├── .bash_aliases
|
||||||
|
│ ├── .profile
|
||||||
|
│ └── .p10k.zsh
|
||||||
|
└── .profile
|
||||||
|
```
|
||||||
|
|
||||||
|
## Загрузка по типам shell
|
||||||
|
|
||||||
|
```
|
||||||
|
LOGIN SHELL
|
||||||
|
├── bash: ~/.bash_profile → ~/.bash_login → ~/.profile
|
||||||
|
└── zsh: ~/.zprofile → ~/.zshrc
|
||||||
|
|
||||||
|
INTERACTIVE NON-LOGIN
|
||||||
|
├── bash: ~/.bashrc
|
||||||
|
└── zsh: ~/.zshrc
|
||||||
|
|
||||||
|
NON-INTERACTIVE
|
||||||
|
└── конфиги не загружаются автоматически
|
||||||
|
```
|
||||||
|
|
||||||
Reference in New Issue
Block a user