1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-13 05:59:46 +08:00

Compare commits

..

No commits in common. "f36c6db0eac17b022eee87411e6996a5f5fc8457" and "27402e2603b9354f419af3695bad8ff17ed33bac" have entirely different histories.

8 changed files with 26 additions and 60 deletions

View File

@ -2,29 +2,26 @@
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions" ASDF_COMPLETIONS="$ASDF_DIR/completions"
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
# If not found, check for archlinux/AUR package (/opt/asdf-vm/) # If not found, check for archlinux/AUR package (/opt/asdf-vm/)
if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
ASDF_DIR="/opt/asdf-vm" ASDF_DIR="/opt/asdf-vm"
ASDF_COMPLETIONS="$ASDF_DIR" ASDF_COMPLETIONS="$ASDF_DIR"
# If not found, check for Homebrew package
elif (( $+commands[brew] )); then
_ASDF_PREFIX="$(brew --prefix asdf)"
ASDF_DIR="${_ASDF_PREFIX}/libexec"
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
unset _ASDF_PREFIX
else
return
fi fi
# If not found, check for Homebrew package
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
brew_prefix="$(brew --prefix asdf)"
ASDF_DIR="${brew_prefix}/libexec"
ASDF_COMPLETIONS="${brew_prefix}/etc/bash_completion.d"
unset brew_prefix
fi fi
# Load command # Load command
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
source "$ASDF_DIR/asdf.sh" . "$ASDF_DIR/asdf.sh"
# Load completions # Load completions
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
fpath+=("$ASDF_COMPLETIONS") . "$ASDF_COMPLETIONS/asdf.bash"
autoload -Uz _asdf
compdef _asdf asdf # compdef is already loaded before loading plugins
fi fi
fi fi

View File

@ -23,4 +23,4 @@ alias gel="gem lock"
alias geo="gem open" alias geo="gem open"
alias geoe="gem open -e" alias geoe="gem open -e"
alias rrun="ruby -e" alias rrun="ruby -e"
alias rserver="ruby -run -e httpd . -p 8080" # requires webrick alias rserver="ruby -e httpd . -p 8080" # requires webrick

View File

@ -23,7 +23,6 @@ Set `SHELLPROXY_URL` environment variable to the URL of the proxy server:
```sh ```sh
SHELLPROXY_URL="http://127.0.0.1:8123" SHELLPROXY_URL="http://127.0.0.1:8123"
SHELLPROXY_NO_PROXY="localhost,127.0.0.1"
proxy enable proxy enable
``` ```
@ -37,15 +36,11 @@ Example:
```sh ```sh
#!/bin/bash #!/bin/bash
# HTTP Proxy
if [[ "$(uname)" = Darwin ]]; then if [[ "$(uname)" = Darwin ]]; then
echo "http://127.0.0.1:6152" # Surge Mac echo "http://127.0.0.1:6152" # Surge Mac
else else
echo "http://127.0.0.1:8123" # polipo echo "http://127.0.0.1:8123" # polipo
fi fi
# No Proxy
echo "localhost,127.0.0.1"
``` ```
### Method 3 ### Method 3

View File

@ -6,7 +6,6 @@ from subprocess import check_output, list2cmdline
cwd = os.path.dirname(__file__) cwd = os.path.dirname(__file__)
ssh_agent = os.path.join(cwd, "ssh-agent.py") ssh_agent = os.path.join(cwd, "ssh-agent.py")
proxy_env = "SHELLPROXY_URL" proxy_env = "SHELLPROXY_URL"
no_proxy_env = "SHELLPROXY_NO_PROXY"
proxy_config = os.environ.get("SHELLPROXY_CONFIG") or os.path.expandvars("$HOME/.config/proxy") proxy_config = os.environ.get("SHELLPROXY_CONFIG") or os.path.expandvars("$HOME/.config/proxy")
usage="""shell-proxy: no proxy configuration found. usage="""shell-proxy: no proxy configuration found.
@ -16,30 +15,18 @@ See the plugin README for more information.""".format(env=proxy_env, config=prox
def get_http_proxy(): def get_http_proxy():
default_proxy = os.environ.get(proxy_env) default_proxy = os.environ.get(proxy_env)
no_proxy = os.environ.get(no_proxy_env)
if default_proxy and no_proxy:
return default_proxy, no_proxy
if os.path.isfile(proxy_config):
proxy_configdata = [line.strip() for line in check_output(proxy_config).decode("utf-8").splitlines()]
if len(proxy_configdata) >= 1:
if not default_proxy:
default_proxy = proxy_configdata[0]
if len(proxy_configdata) == 2 and not no_proxy:
no_proxy = proxy_configdata[1]
if default_proxy: if default_proxy:
return default_proxy, no_proxy return default_proxy
if os.path.isfile(proxy_config):
return check_output(proxy_config).decode("utf-8").strip()
print(usage, file=sys.stderr) print(usage, file=sys.stderr)
sys.exit(1) sys.exit(1)
def make_proxies(url: str, no_proxy: str): def make_proxies(url: str):
proxies = {"%s_PROXY" % _: url for _ in ("HTTP", "HTTPS", "FTP", "RSYNC", "ALL")} proxies = {"%s_PROXY" % _: url for _ in ("HTTP", "HTTPS", "FTP", "RSYNC", "ALL")}
proxies.update({name.lower(): value for (name, value) in proxies.items()}) proxies.update({name.lower(): value for (name, value) in proxies.items()})
proxies["GIT_SSH"] = ssh_agent proxies["GIT_SSH"] = ssh_agent
if no_proxy:
proxies.update({"NO_PROXY": no_proxy, "no_proxy": no_proxy})
return proxies return proxies
@ -48,7 +35,7 @@ def merge(mapping: dict):
class CommandSet: class CommandSet:
proxies = make_proxies(*get_http_proxy()) proxies = make_proxies(get_http_proxy())
aliases = { aliases = {
_: "env __SSH_PROGRAM_NAME__=%s %s" % (_, ssh_agent) _: "env __SSH_PROGRAM_NAME__=%s %s" % (_, ssh_agent)
for _ in ("ssh", "sftp", "scp", "slogin", "ssh-copy-id") for _ in ("ssh", "sftp", "scp", "slogin", "ssh-copy-id")

View File

@ -27,7 +27,7 @@ eval '
# capture the output of the proxy script and bail out if it fails # capture the output of the proxy script and bail out if it fails
local output local output
output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_NO_PROXY="$SHELLPROXY_NO_PROXY" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" || output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" ||
return $? return $?
# evaluate the output generated by the proxy script # evaluate the output generated by the proxy script

View File

@ -109,7 +109,7 @@ compdef _tmux _zsh_tmux_plugin_run
alias tmux=_zsh_tmux_plugin_run alias tmux=_zsh_tmux_plugin_run
# Autostart if not already in tmux and enabled. # Autostart if not already in tmux and enabled.
if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" ]]; then if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" ]]; then
# Actually don't autostart if we already did and multiple autostarts are disabled. # Actually don't autostart if we already did and multiple autostarts are disabled.
if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]; then if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]; then
export ZSH_TMUX_AUTOSTARTED=true export ZSH_TMUX_AUTOSTARTED=true

View File

@ -144,17 +144,11 @@ NOTE: this used to be bound to `v`. That is now the default (`visual-mode`).
- `c{motion}` : Delete {motion} text and start insert - `c{motion}` : Delete {motion} text and start insert
- `cc` : Delete line and start insert - `cc` : Delete line and start insert
- `C` : Delete to the end of the line and start insert - `C` : Delete to the end of the line and start insert
- `P` : Insert the contents of the clipboard before the cursor
- `p` : Insert the contents of the clipboard after the cursor
- `r{char}` : Replace the character under the cursor with {char} - `r{char}` : Replace the character under the cursor with {char}
- `R` : Enter replace mode: Each character replaces existing one - `R` : Enter replace mode: Each character replaces existing one
- `x` : Delete `count` characters under and after the cursor - `x` : Delete `count` characters under and after the cursor
- `X` : Delete `count` characters before the cursor - `X` : Delete `count` characters before the cursor
NOTE: delete/kill commands (`dd`, `D`, `c{motion}`, `C`, `x`,`X`) and yank commands
(`y`, `Y`) will copy to the clipboard. Contents can then be put back using paste commands
(`P`, `p`).
## Known issues ## Known issues
### Low `$KEYTIMEOUT` ### Low `$KEYTIMEOUT`

View File

@ -147,15 +147,8 @@ function wrap_clipboard_widgets() {
done done
} }
wrap_clipboard_widgets copy \ wrap_clipboard_widgets copy vi-yank vi-yank-eol vi-backward-kill-word vi-change-whole-line vi-delete vi-delete-char
vi-yank vi-yank-eol vi-yank-whole-line \ wrap_clipboard_widgets paste vi-put-{before,after}
vi-change vi-change-eol vi-change-whole-line \
vi-kill-line vi-kill-eol vi-backward-kill-word \
vi-delete vi-delete-char vi-backward-delete-char
wrap_clipboard_widgets paste \
vi-put-{before,after}
unfunction wrap_clipboard_widgets unfunction wrap_clipboard_widgets
# if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default # if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default