mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
Merge branch 'ohmyzsh:master' into adamsir/git-checkout-interactive
This commit is contained in:
commit
1b4703387d
266 changed files with 8748 additions and 2962 deletions
5
.github/CODEOWNERS
vendored
5
.github/CODEOWNERS
vendored
|
@ -1,13 +1,14 @@
|
||||||
# Plugin owners
|
# Plugin owners
|
||||||
plugins/archlinux/ @ratijas
|
plugins/archlinux/ @ratijas
|
||||||
|
plugins/dbt/ @msempere
|
||||||
|
plugins/eza/ @pepoluan
|
||||||
plugins/genpass/ @atoponce
|
plugins/genpass/ @atoponce
|
||||||
plugins/git-lfs/ @hellovietduc
|
plugins/git-lfs/ @hellovietduc
|
||||||
plugins/gitfast/ @felipec
|
plugins/gitfast/ @felipec
|
||||||
plugins/react-native @esthor
|
plugins/react-native @esthor
|
||||||
plugins/sdk/ @rgoldberg
|
plugins/sdk/ @rgoldberg
|
||||||
plugins/shell-proxy/ @septs
|
plugins/shell-proxy/ @septs
|
||||||
|
plugins/starship/ @axieax
|
||||||
plugins/universalarchive/ @Konfekt
|
plugins/universalarchive/ @Konfekt
|
||||||
plugins/wp-cli/ @joshmedeski
|
plugins/wp-cli/ @joshmedeski
|
||||||
plugins/zoxide/ @ajeetdsouza
|
plugins/zoxide/ @ajeetdsouza
|
||||||
plugins/starship/ @axieax
|
|
||||||
plugins/dbt/ @msempere
|
|
||||||
|
|
12
.github/dependabot.yml
vendored
Normal file
12
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
day: "sunday"
|
||||||
|
- package-ecosystem: "pip"
|
||||||
|
directory: "/.github/workflows/dependencies"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
day: "sunday"
|
38
.github/dependencies.yml
vendored
Normal file
38
.github/dependencies.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
dependencies:
|
||||||
|
plugins/gitfast:
|
||||||
|
repo: felipec/git-completion
|
||||||
|
branch: master
|
||||||
|
version: tag:v2.1
|
||||||
|
postcopy: |
|
||||||
|
set -e
|
||||||
|
rm -rf git-completion.plugin.zsh Makefile README.adoc t tools
|
||||||
|
test -e git-completion.zsh && mv -f git-completion.zsh _git
|
||||||
|
plugins/z:
|
||||||
|
branch: master
|
||||||
|
repo: agkozak/zsh-z
|
||||||
|
version: afaf2965b41fdc6ca66066e09382726aa0b6aa04
|
||||||
|
precopy: |
|
||||||
|
set -e
|
||||||
|
test -e README.md && mv -f README.md MANUAL.md
|
||||||
|
postcopy: |
|
||||||
|
set -e
|
||||||
|
test -e _zshz && mv -f _zshz _z
|
||||||
|
test -e zsh-z.plugin.zsh && mv -f zsh-z.plugin.zsh z.plugin.zsh
|
||||||
|
plugins/history-substring-search:
|
||||||
|
repo: zsh-users/zsh-history-substring-search
|
||||||
|
branch: master
|
||||||
|
version: 8dd05bfcc12b0cd1ee9ea64be725b3d9f713cf64
|
||||||
|
precopy: |
|
||||||
|
set -e
|
||||||
|
rm -f zsh-history-substring-search.plugin.zsh
|
||||||
|
test -e zsh-history-substring-search.zsh && mv zsh-history-substring-search.zsh history-substring-search.zsh
|
||||||
|
postcopy: |
|
||||||
|
set -e
|
||||||
|
test -e dependencies/OMZ-README.md && cat dependencies/OMZ-README.md >> README.md
|
||||||
|
plugins/gradle:
|
||||||
|
repo: gradle/gradle-completion
|
||||||
|
branch: master
|
||||||
|
version: 25da917cf5a88f3e58f05be3868a7b2748c8afe6
|
||||||
|
precopy: |
|
||||||
|
set -e
|
||||||
|
find . ! -name _gradle ! -name LICENSE -delete
|
29
.github/workflows/dependencies.yml
vendored
Normal file
29
.github/workflows/dependencies.yml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
name: Update dependencies
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
# schedule:
|
||||||
|
# - cron: '34 3 * * */8'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
name: Check for updates
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Authenticate as @ohmyzsh
|
||||||
|
id: generate_token
|
||||||
|
uses: ohmyzsh/github-app-token@v2
|
||||||
|
with:
|
||||||
|
app_id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||||
|
private_key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||||
|
- name: Process dependencies
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||||
|
GIT_APP_NAME: ohmyzsh[bot]
|
||||||
|
GIT_APP_EMAIL: 54982679+ohmyzsh[bot]@users.noreply.github.com
|
||||||
|
TMP_DIR: ${{ runner.temp }}
|
||||||
|
run: |
|
||||||
|
pip install -r .github/workflows/dependencies/requirements.txt
|
||||||
|
python3 .github/workflows/dependencies/updater.py
|
2
.github/workflows/dependencies/requirements.txt
vendored
Normal file
2
.github/workflows/dependencies/requirements.txt
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
PyYAML~=6.0.1
|
||||||
|
requests~=2.31.0
|
450
.github/workflows/dependencies/updater.py
vendored
Normal file
450
.github/workflows/dependencies/updater.py
vendored
Normal file
|
@ -0,0 +1,450 @@
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import requests
|
||||||
|
import shutil
|
||||||
|
import yaml
|
||||||
|
from copy import deepcopy
|
||||||
|
from typing import Optional, TypedDict
|
||||||
|
|
||||||
|
# Get TMP_DIR variable from environment
|
||||||
|
TMP_DIR = os.path.join(os.environ.get("TMP_DIR", "/tmp"), "ohmyzsh")
|
||||||
|
# Relative path to dependencies.yml file
|
||||||
|
DEPS_YAML_FILE = ".github/dependencies.yml"
|
||||||
|
# Dry run flag
|
||||||
|
DRY_RUN = os.environ.get("DRY_RUN", "0") == "1"
|
||||||
|
|
||||||
|
import timeit
|
||||||
|
class CodeTimer:
|
||||||
|
def __init__(self, name=None):
|
||||||
|
self.name = " '" + name + "'" if name else ''
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
self.start = timeit.default_timer()
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.took = (timeit.default_timer() - self.start) * 1000.0
|
||||||
|
print('Code block' + self.name + ' took: ' + str(self.took) + ' ms')
|
||||||
|
|
||||||
|
|
||||||
|
### YAML representation
|
||||||
|
def str_presenter(dumper, data):
|
||||||
|
"""
|
||||||
|
Configures yaml for dumping multiline strings
|
||||||
|
Ref: https://stackoverflow.com/a/33300001
|
||||||
|
"""
|
||||||
|
if len(data.splitlines()) > 1: # check for multiline string
|
||||||
|
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
|
||||||
|
return dumper.represent_scalar('tag:yaml.org,2002:str', data)
|
||||||
|
|
||||||
|
yaml.add_representer(str, str_presenter)
|
||||||
|
yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
|
||||||
|
|
||||||
|
|
||||||
|
# Types
|
||||||
|
class DependencyDict(TypedDict):
|
||||||
|
repo: str
|
||||||
|
branch: str
|
||||||
|
version: str
|
||||||
|
precopy: Optional[str]
|
||||||
|
postcopy: Optional[str]
|
||||||
|
|
||||||
|
class DependencyYAML(TypedDict):
|
||||||
|
dependencies: dict[str, DependencyDict]
|
||||||
|
|
||||||
|
class UpdateStatus(TypedDict):
|
||||||
|
has_updates: bool
|
||||||
|
version: Optional[str]
|
||||||
|
compare_url: Optional[str]
|
||||||
|
head_ref: Optional[str]
|
||||||
|
head_url: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
|
class CommandRunner:
|
||||||
|
class Exception(Exception):
|
||||||
|
def __init__(self, message, returncode, stage, stdout, stderr):
|
||||||
|
super().__init__(message)
|
||||||
|
self.returncode = returncode
|
||||||
|
self.stage = stage
|
||||||
|
self.stdout = stdout
|
||||||
|
self.stderr = stderr
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run_or_fail(command: list[str], stage: str, *args, **kwargs):
|
||||||
|
if DRY_RUN and command[0] == "gh":
|
||||||
|
command.insert(0, "echo")
|
||||||
|
|
||||||
|
result = subprocess.run(command, *args, capture_output=True, **kwargs)
|
||||||
|
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise CommandRunner.Exception(
|
||||||
|
f"{stage} command failed with exit code {result.returncode}", returncode=result.returncode,
|
||||||
|
stage=stage,
|
||||||
|
stdout=result.stdout.decode("utf-8"),
|
||||||
|
stderr=result.stderr.decode("utf-8")
|
||||||
|
)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
class DependencyStore:
|
||||||
|
store: DependencyYAML = {
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def set(data: DependencyYAML):
|
||||||
|
DependencyStore.store = data
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def update_dependency_version(path: str, version: str) -> DependencyYAML:
|
||||||
|
with CodeTimer(f"store deepcopy: {path}"):
|
||||||
|
store_copy = deepcopy(DependencyStore.store)
|
||||||
|
|
||||||
|
dependency = store_copy["dependencies"].get(path, {})
|
||||||
|
dependency["version"] = version
|
||||||
|
store_copy["dependencies"][path] = dependency
|
||||||
|
|
||||||
|
return store_copy
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def write_store(file: str, data: DependencyYAML):
|
||||||
|
with open(file, "w") as yaml_file:
|
||||||
|
yaml.safe_dump(data, yaml_file, sort_keys=False)
|
||||||
|
|
||||||
|
|
||||||
|
class Dependency:
|
||||||
|
def __init__(self, path: str, values: DependencyDict):
|
||||||
|
self.path = path
|
||||||
|
self.values = values
|
||||||
|
|
||||||
|
self.name: str = ""
|
||||||
|
self.desc: str = ""
|
||||||
|
self.kind: str = ""
|
||||||
|
|
||||||
|
match path.split("/"):
|
||||||
|
case ["plugins", name]:
|
||||||
|
self.name = name
|
||||||
|
self.kind = "plugin"
|
||||||
|
self.desc = f"{name} plugin"
|
||||||
|
case ["themes", name]:
|
||||||
|
self.name = name.replace(".zsh-theme", "")
|
||||||
|
self.kind = "theme"
|
||||||
|
self.desc = f"{self.name} theme"
|
||||||
|
case _:
|
||||||
|
self.name = self.desc = path
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
output: str = ""
|
||||||
|
for key in DependencyDict.__dict__['__annotations__'].keys():
|
||||||
|
if key not in self.values:
|
||||||
|
output += f"{key}: None\n"
|
||||||
|
continue
|
||||||
|
|
||||||
|
value = self.values[key]
|
||||||
|
if "\n" not in value:
|
||||||
|
output += f"{key}: {value}\n"
|
||||||
|
else:
|
||||||
|
output += f"{key}:\n "
|
||||||
|
output += value.replace("\n", "\n ", value.count("\n") - 1)
|
||||||
|
return output
|
||||||
|
|
||||||
|
def update_or_notify(self):
|
||||||
|
# Print dependency settings
|
||||||
|
print(f"Processing {self.desc}...", file=sys.stderr)
|
||||||
|
print(self, file=sys.stderr)
|
||||||
|
|
||||||
|
# Check for updates
|
||||||
|
repo = self.values["repo"]
|
||||||
|
remote_branch = self.values["branch"]
|
||||||
|
version = self.values["version"]
|
||||||
|
is_tag = version.startswith("tag:")
|
||||||
|
|
||||||
|
try:
|
||||||
|
with CodeTimer(f"update check: {repo}"):
|
||||||
|
if is_tag:
|
||||||
|
status = GitHub.check_newer_tag(repo, version.replace("tag:", ""))
|
||||||
|
else:
|
||||||
|
status = GitHub.check_updates(repo, remote_branch, version)
|
||||||
|
|
||||||
|
if status["has_updates"]:
|
||||||
|
short_sha = status["head_ref"][:8]
|
||||||
|
new_version = status["version"] if is_tag else short_sha
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Create new branch
|
||||||
|
branch = Git.create_branch(self.path, new_version)
|
||||||
|
|
||||||
|
# Update dependencies.yml file
|
||||||
|
self.__update_yaml(f"tag:{new_version}" if is_tag else status["version"])
|
||||||
|
|
||||||
|
# Update dependency files
|
||||||
|
self.__apply_upstream_changes()
|
||||||
|
|
||||||
|
# Add all changes and commit
|
||||||
|
Git.add_and_commit(self.name, short_sha)
|
||||||
|
|
||||||
|
# Push changes to remote
|
||||||
|
Git.push(branch)
|
||||||
|
|
||||||
|
# Create GitHub PR
|
||||||
|
GitHub.create_pr(
|
||||||
|
branch,
|
||||||
|
f"feat({self.name}): update to version {new_version}",
|
||||||
|
f"""## Description
|
||||||
|
|
||||||
|
Update for **{self.desc}**: update to version [{new_version}]({status['head_url']}).
|
||||||
|
Check out the [list of changes]({status['compare_url']}).
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
# Clean up repository
|
||||||
|
Git.clean_repo()
|
||||||
|
except (CommandRunner.Exception, shutil.Error) as e:
|
||||||
|
# Handle exception on automatic update
|
||||||
|
match type(e):
|
||||||
|
case CommandRunner.Exception:
|
||||||
|
# Print error message
|
||||||
|
print(f"Error running {e.stage} command: {e.returncode}", file=sys.stderr)
|
||||||
|
print(e.stderr, file=sys.stderr)
|
||||||
|
case shutil.Error:
|
||||||
|
print(f"Error copying files: {e}", file=sys.stderr)
|
||||||
|
|
||||||
|
try:
|
||||||
|
Git.clean_repo()
|
||||||
|
except CommandRunner.Exception as e:
|
||||||
|
print(f"Error reverting repository to clean state: {e}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Create a GitHub issue to notify maintainer
|
||||||
|
title = f"{self.path}: update to {new_version}"
|
||||||
|
body = (
|
||||||
|
f"""## Description
|
||||||
|
|
||||||
|
There is a new version of `{self.name}` {self.kind} available.
|
||||||
|
|
||||||
|
New version: [{new_version}]({status['head_url']})
|
||||||
|
Check out the [list of changes]({status['compare_url']}).
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
print(f"Creating GitHub issue", file=sys.stderr)
|
||||||
|
print(f"{title}\n\n{body}", file=sys.stderr)
|
||||||
|
GitHub.create_issue(title, body)
|
||||||
|
except Exception as e:
|
||||||
|
print(e, file=sys.stderr)
|
||||||
|
|
||||||
|
def __update_yaml(self, new_version: str) -> None:
|
||||||
|
dep_yaml = DependencyStore.update_dependency_version(self.path, new_version)
|
||||||
|
DependencyStore.write_store(DEPS_YAML_FILE, dep_yaml)
|
||||||
|
|
||||||
|
def __apply_upstream_changes(self) -> None:
|
||||||
|
# Patterns to ignore in copying files from upstream repo
|
||||||
|
GLOBAL_IGNORE = [
|
||||||
|
".git",
|
||||||
|
".github",
|
||||||
|
".gitignore"
|
||||||
|
]
|
||||||
|
|
||||||
|
path = os.path.abspath(self.path)
|
||||||
|
precopy = self.values.get("precopy")
|
||||||
|
postcopy = self.values.get("postcopy")
|
||||||
|
|
||||||
|
repo = self.values["repo"]
|
||||||
|
branch = self.values["branch"]
|
||||||
|
remote_url = f"https://github.com/{repo}.git"
|
||||||
|
repo_dir = os.path.join(TMP_DIR, repo)
|
||||||
|
|
||||||
|
# Clone repository
|
||||||
|
Git.clone(remote_url, branch, repo_dir, reclone=True)
|
||||||
|
|
||||||
|
# Run precopy on tmp repo
|
||||||
|
if precopy is not None:
|
||||||
|
print("Running precopy script:", end="\n ", file=sys.stderr)
|
||||||
|
print(precopy.replace("\n", "\n ", precopy.count("\n") - 1), file=sys.stderr)
|
||||||
|
CommandRunner.run_or_fail(["bash", "-c", precopy], cwd=repo_dir, stage="Precopy")
|
||||||
|
|
||||||
|
# Copy files from upstream repo
|
||||||
|
print(f"Copying files from {repo_dir} to {path}", file=sys.stderr)
|
||||||
|
shutil.copytree(repo_dir, path, dirs_exist_ok=True, ignore=shutil.ignore_patterns(*GLOBAL_IGNORE))
|
||||||
|
|
||||||
|
# Run postcopy on our repository
|
||||||
|
if postcopy is not None:
|
||||||
|
print("Running postcopy script:", end="\n ", file=sys.stderr)
|
||||||
|
print(postcopy.replace("\n", "\n ", postcopy.count("\n") - 1), file=sys.stderr)
|
||||||
|
CommandRunner.run_or_fail(["bash", "-c", postcopy], cwd=path, stage="Postcopy")
|
||||||
|
|
||||||
|
|
||||||
|
class Git:
|
||||||
|
default_branch = "master"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def clone(remote_url: str, branch: str, repo_dir: str, reclone=False):
|
||||||
|
# If repo needs to be fresh
|
||||||
|
if reclone and os.path.exists(repo_dir):
|
||||||
|
shutil.rmtree(repo_dir)
|
||||||
|
|
||||||
|
# Clone repo in tmp directory and checkout branch
|
||||||
|
if not os.path.exists(repo_dir):
|
||||||
|
print(f"Cloning {remote_url} to {repo_dir} and checking out {branch}", file=sys.stderr)
|
||||||
|
CommandRunner.run_or_fail(["git", "clone", "--depth=1", "-b", branch, remote_url, repo_dir], stage="Clone")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_branch(path: str, version: str):
|
||||||
|
# Get current branch name
|
||||||
|
result = CommandRunner.run_or_fail(["git", "rev-parse", "--abbrev-ref", "HEAD"], stage="GetDefaultBranch")
|
||||||
|
Git.default_branch = result.stdout.decode("utf-8").strip()
|
||||||
|
|
||||||
|
# Create new branch and return created branch name
|
||||||
|
branch_name = f"update/{path}/{version}"
|
||||||
|
CommandRunner.run_or_fail(["git", "checkout", "-b", branch_name], stage="CreateBranch")
|
||||||
|
return branch_name
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def add_and_commit(scope: str, version: str):
|
||||||
|
user_name = os.environ.get("GIT_APP_NAME")
|
||||||
|
user_email = os.environ.get("GIT_APP_EMAIL")
|
||||||
|
|
||||||
|
# Add all files to git staging
|
||||||
|
CommandRunner.run_or_fail(["git", "add", "-A", "-v"], stage="AddFiles")
|
||||||
|
|
||||||
|
# Reset environment and git config
|
||||||
|
clean_env = os.environ.copy()
|
||||||
|
clean_env["LANG"]="C.UTF-8"
|
||||||
|
clean_env["GIT_CONFIG_GLOBAL"]="/dev/null"
|
||||||
|
clean_env["GIT_CONFIG_NOSYSTEM"]="1"
|
||||||
|
|
||||||
|
# Commit with settings above
|
||||||
|
CommandRunner.run_or_fail([
|
||||||
|
"git",
|
||||||
|
"-c", f"user.name={user_name}",
|
||||||
|
"-c", f"user.email={user_email}",
|
||||||
|
"commit",
|
||||||
|
"-m", f"feat({scope}): update to {version}"
|
||||||
|
], stage="CreateCommit", env=clean_env)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def push(branch: str):
|
||||||
|
CommandRunner.run_or_fail(["git", "push", "-u", "origin", branch], stage="PushBranch")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def clean_repo():
|
||||||
|
CommandRunner.run_or_fail(["git", "reset", "--hard", "HEAD"], stage="ResetRepository")
|
||||||
|
CommandRunner.run_or_fail(["git", "checkout", Git.default_branch], stage="CheckoutDefaultBranch")
|
||||||
|
|
||||||
|
|
||||||
|
class GitHub:
|
||||||
|
@staticmethod
|
||||||
|
def check_newer_tag(repo, current_tag) -> UpdateStatus:
|
||||||
|
# GET /repos/:owner/:repo/git/refs/tags
|
||||||
|
url = f"https://api.github.com/repos/{repo}/git/refs/tags"
|
||||||
|
|
||||||
|
# Send a GET request to the GitHub API
|
||||||
|
response = requests.get(url)
|
||||||
|
|
||||||
|
# If the request was successful
|
||||||
|
if response.status_code == 200:
|
||||||
|
# Parse the JSON response
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
if len(data) == 0:
|
||||||
|
return {
|
||||||
|
"has_updates": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
latest_ref = data[-1]
|
||||||
|
latest_tag = latest_ref["ref"].replace("refs/tags/", "")
|
||||||
|
|
||||||
|
if latest_tag == current_tag:
|
||||||
|
return {
|
||||||
|
"has_updates": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"has_updates": True,
|
||||||
|
"version": latest_tag,
|
||||||
|
"compare_url": f"https://github.com/{repo}/compare/{current_tag}...{latest_tag}",
|
||||||
|
"head_ref": latest_ref["object"]["sha"],
|
||||||
|
"head_url": f"https://github.com/{repo}/releases/tag/{latest_tag}",
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# If the request was not successful, raise an exception
|
||||||
|
raise Exception(f"GitHub API request failed with status code {response.status_code}: {response.json()}")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check_updates(repo, branch, version) -> UpdateStatus:
|
||||||
|
# TODO: add support for semver updating (based on tags)
|
||||||
|
# Check if upstream github repo has a new version
|
||||||
|
# GitHub API URL for comparing two commits
|
||||||
|
url = f"https://api.github.com/repos/{repo}/compare/{version}...{branch}"
|
||||||
|
|
||||||
|
# Send a GET request to the GitHub API
|
||||||
|
response = requests.get(url)
|
||||||
|
|
||||||
|
# If the request was successful
|
||||||
|
if response.status_code == 200:
|
||||||
|
# Parse the JSON response
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
# If the base is behind the head, there is a newer version
|
||||||
|
has_updates = data["status"] != "identical"
|
||||||
|
|
||||||
|
if not has_updates:
|
||||||
|
return {
|
||||||
|
"has_updates": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"has_updates": data["status"] != "identical",
|
||||||
|
"version": data["commits"][-1]["sha"],
|
||||||
|
"compare_url": data["permalink_url"],
|
||||||
|
"head_ref": data["commits"][-1]["sha"],
|
||||||
|
"head_url": data["commits"][-1]["html_url"]
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# If the request was not successful, raise an exception
|
||||||
|
raise Exception(f"GitHub API request failed with status code {response.status_code}: {response.json()}")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_issue(title: str, body: str) -> None:
|
||||||
|
cmd = [
|
||||||
|
"gh",
|
||||||
|
"issue",
|
||||||
|
"create",
|
||||||
|
"-t", title,
|
||||||
|
"-b", body
|
||||||
|
]
|
||||||
|
CommandRunner.run_or_fail(cmd, stage="CreateIssue")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_pr(branch: str, title: str, body: str) -> None:
|
||||||
|
cmd = [
|
||||||
|
"gh",
|
||||||
|
"pr",
|
||||||
|
"create",
|
||||||
|
"-B", Git.default_branch,
|
||||||
|
"-H", branch,
|
||||||
|
"-t", title,
|
||||||
|
"-b", body
|
||||||
|
]
|
||||||
|
CommandRunner.run_or_fail(cmd, stage="CreatePullRequest")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Load the YAML file
|
||||||
|
with open(DEPS_YAML_FILE, "r") as yaml_file:
|
||||||
|
data: DependencyYAML = yaml.safe_load(yaml_file)
|
||||||
|
|
||||||
|
if "dependencies" not in data:
|
||||||
|
raise Exception(f"dependencies.yml not properly formatted")
|
||||||
|
|
||||||
|
# Cache YAML version
|
||||||
|
DependencyStore.set(data)
|
||||||
|
|
||||||
|
dependencies = data["dependencies"]
|
||||||
|
for path in dependencies:
|
||||||
|
dependency = Dependency(path, dependencies[path])
|
||||||
|
dependency.update_or_notify()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
15
.github/workflows/installer.yml
vendored
15
.github/workflows/installer.yml
vendored
|
@ -3,9 +3,9 @@ on:
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- tools/install.sh
|
- 'tools/install.sh'
|
||||||
- .github/workflows/installer
|
- '.github/workflows/installer/**'
|
||||||
- .github/workflows/installer.yml
|
- '.github/workflows/installer.yml'
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
@ -17,6 +17,7 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test installer
|
name: Test installer
|
||||||
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -25,7 +26,7 @@ jobs:
|
||||||
- macos-latest
|
- macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Install zsh
|
- name: Install zsh
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: sudo apt-get update; sudo apt-get install zsh
|
run: sudo apt-get update; sudo apt-get install zsh
|
||||||
|
@ -41,15 +42,15 @@ jobs:
|
||||||
- test
|
- test
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Install Vercel CLI
|
- name: Install Vercel CLI
|
||||||
run: npm install -g vercel
|
run: npm install -g vercel
|
||||||
- name: Setup project and deploy
|
- name: Setup project and deploy
|
||||||
env:
|
env:
|
||||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||||
|
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cp tools/install.sh .github/workflows/installer/install.sh
|
cp tools/install.sh .github/workflows/installer/install.sh
|
||||||
cd .github/workflows/installer
|
cd .github/workflows/installer
|
||||||
vc link --yes -t ${{ secrets.VERCEL_TOKEN }}
|
vc deploy --prod -t "$VERCEL_TOKEN"
|
||||||
vc deploy --prod -t ${{ secrets.VERCEL_TOKEN }}
|
|
||||||
|
|
11
.github/workflows/installer/vercel.json
vendored
11
.github/workflows/installer/vercel.json
vendored
|
@ -2,7 +2,16 @@
|
||||||
"headers": [
|
"headers": [
|
||||||
{
|
{
|
||||||
"source": "/((?!favicon.ico).*)",
|
"source": "/((?!favicon.ico).*)",
|
||||||
"headers": [{ "key": "Content-Type", "value": "text/plain" }]
|
"headers": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "text/plain"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Disposition",
|
||||||
|
"value": "inline; filename=\"install.sh\""
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rewrites": [
|
"rewrites": [
|
||||||
|
|
8
.github/workflows/main.yml
vendored
8
.github/workflows/main.yml
vendored
|
@ -20,16 +20,12 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Install zsh
|
- name: Install zsh
|
||||||
if: runner.os == 'Linux'
|
|
||||||
run: sudo apt-get update; sudo apt-get install zsh
|
run: sudo apt-get update; sudo apt-get install zsh
|
||||||
- name: Check syntax
|
- name: Check syntax
|
||||||
run: |
|
run: |
|
||||||
|
|
10
.github/workflows/project.yml
vendored
10
.github/workflows/project.yml
vendored
|
@ -15,9 +15,15 @@ jobs:
|
||||||
name: Add to project
|
name: Add to project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Authenticate as @ohmyzsh
|
||||||
|
id: generate_token
|
||||||
|
uses: ohmyzsh/github-app-token@v2
|
||||||
|
with:
|
||||||
|
app_id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||||
|
private_key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||||
|
- name: Store app token
|
||||||
|
run: echo "GH_TOKEN=${{ steps.generate_token.outputs.token }}" >> "$GITHUB_ENV"
|
||||||
- name: Read project data
|
- name: Read project data
|
||||||
env:
|
env:
|
||||||
ORGANIZATION: ohmyzsh
|
ORGANIZATION: ohmyzsh
|
||||||
|
|
97
README.md
97
README.md
|
@ -13,41 +13,43 @@ Finally, you'll begin to get the sort of attention that you have always felt you
|
||||||
To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and join us on [Discord](https://discord.gg/ohmyzsh).
|
To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and join us on [Discord](https://discord.gg/ohmyzsh).
|
||||||
|
|
||||||
[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
|
[![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI)
|
||||||
[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
|
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ohmyzsh?label=%40ohmyzsh&logo=x&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
|
||||||
|
[![Mastodon Follow](https://img.shields.io/mastodon/follow/111169632522566717?label=%40ohmyzsh&domain=https%3A%2F%2Fmstdn.social&logo=mastodon&style=flat)](https://mstdn.social/@ohmyzsh)
|
||||||
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh)
|
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh)
|
||||||
[![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh)
|
[![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh)
|
||||||
[![huntr.dev](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh)
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Table of Contents</summary>
|
<summary>Table of Contents</summary>
|
||||||
|
|
||||||
- [Getting Started](#getting-started)
|
- [Getting Started](#getting-started)
|
||||||
|
- [Operating System Compatibility](#operating-system-compatibility)
|
||||||
- [Prerequisites](#prerequisites)
|
- [Prerequisites](#prerequisites)
|
||||||
- [Basic Installation](#basic-installation)
|
- [Basic Installation](#basic-installation)
|
||||||
- [Manual inspection](#manual-inspection)
|
- [Manual Inspection](#manual-inspection)
|
||||||
- [Using Oh My Zsh](#using-oh-my-zsh)
|
- [Using Oh My Zsh](#using-oh-my-zsh)
|
||||||
- [Plugins](#plugins)
|
- [Plugins](#plugins)
|
||||||
- [Enabling Plugins](#enabling-plugins)
|
- [Enabling Plugins](#enabling-plugins)
|
||||||
- [Using Plugins](#using-plugins)
|
- [Using Plugins](#using-plugins)
|
||||||
- [Themes](#themes)
|
- [Themes](#themes)
|
||||||
- [Selecting a Theme](#selecting-a-theme)
|
- [Selecting A Theme](#selecting-a-theme)
|
||||||
- [FAQ](#faq)
|
- [FAQ](#faq)
|
||||||
- [Advanced Topics](#advanced-topics)
|
- [Advanced Topics](#advanced-topics)
|
||||||
- [Advanced Installation](#advanced-installation)
|
- [Advanced Installation](#advanced-installation)
|
||||||
- [Custom Directory](#custom-directory)
|
- [Custom Directory](#custom-directory)
|
||||||
- [Unattended install](#unattended-install)
|
- [Unattended Install](#unattended-install)
|
||||||
- [Installing from a forked repository](#installing-from-a-forked-repository)
|
- [Installing From A Forked Repository](#installing-from-a-forked-repository)
|
||||||
- [Manual Installation](#manual-installation)
|
- [Manual Installation](#manual-installation)
|
||||||
- [Installation Problems](#installation-problems)
|
- [Installation Problems](#installation-problems)
|
||||||
- [Custom Plugins and Themes](#custom-plugins-and-themes)
|
- [Custom Plugins And Themes](#custom-plugins-and-themes)
|
||||||
- [Enable GNU ls in macOS and freeBSD systems](#enable-gnu-ls)
|
- [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
|
||||||
- [Skip aliases](#skip-aliases)
|
- [Skip Aliases](#skip-aliases)
|
||||||
|
- [Disable async git prompt](#disable-async-git-prompt)
|
||||||
- [Getting Updates](#getting-updates)
|
- [Getting Updates](#getting-updates)
|
||||||
- [Updates verbosity](#updates-verbosity)
|
- [Updates Verbosity](#updates-verbosity)
|
||||||
- [Manual Updates](#manual-updates)
|
- [Manual Updates](#manual-updates)
|
||||||
- [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh)
|
- [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh)
|
||||||
- [How do I contribute to Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh)
|
- [How Do I Contribute To Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh)
|
||||||
- [Do NOT send us themes](#do-not-send-us-themes)
|
- [Do Not Send Us Themes](#do-not-send-us-themes)
|
||||||
- [Contributors](#contributors)
|
- [Contributors](#contributors)
|
||||||
- [Follow Us](#follow-us)
|
- [Follow Us](#follow-us)
|
||||||
- [Merchandise](#merchandise)
|
- [Merchandise](#merchandise)
|
||||||
|
@ -58,9 +60,21 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
### Operating System Compatibility
|
||||||
|
|
||||||
|
| O/S | Status |
|
||||||
|
| :------------- | :-----: |
|
||||||
|
| Android | ✅ |
|
||||||
|
| freeBSD | ✅ |
|
||||||
|
| LCARS | 🛸 |
|
||||||
|
| Linux | ✅ |
|
||||||
|
| macOS | ✅ |
|
||||||
|
| OS/2 Warp | ❌ |
|
||||||
|
| Windows (WSL2) | ✅ |
|
||||||
|
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL2 is preferred, but cygwin or msys also mostly work.
|
|
||||||
- [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent is fine but we prefer 5.0.8 and newer). If not pre-installed (run `zsh --version` to confirm), check the following wiki instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
|
- [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent is fine but we prefer 5.0.8 and newer). If not pre-installed (run `zsh --version` to confirm), check the following wiki instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH)
|
||||||
- `curl` or `wget` should be installed
|
- `curl` or `wget` should be installed
|
||||||
- `git` should be installed (recommended v2.4.11 or higher)
|
- `git` should be installed (recommended v2.4.11 or higher)
|
||||||
|
@ -75,9 +89,17 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
||||||
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
||||||
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
||||||
|
|
||||||
|
Alternatively, the installer is also mirrored outside GitHub. Using this URL instead may be required if you're in a country like India or China, that blocks `raw.githubusercontent.com`:
|
||||||
|
|
||||||
|
| Method | Command |
|
||||||
|
| :-------- | :------------------------------------------------------------------------------------------------ |
|
||||||
|
| **curl** | `sh -c "$(curl -fsSL https://install.ohmyz.sh/)"` |
|
||||||
|
| **wget** | `sh -c "$(wget -O- https://install.ohmyz.sh/)"` |
|
||||||
|
| **fetch** | `sh -c "$(fetch -o - https://install.ohmyz.sh/)"` |
|
||||||
|
|
||||||
_Note that any previous `.zshrc` will be renamed to `.zshrc.pre-oh-my-zsh`. After installation, you can move the configuration you want to preserve into the new `.zshrc`._
|
_Note that any previous `.zshrc` will be renamed to `.zshrc.pre-oh-my-zsh`. After installation, you can move the configuration you want to preserve into the new `.zshrc`._
|
||||||
|
|
||||||
#### Manual inspection
|
#### Manual Inspection
|
||||||
|
|
||||||
It's a good idea to inspect the install script from projects you don't yet know. You can do
|
It's a good idea to inspect the install script from projects you don't yet know. You can do
|
||||||
that by downloading the install script first, looking through it so everything looks normal,
|
that by downloading the install script first, looking through it so everything looks normal,
|
||||||
|
@ -88,6 +110,8 @@ wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||||
sh install.sh
|
sh install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If the above URL times out or otherwise fails, you may have to substitute the URL for `https://install.ohmyz.sh` to be able to get the script.
|
||||||
|
|
||||||
## Using Oh My Zsh
|
## Using Oh My Zsh
|
||||||
|
|
||||||
### Plugins
|
### Plugins
|
||||||
|
@ -126,7 +150,7 @@ Each built-in plugin includes a **README**, documenting it. This README should s
|
||||||
|
|
||||||
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out!
|
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out!
|
||||||
|
|
||||||
#### Selecting a Theme
|
#### Selecting A Theme
|
||||||
|
|
||||||
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._
|
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._
|
||||||
|
|
||||||
|
@ -197,7 +221,7 @@ like this:
|
||||||
ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh
|
ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Unattended install
|
#### Unattended Install
|
||||||
|
|
||||||
If you're running the Oh My Zsh install script as part of an automated install, you can pass the `--unattended`
|
If you're running the Oh My Zsh install script as part of an automated install, you can pass the `--unattended`
|
||||||
flag to the `install.sh` script. This will have the effect of not trying to change
|
flag to the `install.sh` script. This will have the effect of not trying to change
|
||||||
|
@ -207,7 +231,9 @@ the default shell, and it also won't run `zsh` when the installation has finishe
|
||||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Installing from a forked repository
|
If you're in China, India, or another country that blocks `raw.githubusercontent.com`, you may have to substitute the URL for `https://install.ohmyz.sh` for it to install.
|
||||||
|
|
||||||
|
#### Installing From A Forked Repository
|
||||||
|
|
||||||
The install script also accepts these variables to allow installation of a different repository:
|
The install script also accepts these variables to allow installation of a different repository:
|
||||||
|
|
||||||
|
@ -232,19 +258,19 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
|
||||||
|
|
||||||
#### Manual Installation
|
#### Manual Installation
|
||||||
|
|
||||||
##### 1. Clone the repository <!-- omit in toc -->
|
##### 1. Clone The Repository <!-- omit in toc -->
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
|
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 2. _Optionally_, backup your existing `~/.zshrc` file <!-- omit in toc -->
|
##### 2. _Optionally_, Backup Your Existing `~/.zshrc` File <!-- omit in toc -->
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cp ~/.zshrc ~/.zshrc.orig
|
cp ~/.zshrc ~/.zshrc.orig
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 3. Create a new zsh configuration file <!-- omit in toc -->
|
##### 3. Create A New Zsh Configuration File <!-- omit in toc -->
|
||||||
|
|
||||||
You can create a new zsh config file by copying the template that we have included for you.
|
You can create a new zsh config file by copying the template that we have included for you.
|
||||||
|
|
||||||
|
@ -252,7 +278,7 @@ You can create a new zsh config file by copying the template that we have includ
|
||||||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 4. Change your default shell <!-- omit in toc -->
|
##### 4. Change Your Default Shell <!-- omit in toc -->
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
chsh -s $(which zsh)
|
chsh -s $(which zsh)
|
||||||
|
@ -260,7 +286,7 @@ chsh -s $(which zsh)
|
||||||
|
|
||||||
You must log out from your user session and log back in to see this change.
|
You must log out from your user session and log back in to see this change.
|
||||||
|
|
||||||
##### 5. Initialize your new zsh configuration <!-- omit in toc -->
|
##### 5. Initialize Your New Zsh Configuration <!-- omit in toc -->
|
||||||
|
|
||||||
Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration.
|
Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration.
|
||||||
|
|
||||||
|
@ -271,7 +297,7 @@ If you have any hiccups installing, here are a few common fixes.
|
||||||
- You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`.
|
- You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`.
|
||||||
- If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`.
|
- If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`.
|
||||||
|
|
||||||
### Custom Plugins and Themes
|
### Custom Plugins And Themes
|
||||||
|
|
||||||
If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory.
|
If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory.
|
||||||
|
|
||||||
|
@ -279,7 +305,7 @@ If you have many functions that go well together, you can put them as a `XYZ.plu
|
||||||
|
|
||||||
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
|
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
|
||||||
|
|
||||||
### Enable GNU ls in macOS and freeBSD systems
|
### Enable GNU ls In macOS And freeBSD Systems
|
||||||
|
|
||||||
<a name="enable-gnu-ls"></a>
|
<a name="enable-gnu-ls"></a>
|
||||||
|
|
||||||
|
@ -293,7 +319,7 @@ zstyle ':omz:lib:theme-and-appearance' gnu-ls yes
|
||||||
|
|
||||||
_Note: this is not compatible with `DISABLE_LS_COLORS=true`_
|
_Note: this is not compatible with `DISABLE_LS_COLORS=true`_
|
||||||
|
|
||||||
### Skip aliases
|
### Skip Aliases
|
||||||
|
|
||||||
<a name="remove-directories-aliases"></a>
|
<a name="remove-directories-aliases"></a>
|
||||||
|
|
||||||
|
@ -336,6 +362,17 @@ Instead, you can now use the following:
|
||||||
zstyle ':omz:lib:directories' aliases no
|
zstyle ':omz:lib:directories' aliases no
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Disable async git prompt
|
||||||
|
|
||||||
|
Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render prompt information
|
||||||
|
asyncronously. This can improve prompt rendering performance, but it might not work well with some setups. We hope that's not an
|
||||||
|
issue, but if you're seeing problems with this new feature, you can turn it off by setting the following in your .zshrc file,
|
||||||
|
before Oh My Zsh is sourced:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zstyle ':omz:alpha:lib:git' async-prompt no
|
||||||
|
```
|
||||||
|
|
||||||
#### Notice <!-- omit in toc -->
|
#### Notice <!-- omit in toc -->
|
||||||
|
|
||||||
> This feature is currently in a testing phase and it may be subject to change in the future.
|
> This feature is currently in a testing phase and it may be subject to change in the future.
|
||||||
|
@ -376,7 +413,7 @@ zstyle ':omz:update' frequency 7
|
||||||
zstyle ':omz:update' frequency 0
|
zstyle ':omz:update' frequency 0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Updates verbosity
|
### Updates Verbosity
|
||||||
|
|
||||||
You can also limit the update verbosity with the following settings:
|
You can also limit the update verbosity with the following settings:
|
||||||
|
|
||||||
|
@ -404,7 +441,7 @@ Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy b
|
||||||
|
|
||||||
If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration.
|
If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration.
|
||||||
|
|
||||||
## How do I contribute to Oh My Zsh?
|
## How Do I Contribute To Oh My Zsh?
|
||||||
|
|
||||||
Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md).
|
Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md).
|
||||||
|
|
||||||
|
@ -414,7 +451,7 @@ We also need people to test out pull requests. So take a look through [the open
|
||||||
|
|
||||||
See [Contributing](CONTRIBUTING.md) for more details.
|
See [Contributing](CONTRIBUTING.md) for more details.
|
||||||
|
|
||||||
### Do NOT send us themes
|
### Do Not Send Us Themes
|
||||||
|
|
||||||
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.
|
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.
|
||||||
|
|
||||||
|
@ -424,6 +461,10 @@ Oh My Zsh has a vibrant community of happy users and delightful contributors. Wi
|
||||||
|
|
||||||
Thank you so much!
|
Thank you so much!
|
||||||
|
|
||||||
|
<a href="https://github.com/ohmyzsh/ohmyzsh/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=ohmyzsh/ohmyzsh" width="100%"/>
|
||||||
|
</a>
|
||||||
|
|
||||||
## Follow Us
|
## Follow Us
|
||||||
|
|
||||||
We're on social media:
|
We're on social media:
|
||||||
|
|
|
@ -17,8 +17,7 @@ In the near future we will introduce versioning, so expect this section to chang
|
||||||
|
|
||||||
**Do not submit an issue or pull request**: this might reveal the vulnerability.
|
**Do not submit an issue or pull request**: this might reveal the vulnerability.
|
||||||
|
|
||||||
Instead, you should email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh).
|
Instead, you should email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh),
|
||||||
|
or using the link to [privately report a vulnerability with GitHub](https://github.com/ohmyzsh/ohmyzsh/security/advisories/new).
|
||||||
|
|
||||||
We will deal with the vulnerability privately and submit a patch as soon as possible.
|
We will deal with the vulnerability privately and submit a patch as soon as possible.
|
||||||
|
|
||||||
You can also submit your vulnerability report to [huntr.dev](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) and see if you can get a bounty reward.
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# Put files in this folder to add your own custom functionality.
|
# Put files in this folder to add your own custom functionality.
|
||||||
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization
|
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization
|
||||||
#
|
#
|
||||||
# Files in the custom/ directory will be:
|
# Files in the custom/ directory will be:
|
||||||
# - loaded automatically by the init script, in alphabetical order
|
# - loaded automatically by the init script, in alphabetical order
|
||||||
# - loaded last, after all built-ins in the lib/ directory, to override them
|
# - loaded last, after all built-ins in the lib/ directory, to override them
|
||||||
# - ignored by git by default
|
# - ignored by git by default
|
||||||
#
|
#
|
||||||
# Example: add custom/shortcuts.zsh for shortcuts to your local projects
|
# Example: add custom/shortcuts.zsh for shortcuts to your local projects
|
||||||
#
|
#
|
||||||
# brainstormr=~/Projects/development/planetargon/brainstormr
|
# brainstormr=~/Projects/development/planetargon/brainstormr
|
||||||
# cd $brainstormr
|
# cd $brainstormr
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Put your custom themes in this folder.
|
# Put your custom themes in this folder.
|
||||||
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
|
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
|
|
||||||
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
|
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
|
||||||
|
|
144
lib/async_prompt.zsh
Normal file
144
lib/async_prompt.zsh
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
# The async code is taken from
|
||||||
|
# https://github.com/zsh-users/zsh-autosuggestions/blob/master/src/async.zsh
|
||||||
|
# https://github.com/woefe/git-prompt.zsh/blob/master/git-prompt.zsh
|
||||||
|
|
||||||
|
zmodload zsh/system
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
|
# For now, async prompt function handlers are set up like so:
|
||||||
|
# First, define the async function handler and register the handler
|
||||||
|
# with _omz_register_handler:
|
||||||
|
#
|
||||||
|
# function _git_prompt_status_async {
|
||||||
|
# # Do some expensive operation that outputs to stdout
|
||||||
|
# }
|
||||||
|
# _omz_register_handler _git_prompt_status_async
|
||||||
|
#
|
||||||
|
# Then add a stub prompt function in `$PROMPT` or similar prompt variables,
|
||||||
|
# which will show the output of "$_OMZ_ASYNC_OUTPUT[handler_name]":
|
||||||
|
#
|
||||||
|
# function git_prompt_status {
|
||||||
|
# echo -n $_OMZ_ASYNC_OUTPUT[_git_prompt_status_async]
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# RPROMPT='$(git_prompt_status)'
|
||||||
|
#
|
||||||
|
# This API is subject to change and optimization. Rely on it at your own risk.
|
||||||
|
|
||||||
|
function _omz_register_handler {
|
||||||
|
setopt localoptions noksharrays
|
||||||
|
typeset -ga _omz_async_functions
|
||||||
|
# we want to do nothing if there's no $1 function or we already set it up
|
||||||
|
if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
|
||||||
|
|| (( ${_omz_async_functions[(Ie)$1]} )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
_omz_async_functions+=("$1")
|
||||||
|
# let's add the hook to async_request if it's not there yet
|
||||||
|
if (( ! ${precmd_functions[(Ie)_omz_async_request]} )) \
|
||||||
|
&& (( ${+functions[_omz_async_request]})); then
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
add-zsh-hook precmd _omz_async_request
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set up async handlers and callbacks
|
||||||
|
function _omz_async_request {
|
||||||
|
local -i ret=$?
|
||||||
|
typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT
|
||||||
|
|
||||||
|
# executor runs a subshell for all async requests based on key
|
||||||
|
local handler
|
||||||
|
for handler in ${_omz_async_functions}; do
|
||||||
|
(( ${+functions[$handler]} )) || continue
|
||||||
|
|
||||||
|
local fd=${_OMZ_ASYNC_FDS[$handler]:--1}
|
||||||
|
local pid=${_OMZ_ASYNC_PIDS[$handler]:--1}
|
||||||
|
|
||||||
|
# If we've got a pending request, cancel it
|
||||||
|
if (( fd != -1 && pid != -1 )) && { true <&$fd } 2>/dev/null; then
|
||||||
|
# Close the file descriptor and remove the handler
|
||||||
|
exec {fd}<&-
|
||||||
|
zle -F $fd
|
||||||
|
|
||||||
|
# Zsh will make a new process group for the child process only if job
|
||||||
|
# control is enabled (MONITOR option)
|
||||||
|
if [[ -o MONITOR ]]; then
|
||||||
|
# Send the signal to the process group to kill any processes that may
|
||||||
|
# have been forked by the async function handler
|
||||||
|
kill -TERM -$pid 2>/dev/null
|
||||||
|
else
|
||||||
|
# Kill just the child process since it wasn't placed in a new process
|
||||||
|
# group. If the async function handler forked any child processes they may
|
||||||
|
# be orphaned and left behind.
|
||||||
|
kill -TERM $pid 2>/dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define global variables to store the file descriptor, PID and output
|
||||||
|
_OMZ_ASYNC_FDS[$handler]=-1
|
||||||
|
_OMZ_ASYNC_PIDS[$handler]=-1
|
||||||
|
|
||||||
|
# Fork a process to fetch the git status and open a pipe to read from it
|
||||||
|
exec {fd}< <(
|
||||||
|
# Tell parent process our PID
|
||||||
|
builtin echo ${sysparams[pid]}
|
||||||
|
# Set exit code for the handler if used
|
||||||
|
() { return $ret }
|
||||||
|
# Run the async function handler
|
||||||
|
$handler
|
||||||
|
)
|
||||||
|
|
||||||
|
# Save FD for handler
|
||||||
|
_OMZ_ASYNC_FDS[$handler]=$fd
|
||||||
|
|
||||||
|
# There's a weird bug here where ^C stops working unless we force a fork
|
||||||
|
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
|
||||||
|
# and https://github.com/zsh-users/zsh-autosuggestions/pull/612
|
||||||
|
is-at-least 5.8 || command true
|
||||||
|
|
||||||
|
# Save the PID from the handler child process
|
||||||
|
read -u $fd "_OMZ_ASYNC_PIDS[$handler]"
|
||||||
|
|
||||||
|
# When the fd is readable, call the response handler
|
||||||
|
zle -F "$fd" _omz_async_callback
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Called when new data is ready to be read from the pipe
|
||||||
|
function _omz_async_callback() {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
local fd=$1 # First arg will be fd ready for reading
|
||||||
|
local err=$2 # Second arg will be passed in case of error
|
||||||
|
|
||||||
|
if [[ -z "$err" || "$err" == "hup" ]]; then
|
||||||
|
# Get handler name from fd
|
||||||
|
local handler="${(k)_OMZ_ASYNC_FDS[(r)$fd]}"
|
||||||
|
|
||||||
|
# Store old output which is supposed to be already printed
|
||||||
|
local old_output="${_OMZ_ASYNC_OUTPUT[$handler]}"
|
||||||
|
|
||||||
|
# Read output from fd
|
||||||
|
IFS= read -r -u $fd -d '' "_OMZ_ASYNC_OUTPUT[$handler]"
|
||||||
|
|
||||||
|
# Repaint prompt if output has changed
|
||||||
|
if [[ "$old_output" != "${_OMZ_ASYNC_OUTPUT[$handler]}" ]]; then
|
||||||
|
zle .reset-prompt
|
||||||
|
zle -R
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Close the fd
|
||||||
|
exec {fd}<&-
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Always remove the handler
|
||||||
|
zle -F "$fd"
|
||||||
|
|
||||||
|
# Unset global FD variable to prevent closing user created FDs in the precmd hook
|
||||||
|
_OMZ_ASYNC_FDS[$handler]=-1
|
||||||
|
_OMZ_ASYNC_PIDS[$handler]=-1
|
||||||
|
}
|
||||||
|
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
add-zsh-hook precmd _omz_async_request
|
28
lib/cli.zsh
28
lib/cli.zsh
|
@ -241,10 +241,18 @@ function _omz::plugin::disable {
|
||||||
|
|
||||||
# Remove plugins substitution awk script
|
# Remove plugins substitution awk script
|
||||||
local awk_subst_plugins="\
|
local awk_subst_plugins="\
|
||||||
gsub(/[ \t]+(${(j:|:)dis_plugins})/, \"\") # with spaces before
|
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
|
||||||
gsub(/(${(j:|:)dis_plugins})[ \t]+/, \"\") # with spaces after
|
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
|
||||||
gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin)
|
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
|
||||||
|
|
||||||
|
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
|
||||||
|
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
|
||||||
|
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
|
||||||
|
|
||||||
|
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
|
||||||
|
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
|
||||||
"
|
"
|
||||||
|
|
||||||
# Disable plugins awk script
|
# Disable plugins awk script
|
||||||
local awk_script="
|
local awk_script="
|
||||||
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
||||||
|
@ -448,7 +456,7 @@ function _omz::plugin::load {
|
||||||
if [[ ! -f "$base/_$plugin" && ! -f "$base/$plugin.plugin.zsh" ]]; then
|
if [[ ! -f "$base/_$plugin" && ! -f "$base/$plugin.plugin.zsh" ]]; then
|
||||||
_omz::log warn "'$plugin' is not a valid plugin"
|
_omz::log warn "'$plugin' is not a valid plugin"
|
||||||
continue
|
continue
|
||||||
# It it is a valid plugin, add its directory to $fpath unless it is already there
|
# It is a valid plugin, add its directory to $fpath unless it is already there
|
||||||
elif (( ! ${fpath[(Ie)$base]} )); then
|
elif (( ! ${fpath[(Ie)$base]} )); then
|
||||||
fpath=("$base" $fpath)
|
fpath=("$base" $fpath)
|
||||||
fi
|
fi
|
||||||
|
@ -773,7 +781,17 @@ function _omz::theme::use {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _omz::update {
|
function _omz::update {
|
||||||
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
|
# Check if git command is available
|
||||||
|
(( $+commands[git] )) || {
|
||||||
|
_omz::log error "git is not installed. Aborting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
|
||||||
|
[[ $? -eq 0 ]] || {
|
||||||
|
_omz::log error "\`$ZSH\` is not a git directory. Aborting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# Run update script
|
# Run update script
|
||||||
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
||||||
|
|
|
@ -62,7 +62,7 @@ function detect-clipboard() {
|
||||||
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
|
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
|
||||||
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
||||||
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
|
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
|
||||||
function clippaste() { wl-paste; }
|
function clippaste() { wl-paste --no-newline; }
|
||||||
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
|
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
|
||||||
function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; }
|
function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; }
|
||||||
function clippaste() { xsel --clipboard --output; }
|
function clippaste() { xsel --clipboard --output; }
|
||||||
|
@ -100,8 +100,8 @@ function detect-clipboard() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set,
|
function clipcopy clippaste {
|
||||||
# which is not really an error. If the user calls them, they will attempt to redetect
|
unfunction clipcopy clippaste
|
||||||
# (for example, perhaps the user has now installed xclip) and then either print an error
|
detect-clipboard || true # let one retry
|
||||||
# or proceed successfully.
|
"$0" "$@"
|
||||||
detect-clipboard || true
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ function handle_completion_insecurities() {
|
||||||
# /usr/share/zsh/5.0.6
|
# /usr/share/zsh/5.0.6
|
||||||
#
|
#
|
||||||
# Since the ignorable first line is printed to stderr and thus not captured,
|
# Since the ignorable first line is printed to stderr and thus not captured,
|
||||||
# stderr is squelched to prevent this output from leaking to the user.
|
# stderr is squelched to prevent this output from leaking to the user.
|
||||||
local -aU insecure_dirs
|
local -aU insecure_dirs
|
||||||
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
|
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||||
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
||||||
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
||||||
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
||||||
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
||||||
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
||||||
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
||||||
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#
|
#
|
||||||
# This is written in a defensive style so it still works (and can detect) cases when
|
# This is written in a defensive style so it still works (and can detect) cases when
|
||||||
# basic functionality like echo and which have been redefined. In particular, almost
|
# basic functionality like echo and which have been redefined. In particular, almost
|
||||||
# everything is invoked with "builtin" or "command", to work in the face of user
|
# everything is invoked with "builtin" or "command", to work in the face of user
|
||||||
# redefinitions.
|
# redefinitions.
|
||||||
#
|
#
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
@ -59,7 +59,7 @@ function omz_diagnostic_dump() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
|
|
||||||
builtin echo "Generating diagnostic dump; please be patient..."
|
builtin echo "Generating diagnostic dump; please be patient..."
|
||||||
|
|
||||||
local thisfcn=omz_diagnostic_dump
|
local thisfcn=omz_diagnostic_dump
|
||||||
local -A opts
|
local -A opts
|
||||||
local opt_verbose opt_noverbose opt_outfile
|
local opt_verbose opt_noverbose opt_outfile
|
||||||
|
@ -90,7 +90,7 @@ function omz_diagnostic_dump() {
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo Diagnostic dump file created at: "$outfile"
|
builtin echo Diagnostic dump file created at: "$outfile"
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo To share this with OMZ developers, post it as a gist on GitHub
|
builtin echo To share this with OMZ developers, post it as a gist on GitHub
|
||||||
builtin echo at "https://gist.github.com" and share the link to the gist.
|
builtin echo at "https://gist.github.com" and share the link to the gist.
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
|
builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
|
||||||
|
@ -105,8 +105,8 @@ function _omz_diag_dump_one_big_text() {
|
||||||
builtin echo oh-my-zsh diagnostic dump
|
builtin echo oh-my-zsh diagnostic dump
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo $outfile
|
builtin echo $outfile
|
||||||
builtin echo
|
builtin echo
|
||||||
|
|
||||||
# Basic system and zsh information
|
# Basic system and zsh information
|
||||||
command date
|
command date
|
||||||
command uname -a
|
command uname -a
|
||||||
|
@ -151,7 +151,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
|
|
||||||
# Core command definitions
|
# Core command definitions
|
||||||
_omz_diag_dump_check_core_commands || return 1
|
_omz_diag_dump_check_core_commands || return 1
|
||||||
builtin echo
|
builtin echo
|
||||||
|
|
||||||
# ZSH Process state
|
# ZSH Process state
|
||||||
builtin echo Process state:
|
builtin echo Process state:
|
||||||
|
@ -167,7 +167,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
#TODO: Should this include `env` instead of or in addition to `export`?
|
#TODO: Should this include `env` instead of or in addition to `export`?
|
||||||
builtin echo Exported:
|
builtin echo Exported:
|
||||||
builtin echo $(builtin export | command sed 's/=.*//')
|
builtin echo $(builtin export | command sed 's/=.*//')
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo Locale:
|
builtin echo Locale:
|
||||||
command locale
|
command locale
|
||||||
builtin echo
|
builtin echo
|
||||||
|
@ -181,7 +181,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo 'compaudit output:'
|
builtin echo 'compaudit output:'
|
||||||
compaudit
|
compaudit
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo '$fpath directories:'
|
builtin echo '$fpath directories:'
|
||||||
command ls -lad $fpath
|
command ls -lad $fpath
|
||||||
builtin echo
|
builtin echo
|
||||||
|
@ -224,7 +224,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
local cfgfile cfgfiles
|
local cfgfile cfgfiles
|
||||||
# Some files for bash that zsh does not use are intentionally included
|
# Some files for bash that zsh does not use are intentionally included
|
||||||
# to help with diagnosing behavior differences between bash and zsh
|
# to help with diagnosing behavior differences between bash and zsh
|
||||||
cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
|
cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
|
||||||
$zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout
|
$zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout
|
||||||
~/.zsh.pre-oh-my-zsh
|
~/.zsh.pre-oh-my-zsh
|
||||||
/etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout )
|
/etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout )
|
||||||
|
@ -258,8 +258,8 @@ function _omz_diag_dump_check_core_commands() {
|
||||||
# (For back-compatibility, if any of these are newish, they should be removed,
|
# (For back-compatibility, if any of these are newish, they should be removed,
|
||||||
# or at least made conditional on the version of the current running zsh.)
|
# or at least made conditional on the version of the current running zsh.)
|
||||||
# "history" is also excluded because OMZ is known to redefine that
|
# "history" is also excluded because OMZ is known to redefine that
|
||||||
reserved_words=( do done esac then elif else fi for case if while function
|
reserved_words=( do done esac then elif else fi for case if while function
|
||||||
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
||||||
)
|
)
|
||||||
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
|
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
|
||||||
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
|
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
|
||||||
|
@ -331,7 +331,7 @@ function _omz_diag_dump_os_specific_version() {
|
||||||
case "$OSTYPE" in
|
case "$OSTYPE" in
|
||||||
darwin*)
|
darwin*)
|
||||||
osname=$(command sw_vers -productName)
|
osname=$(command sw_vers -productName)
|
||||||
osver=$(command sw_vers -productVersion)
|
osver=$(command sw_vers -productVersion)
|
||||||
builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
|
builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
|
||||||
;;
|
;;
|
||||||
cygwin)
|
cygwin)
|
||||||
|
|
|
@ -182,6 +182,8 @@ function omz_urlencode() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use LC_CTYPE=C to process text byte-by-byte
|
# Use LC_CTYPE=C to process text byte-by-byte
|
||||||
|
# Note that this doesn't work in Termux, as it only has UTF-8 locale.
|
||||||
|
# Characters will be processed as UTF-8, which is fine for URLs.
|
||||||
local i byte ord LC_ALL=C
|
local i byte ord LC_ALL=C
|
||||||
export LC_ALL
|
export LC_ALL
|
||||||
local reserved=';/?:@&=+$,'
|
local reserved=';/?:@&=+$,'
|
||||||
|
@ -206,6 +208,9 @@ function omz_urlencode() {
|
||||||
else
|
else
|
||||||
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||||
url_str+="+"
|
url_str+="+"
|
||||||
|
elif [[ "$PREFIX" = *com.termux* ]]; then
|
||||||
|
# Termux does not have non-UTF8 locales, so just send the UTF-8 character directly
|
||||||
|
url_str+="$byte"
|
||||||
else
|
else
|
||||||
ord=$(( [##16] #byte ))
|
ord=$(( [##16] #byte ))
|
||||||
url_str+="%$ord"
|
url_str+="%$ord"
|
||||||
|
|
58
lib/git.zsh
58
lib/git.zsh
|
@ -1,3 +1,5 @@
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
# The git prompt's git commands are read-only and should not interfere with
|
# The git prompt's git commands are read-only and should not interfere with
|
||||||
# other processes. This environment variable is equivalent to running with `git
|
# other processes. This environment variable is equivalent to running with `git
|
||||||
# --no-optional-locks`, but falls back gracefully for older versions of git.
|
# --no-optional-locks`, but falls back gracefully for older versions of git.
|
||||||
|
@ -9,14 +11,18 @@ function __git_prompt_git() {
|
||||||
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_prompt_info() {
|
function _omz_git_prompt_info() {
|
||||||
# If we are on a folder not tracked by git, get out.
|
# If we are on a folder not tracked by git, get out.
|
||||||
# Otherwise, check for hide-info at global and local repository level
|
# Otherwise, check for hide-info at global and local repository level
|
||||||
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|
||||||
|| [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
|
|| [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get either:
|
||||||
|
# - the current branch name
|
||||||
|
# - the tag name if we are on a tag
|
||||||
|
# - the short SHA of the current commit
|
||||||
local ref
|
local ref
|
||||||
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|
||||||
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|
||||||
|
@ -33,6 +39,52 @@ function git_prompt_info() {
|
||||||
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Use async version if setting is enabled or undefined
|
||||||
|
if zstyle -T ':omz:alpha:lib:git' async-prompt; then
|
||||||
|
function git_prompt_info() {
|
||||||
|
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
|
||||||
|
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_status() {
|
||||||
|
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
|
||||||
|
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Conditionally register the async handler, only if it's needed in $PROMPT
|
||||||
|
# or any of the other prompt variables
|
||||||
|
function _defer_async_git_register() {
|
||||||
|
# Check if git_prompt_info is used in a prompt variable
|
||||||
|
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
||||||
|
*(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
|
||||||
|
_omz_register_handler _omz_git_prompt_info
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
||||||
|
*(\$\(git_prompt_status\)|\`git_prompt_status\`)*)
|
||||||
|
_omz_register_handler _omz_git_prompt_status
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
add-zsh-hook -d precmd _defer_async_git_register
|
||||||
|
unset -f _defer_async_git_register
|
||||||
|
}
|
||||||
|
|
||||||
|
# Register the async handler first. This needs to be done before
|
||||||
|
# the async request prompt is run
|
||||||
|
precmd_functions=(_defer_async_git_register $precmd_functions)
|
||||||
|
else
|
||||||
|
function git_prompt_info() {
|
||||||
|
_omz_git_prompt_info
|
||||||
|
}
|
||||||
|
function git_prompt_status() {
|
||||||
|
_omz_git_prompt_status
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
# Checks if working tree is dirty
|
# Checks if working tree is dirty
|
||||||
function parse_git_dirty() {
|
function parse_git_dirty() {
|
||||||
local STATUS
|
local STATUS
|
||||||
|
@ -161,7 +213,7 @@ function git_prompt_long_sha() {
|
||||||
SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_prompt_status() {
|
function _omz_git_prompt_status() {
|
||||||
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
||||||
|
|
||||||
# Maps a git status prefix to an internal constant
|
# Maps a git status prefix to an internal constant
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
## History wrapper
|
## History wrapper
|
||||||
function omz_history {
|
function omz_history {
|
||||||
local clear list
|
# parse arguments and remove from $@
|
||||||
zparseopts -E c=clear l=list
|
local clear list stamp
|
||||||
|
zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp t:=stamp
|
||||||
|
|
||||||
if [[ -n "$clear" ]]; then
|
if [[ -n "$clear" ]]; then
|
||||||
# if -c provided, clobber the history file
|
# if -c provided, clobber the history file
|
||||||
echo -n >| "$HISTFILE"
|
echo -n >| "$HISTFILE"
|
||||||
fc -p "$HISTFILE"
|
fc -p "$HISTFILE"
|
||||||
echo >&2 History file deleted.
|
echo >&2 History file deleted.
|
||||||
elif [[ -n "$list" ]]; then
|
elif [[ $# -eq 0 ]]; then
|
||||||
# if -l provided, run as if calling `fc' directly
|
# if no arguments provided, show full history starting from 1
|
||||||
builtin fc "$@"
|
builtin fc $stamp -l 1
|
||||||
else
|
else
|
||||||
# unless a number is provided, show all history events (starting from 1)
|
# otherwise, run `fc -l` with a custom format
|
||||||
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
|
builtin fc $stamp -l "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,19 +32,26 @@ if [[ -n "${terminfo[knp]}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start typing + [Up-Arrow] - fuzzy find history forward
|
# Start typing + [Up-Arrow] - fuzzy find history forward
|
||||||
if [[ -n "${terminfo[kcuu1]}" ]]; then
|
autoload -U up-line-or-beginning-search
|
||||||
autoload -U up-line-or-beginning-search
|
zle -N up-line-or-beginning-search
|
||||||
zle -N up-line-or-beginning-search
|
|
||||||
|
|
||||||
|
bindkey -M emacs "^[[A" up-line-or-beginning-search
|
||||||
|
bindkey -M viins "^[[A" up-line-or-beginning-search
|
||||||
|
bindkey -M vicmd "^[[A" up-line-or-beginning-search
|
||||||
|
if [[ -n "${terminfo[kcuu1]}" ]]; then
|
||||||
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
|
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
|
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
|
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
fi
|
fi
|
||||||
# Start typing + [Down-Arrow] - fuzzy find history backward
|
|
||||||
if [[ -n "${terminfo[kcud1]}" ]]; then
|
|
||||||
autoload -U down-line-or-beginning-search
|
|
||||||
zle -N down-line-or-beginning-search
|
|
||||||
|
|
||||||
|
# Start typing + [Down-Arrow] - fuzzy find history backward
|
||||||
|
autoload -U down-line-or-beginning-search
|
||||||
|
zle -N down-line-or-beginning-search
|
||||||
|
|
||||||
|
bindkey -M emacs "^[[B" down-line-or-beginning-search
|
||||||
|
bindkey -M viins "^[[B" down-line-or-beginning-search
|
||||||
|
bindkey -M vicmd "^[[B" down-line-or-beginning-search
|
||||||
|
if [[ -n "${terminfo[kcud1]}" ]]; then
|
||||||
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
|
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
|
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
|
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
|
|
|
@ -19,8 +19,13 @@ setopt multios # enable redirect to multiple streams: echo >file1 >
|
||||||
setopt long_list_jobs # show long list format job notifications
|
setopt long_list_jobs # show long list format job notifications
|
||||||
setopt interactivecomments # recognize comments
|
setopt interactivecomments # recognize comments
|
||||||
|
|
||||||
env_default 'PAGER' 'less'
|
# define pager dependant on what is available (less or more)
|
||||||
env_default 'LESS' '-R'
|
if (( ${+commands[less]} )); then
|
||||||
|
env_default 'PAGER' 'less'
|
||||||
|
env_default 'LESS' '-R'
|
||||||
|
elif (( ${+commands[more]} )); then
|
||||||
|
env_default 'PAGER' 'more'
|
||||||
|
fi
|
||||||
|
|
||||||
## super user alias
|
## super user alias
|
||||||
alias _='sudo '
|
alias _='sudo '
|
||||||
|
|
|
@ -40,5 +40,5 @@ ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
||||||
# use this to enable users to see their ruby version, no matter which
|
# use this to enable users to see their ruby version, no matter which
|
||||||
# version management system they use
|
# version management system they use
|
||||||
function ruby_prompt_info() {
|
function ruby_prompt_info() {
|
||||||
echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info)
|
echo "$(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info)"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ typeset -AHg FX FG BG
|
||||||
FX=(
|
FX=(
|
||||||
reset "%{[00m%}"
|
reset "%{[00m%}"
|
||||||
bold "%{[01m%}" no-bold "%{[22m%}"
|
bold "%{[01m%}" no-bold "%{[22m%}"
|
||||||
|
dim "%{[02m%}" no-dim "%{[22m%}"
|
||||||
italic "%{[03m%}" no-italic "%{[23m%}"
|
italic "%{[03m%}" no-italic "%{[23m%}"
|
||||||
underline "%{[04m%}" no-underline "%{[24m%}"
|
underline "%{[04m%}" no-underline "%{[24m%}"
|
||||||
blink "%{[05m%}" no-blink "%{[25m%}"
|
blink "%{[05m%}" no-blink "%{[25m%}"
|
||||||
|
|
|
@ -17,7 +17,7 @@ function title {
|
||||||
: ${2=$1}
|
: ${2=$1}
|
||||||
|
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*|foot|contour*)
|
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*)
|
||||||
print -Pn "\e]2;${2:q}\a" # set window name
|
print -Pn "\e]2;${2:q}\a" # set window name
|
||||||
print -Pn "\e]1;${1:q}\a" # set tab name
|
print -Pn "\e]1;${1:q}\a" # set tab name
|
||||||
;;
|
;;
|
||||||
|
@ -129,7 +129,7 @@ fi
|
||||||
# Don't define the function if we're in an unsupported terminal
|
# Don't define the function if we're in an unsupported terminal
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
# all of these either process OSC 7 correctly or ignore entirely
|
# all of these either process OSC 7 correctly or ignore entirely
|
||||||
xterm*|putty*|rxvt*|konsole*|mlterm*|alacritty|screen*|tmux*) ;;
|
xterm*|putty*|rxvt*|konsole*|mlterm*|alacritty*|screen*|tmux*) ;;
|
||||||
contour*|foot*) ;;
|
contour*|foot*) ;;
|
||||||
*)
|
*)
|
||||||
# Terminal.app and iTerm2 process OSC 7 correctly
|
# Terminal.app and iTerm2 process OSC 7 correctly
|
||||||
|
@ -151,7 +151,7 @@ function omz_termsupport_cwd {
|
||||||
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
|
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
|
||||||
|
|
||||||
# Konsole errors if the HOST is provided
|
# Konsole errors if the HOST is provided
|
||||||
[[ -z "$KONSOLE_VERSION" ]] || URL_HOST=""
|
[[ -z "$KONSOLE_PROFILE_NAME" && -z "$KONSOLE_DBUS_SESSION" ]] || URL_HOST=""
|
||||||
|
|
||||||
# common control sequence (OSC 7) to set current host and path
|
# common control sequence (OSC 7) to set current host and path
|
||||||
printf "\e]7;file://%s%s\e\\" "${URL_HOST}" "${URL_PATH}"
|
printf "\e]7;file://%s%s\e\\" "${URL_HOST}" "${URL_PATH}"
|
||||||
|
|
169
lib/tests/cli.test.zsh
Normal file
169
lib/tests/cli.test.zsh
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
#!/usr/bin/zsh -df
|
||||||
|
|
||||||
|
run_awk() {
|
||||||
|
local -a dis_plugins=(${=1})
|
||||||
|
local input_text="$2"
|
||||||
|
|
||||||
|
(( ! DEBUG )) || set -xv
|
||||||
|
|
||||||
|
local awk_subst_plugins="\
|
||||||
|
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
|
||||||
|
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
|
||||||
|
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
|
||||||
|
|
||||||
|
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
|
||||||
|
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
|
||||||
|
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
|
||||||
|
|
||||||
|
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
|
||||||
|
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
|
||||||
|
"
|
||||||
|
# Disable plugins awk script
|
||||||
|
local awk_script="
|
||||||
|
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
||||||
|
/^[ \t]*plugins=\([^#]+\).*\$/ {
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
# if plugins=() is in multiline form, enable multi flag and disable plugins if they're there
|
||||||
|
/^[ \t]*plugins=\(/ {
|
||||||
|
multi=1
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
# if multi flag is enabled and we find a valid closing parenthesis, remove plugins and disable multi flag
|
||||||
|
multi == 1 && /^[^#]*\)/ {
|
||||||
|
multi=0
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
multi == 1 && length(\$0) > 0 {
|
||||||
|
$awk_subst_plugins
|
||||||
|
if (length(\$0) > 0) print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
{ print \$0 }
|
||||||
|
"
|
||||||
|
|
||||||
|
command awk "$awk_script" <<< "$input_text"
|
||||||
|
|
||||||
|
(( ! DEBUG )) || set +xv
|
||||||
|
}
|
||||||
|
|
||||||
|
# runs awk against stdin, checks if the resulting file is not empty and then checks if the file has valid zsh syntax
|
||||||
|
run_awk_and_test() {
|
||||||
|
local description="$1"
|
||||||
|
local plugins_to_disable="$2"
|
||||||
|
local input_text="$3"
|
||||||
|
local expected_output="$4"
|
||||||
|
|
||||||
|
local tmpfile==(:)
|
||||||
|
|
||||||
|
{
|
||||||
|
print -u2 "Test: $description"
|
||||||
|
DEBUG=0 run_awk "$plugins_to_disable" "$input_text" >| $tmpfile
|
||||||
|
|
||||||
|
if [[ ! -s "$tmpfile" ]]; then
|
||||||
|
print -u2 "\e[31mError\e[0m: output file empty"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! zsh -n $tmpfile; then
|
||||||
|
print -u2 "\e[31mError\e[0m: zsh syntax error"
|
||||||
|
diff -u $tmpfile <(echo "$expected_output")
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! diff -u --color=always $tmpfile <(echo "$expected_output"); then
|
||||||
|
if (( DEBUG )); then
|
||||||
|
print -u2 ""
|
||||||
|
DEBUG=1 run_awk "$plugins_to_disable" "$input_text"
|
||||||
|
print -u2 ""
|
||||||
|
fi
|
||||||
|
print -u2 "\e[31mError\e[0m: output file does not match expected output"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
print -u2 "\e[32mSuccess\e[0m"
|
||||||
|
} always {
|
||||||
|
print -u2 ""
|
||||||
|
command rm -f "$tmpfile"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# These tests are for the `omz plugin disable` command
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete a single plugin in oneline format" \
|
||||||
|
"git" \
|
||||||
|
"plugins=(git)" \
|
||||||
|
"plugins=()"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete a single plugin in multiline format" \
|
||||||
|
"github" \
|
||||||
|
"plugins=(
|
||||||
|
github
|
||||||
|
)" \
|
||||||
|
"plugins=(
|
||||||
|
)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete multiple plugins in oneline format" \
|
||||||
|
"github git z" \
|
||||||
|
"plugins=(github git z)" \
|
||||||
|
"plugins=()"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete multiple plugins in multiline format" \
|
||||||
|
"github git z" \
|
||||||
|
"plugins=(
|
||||||
|
github
|
||||||
|
git
|
||||||
|
z
|
||||||
|
)" \
|
||||||
|
"plugins=(
|
||||||
|
)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete a single plugin among multiple in oneline format" \
|
||||||
|
"git" \
|
||||||
|
"plugins=(github git z)" \
|
||||||
|
"plugins=(github z)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete a single plugin among multiple in multiline format" \
|
||||||
|
"git" \
|
||||||
|
"plugins=(
|
||||||
|
github
|
||||||
|
git
|
||||||
|
z
|
||||||
|
)" \
|
||||||
|
"plugins=(
|
||||||
|
github
|
||||||
|
z
|
||||||
|
)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete multiple plugins in mixed format" \
|
||||||
|
"git z" \
|
||||||
|
"plugins=(github
|
||||||
|
git z)" \
|
||||||
|
"plugins=(github
|
||||||
|
)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete multiple plugins in mixed format 2" \
|
||||||
|
"github z" \
|
||||||
|
"plugins=(github
|
||||||
|
git
|
||||||
|
z)" \
|
||||||
|
"plugins=(
|
||||||
|
git
|
||||||
|
)"
|
37
oh-my-zsh.sh
37
oh-my-zsh.sh
|
@ -1,14 +1,14 @@
|
||||||
|
# ANSI formatting function (\033[<code>m)
|
||||||
|
# 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
|
||||||
|
omz_f() {
|
||||||
|
[ $# -gt 0 ] || return
|
||||||
|
IFS=";" printf "\033[%sm" $*
|
||||||
|
}
|
||||||
|
# If stdout is not a terminal ignore all formatting
|
||||||
|
[ -t 1 ] || omz_f() { :; }
|
||||||
|
|
||||||
# Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here)
|
# Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here)
|
||||||
[ -n "$ZSH_VERSION" ] || {
|
[ -n "$ZSH_VERSION" ] || {
|
||||||
# ANSI formatting function (\033[<code>m)
|
|
||||||
# 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
|
|
||||||
omz_f() {
|
|
||||||
[ $# -gt 0 ] || return
|
|
||||||
IFS=";" printf "\033[%sm" $*
|
|
||||||
}
|
|
||||||
# If stdout is not a terminal ignore all formatting
|
|
||||||
[ -t 1 ] || omz_f() { :; }
|
|
||||||
|
|
||||||
omz_ptree() {
|
omz_ptree() {
|
||||||
# Get process tree of the current process
|
# Get process tree of the current process
|
||||||
pid=$$; pids="$pid"
|
pid=$$; pids="$pid"
|
||||||
|
@ -38,6 +38,15 @@
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if in emulation mode, if so early return
|
||||||
|
# https://github.com/ohmyzsh/ohmyzsh/issues/11686
|
||||||
|
[[ "$(emulate)" = zsh ]] || {
|
||||||
|
printf "$(omz_f 1 31)Error:$(omz_f 22) Oh My Zsh can't be loaded in \`$(emulate)\` emulation mode.$(omz_f 0)\n" >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
unset -f omz_f
|
||||||
|
|
||||||
# If ZSH is not defined, use the current script's directory.
|
# If ZSH is not defined, use the current script's directory.
|
||||||
[[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}"
|
[[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}"
|
||||||
|
|
||||||
|
@ -143,7 +152,7 @@ unset zcompdump_revision zcompdump_fpath zcompdump_refresh
|
||||||
# zcompile the completion dump file if the .zwc is older or missing.
|
# zcompile the completion dump file if the .zwc is older or missing.
|
||||||
if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
|
if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
|
||||||
zrecompile -q -p "$ZSH_COMPDUMP"
|
zrecompile -q -p "$ZSH_COMPDUMP"
|
||||||
command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
|
command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_omz_source() {
|
_omz_source() {
|
||||||
|
@ -187,12 +196,12 @@ _omz_source() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
# Load all of the lib files in ~/oh-my-zsh/lib that end in .zsh
|
||||||
# TIP: Add files you don't want in git to .gitignore
|
# TIP: Add files you don't want in git to .gitignore
|
||||||
for config_file ("$ZSH"/lib/*.zsh); do
|
for lib_file ("$ZSH"/lib/*.zsh); do
|
||||||
_omz_source "lib/${config_file:t}"
|
_omz_source "lib/${lib_file:t}"
|
||||||
done
|
done
|
||||||
unset custom_config_file
|
unset lib_file
|
||||||
|
|
||||||
# Load all of the plugins that were defined in ~/.zshrc
|
# Load all of the plugins that were defined in ~/.zshrc
|
||||||
for plugin ($plugins); do
|
for plugin ($plugins); do
|
||||||
|
|
9
plugins/alias-finder/.zunit.yml
Normal file
9
plugins/alias-finder/.zunit.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
tap: false
|
||||||
|
directories:
|
||||||
|
tests: tests
|
||||||
|
output: tests/_output
|
||||||
|
support: tests/_support
|
||||||
|
time_limit: 0
|
||||||
|
fail_fast: false
|
||||||
|
allow_risky: false
|
||||||
|
verbose: true
|
|
@ -2,45 +2,32 @@
|
||||||
|
|
||||||
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
|
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
|
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
|
||||||
```
|
```
|
||||||
plugins=(... alias-finder)
|
plugins=(... alias-finder)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
To enable it for every single command, set zstyle in your `~/.zshrc`.
|
||||||
To see if there is an alias defined for the command, pass it as an argument to `alias-finder`. This can also run automatically before each command you input - add `ZSH_ALIAS_FINDER_AUTOMATIC=true` to your zshrc if you want this.
|
|
||||||
|
|
||||||
## Options
|
```zsh
|
||||||
|
# ~/.zshrc
|
||||||
|
|
||||||
|
zstyle ':omz:plugins:alias-finder' autoload yes # disabled by default
|
||||||
|
zstyle ':omz:plugins:alias-finder' longer yes # disabled by default
|
||||||
|
zstyle ':omz:plugins:alias-finder' exact yes # disabled by default
|
||||||
|
zstyle ':omz:plugins:alias-finder' cheaper yes # disabled by default
|
||||||
|
```
|
||||||
|
|
||||||
|
As you can see, options are also available with zstyle.
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
> In order to clarify, let's say `alias a=abc` has source 'abc' and destination 'a'.
|
||||||
|
|
||||||
|
- Use `--longer` or `-l` to include aliases where the source is longer than the input (in other words, the source could contain the whole input).
|
||||||
|
- Use `--exact` or `-e` to avoid aliases where the source is shorter than the input (in other words, the source must be the same with the input).
|
||||||
|
- Use `--cheaper` or `-c` to avoid aliases where the destination is longer than the input (in other words, the destination must be the shorter than the input).
|
||||||
|
|
||||||
- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input).
|
|
||||||
- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
```
|
|
||||||
$ alias-finder "git pull"
|
|
||||||
gl='git pull'
|
|
||||||
g=git
|
|
||||||
```
|
|
||||||
```
|
|
||||||
$ alias-finder "web_search google oh my zsh"
|
|
||||||
google='web_search google'
|
|
||||||
```
|
|
||||||
```
|
|
||||||
$ alias-finder "git commit -v"
|
|
||||||
gc="git commit -v"
|
|
||||||
g=git
|
|
||||||
```
|
|
||||||
```
|
|
||||||
$ alias-finder -e "git commit -v"
|
|
||||||
gc='git commit -v'
|
|
||||||
```
|
|
||||||
```
|
|
||||||
$ alias-finder -l "git commit -v"
|
|
||||||
gc='git commit -v'
|
|
||||||
'gc!'='git commit -v --amend'
|
|
||||||
gca='git commit -v -a'
|
|
||||||
'gca!'='git commit -v -a --amend'
|
|
||||||
'gcan!'='git commit -v -a --no-edit --amend'
|
|
||||||
'gcans!'='git commit -v -a -s --no-edit --amend'
|
|
||||||
'gcn!'='git commit -v --no-edit --amend'
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,44 +1,59 @@
|
||||||
alias-finder() {
|
alias-finder() {
|
||||||
local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
|
local cmd=" " exact="" longer="" cheaper="" wordEnd="'{0,1}$" finder="" filter=""
|
||||||
for i in $@; do
|
|
||||||
case $i in
|
# build command and options
|
||||||
|
for c in "$@"; do
|
||||||
|
case $c in
|
||||||
|
# TODO: Remove backward compatibility (other than zstyle form)
|
||||||
|
# set options if exist
|
||||||
-e|--exact) exact=true;;
|
-e|--exact) exact=true;;
|
||||||
-l|--longer) longer=true;;
|
-l|--longer) longer=true;;
|
||||||
*)
|
-c|--cheaper) cheaper=true;;
|
||||||
if [[ -z $cmd ]]; then
|
# concatenate cmd
|
||||||
cmd=$i
|
*) cmd="$cmd$c " ;;
|
||||||
else
|
|
||||||
cmd="$cmd $i"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
|
|
||||||
if (( $(wc -l <<< $cmd) == 1 )); then
|
zstyle -t ':omz:plugins:alias-finder' longer && longer=true
|
||||||
while [[ $cmd != "" ]]; do
|
zstyle -t ':omz:plugins:alias-finder' exact && exact=true
|
||||||
if [[ $longer = true ]]; then
|
zstyle -t ':omz:plugins:alias-finder' cheaper && cheaper=true
|
||||||
wordStart="'{0,1}"
|
|
||||||
else
|
# format cmd for grep
|
||||||
wordEnd="$"
|
## - replace newlines with spaces
|
||||||
multiWordEnd="'$"
|
## - trim both ends
|
||||||
fi
|
## - replace multiple spaces with one space
|
||||||
if [[ $cmd == *" "* ]]; then
|
## - add escaping character to special characters
|
||||||
local finder="'$cmd$multiWordEnd"
|
cmd=$(echo -n "$cmd" | tr '\n' ' ' | xargs | tr -s '[:space:]' | sed 's/[].\|$(){}?+*^[]/\\&/g')
|
||||||
else
|
|
||||||
local finder=$wordStart$cmd$wordEnd
|
if [[ $longer == true ]]; then
|
||||||
fi
|
wordEnd="" # remove wordEnd to find longer aliases
|
||||||
alias | grep -E "=$finder"
|
|
||||||
if [[ $exact = true || $longer = true ]]; then
|
|
||||||
break
|
|
||||||
else
|
|
||||||
cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# find with alias and grep, removing last word each time until no more words
|
||||||
|
while [[ $cmd != "" ]]; do
|
||||||
|
finder="'{0,1}$cmd$wordEnd"
|
||||||
|
|
||||||
|
# make filter to find only shorter results than current cmd
|
||||||
|
if [[ $cheaper == true ]]; then
|
||||||
|
cmdLen=$(echo -n "$cmd" | wc -c)
|
||||||
|
filter="^'{0,1}.{0,$((cmdLen - 1))}="
|
||||||
|
fi
|
||||||
|
|
||||||
|
alias | grep -E "$filter" | grep -E "=$finder"
|
||||||
|
|
||||||
|
if [[ $exact == true ]]; then
|
||||||
|
break # because exact case is only one
|
||||||
|
elif [[ $longer = true ]]; then
|
||||||
|
break # because above grep command already found every longer aliases during first cycle
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmd=$(sed -E 's/ {0,}[^ ]*$//' <<< "$cmd") # remove last word
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
preexec_alias-finder() {
|
preexec_alias-finder() {
|
||||||
if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
# TODO: Remove backward compatibility (other than zstyle form)
|
||||||
|
zstyle -t ':omz:plugins:alias-finder' autoload && alias-finder $1 || if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
||||||
alias-finder $1
|
alias-finder $1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
0
plugins/alias-finder/tests/_output/.gitkeep
Normal file
0
plugins/alias-finder/tests/_output/.gitkeep
Normal file
0
plugins/alias-finder/tests/_support/.gitkeep
Normal file
0
plugins/alias-finder/tests/_support/.gitkeep
Normal file
2
plugins/alias-finder/tests/_support/bootstrap
Normal file
2
plugins/alias-finder/tests/_support/bootstrap
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# Write your bootstrap code here
|
107
plugins/alias-finder/tests/test_run.sh
Normal file
107
plugins/alias-finder/tests/test_run.sh
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
#!/usr/bin/env zunit
|
||||||
|
|
||||||
|
@setup {
|
||||||
|
load ../alias-finder.plugin.zsh
|
||||||
|
|
||||||
|
set_git_aliases() {
|
||||||
|
unalias -a # all
|
||||||
|
alias g="git"
|
||||||
|
alias gc="git commit"
|
||||||
|
alias gcv="git commit -v"
|
||||||
|
alias gcvs="git commit -v -S"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find aliases that contain input' {
|
||||||
|
set_git_aliases
|
||||||
|
|
||||||
|
run alias-finder "git"
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 1
|
||||||
|
assert "${lines[1]}" same_as "g=git"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find aliases that contain input with whitespaces at ends' {
|
||||||
|
set_git_aliases
|
||||||
|
|
||||||
|
run alias-finder " git "
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 1
|
||||||
|
assert "${lines[1]}" same_as "g=git"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find aliases that contain multiple words' {
|
||||||
|
set_git_aliases
|
||||||
|
|
||||||
|
run alias-finder "git commit -v"
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 3
|
||||||
|
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||||
|
assert "${lines[2]}" same_as "gc='git commit'"
|
||||||
|
assert "${lines[3]}" same_as "g=git"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find alias that is the same with input when --exact option is set' {
|
||||||
|
set_git_aliases
|
||||||
|
|
||||||
|
run alias-finder -e "git"
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 1
|
||||||
|
assert "${lines[1]}" same_as "g=git"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find alias that is the same with multiple words input when --exact option is set' {
|
||||||
|
set_git_aliases
|
||||||
|
|
||||||
|
run alias-finder -e "git commit -v"
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 1
|
||||||
|
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find alias that is the same with or longer than input when --longer option is set' {
|
||||||
|
set_git_aliases
|
||||||
|
|
||||||
|
run alias-finder -l "git"
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 4
|
||||||
|
assert "${lines[1]}" same_as "g=git"
|
||||||
|
assert "${lines[2]}" same_as "gc='git commit'"
|
||||||
|
assert "${lines[3]}" same_as "gcv='git commit -v'"
|
||||||
|
assert "${lines[4]}" same_as "gcvs='git commit -v -S'"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find alias that is the same with or longer than multiple words input when --longer option is set' {
|
||||||
|
set_git_aliases
|
||||||
|
|
||||||
|
run alias-finder -l "git commit -v"
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 2
|
||||||
|
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||||
|
assert "${lines[2]}" same_as "gcvs='git commit -v -S'"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find aliases including expensive (longer) than input' {
|
||||||
|
set_git_aliases
|
||||||
|
alias expensiveCommands="git commit"
|
||||||
|
|
||||||
|
run alias-finder "git commit -v"
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 4
|
||||||
|
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||||
|
assert "${lines[2]}" same_as "expensiveCommands='git commit'"
|
||||||
|
assert "${lines[3]}" same_as "gc='git commit'"
|
||||||
|
assert "${lines[4]}" same_as "g=git"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test 'find aliases excluding expensive (longer) than input when --cheap option is set' {
|
||||||
|
set_git_aliases
|
||||||
|
alias expensiveCommands="git commit"
|
||||||
|
|
||||||
|
run alias-finder -c "git commit -v"
|
||||||
|
|
||||||
|
assert "${#lines[@]}" equals 3
|
||||||
|
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||||
|
assert "${lines[2]}" same_as "gc='git commit'"
|
||||||
|
assert "${lines[3]}" same_as "g=git"
|
||||||
|
}
|
|
@ -15,14 +15,14 @@ Requirements: Python needs to be installed.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
- `acs`: show all aliases by group
|
- `als`: show all aliases by group
|
||||||
|
|
||||||
- `acs -h/--help`: print help mesage
|
- `als -h/--help`: print help message
|
||||||
|
|
||||||
- `acs <keyword(s)>`: filter and highlight aliases by `<keyword>`
|
- `als <keyword(s)>`: filter and highlight aliases by `<keyword>`
|
||||||
|
|
||||||
- `acs -g <group>/--group <group>`: show only aliases for group `<group>`. Multiple uses of the flag show all groups
|
- `als -g <group>/--group <group>`: show only aliases for group `<group>`. Multiple uses of the flag show all groups
|
||||||
|
|
||||||
- `acs --groups`: show only group names
|
- `als --groups`: show only group names
|
||||||
|
|
||||||
![screenshot](https://cloud.githubusercontent.com/assets/3602957/11581913/cb54fb8a-9a82-11e5-846b-5a67f67ad9ad.png)
|
![screenshot](https://github.com/ohmyzsh/ohmyzsh/assets/66907184/5bfa00ea-5fc3-4e97-8b22-2f74f6b948c7)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||||
|
|
||||||
eval '
|
eval '
|
||||||
function acs(){
|
function als(){
|
||||||
(( $+commands[python3] )) || {
|
(( $+commands[python3] )) || {
|
||||||
echo "[error] No python executable detected"
|
echo "[error] No python executable detected"
|
||||||
return
|
return
|
||||||
|
|
|
@ -57,7 +57,7 @@ def pretty_print(cheatsheet, wfilter, group_list=None, groups_only=False):
|
||||||
pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter)
|
pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description="Pretty print aliases.", prog="acs")
|
parser = argparse.ArgumentParser(description="Pretty print aliases.", prog="als")
|
||||||
parser.add_argument('filter', nargs="*", metavar="<keyword>", help="search aliases matching keywords")
|
parser.add_argument('filter', nargs="*", metavar="<keyword>", help="search aliases matching keywords")
|
||||||
parser.add_argument('-g', '--group', dest="group_list", action='append', help="only print aliases in given groups")
|
parser.add_argument('-g', '--group', dest="group_list", action='append', help="only print aliases in given groups")
|
||||||
parser.add_argument('--groups', dest='groups_only', action='store_true', help="only print alias groups")
|
parser.add_argument('--groups', dest='groups_only', action='store_true', help="only print alias groups")
|
||||||
|
|
|
@ -21,7 +21,6 @@ plugins=(... ansible)
|
||||||
| `acon` | command `ansible-console` |
|
| `acon` | command `ansible-console` |
|
||||||
| `ainv` | command `ansible-inventory` |
|
| `ainv` | command `ansible-inventory` |
|
||||||
| `aplaybook` | command `ansible-playbook` |
|
| `aplaybook` | command `ansible-playbook` |
|
||||||
| `ainv` | command `ansible-inventory` |
|
|
||||||
| `adoc` | command `ansible-doc` |
|
| `adoc` | command `ansible-doc` |
|
||||||
| `agal` | command `ansible-galaxy` |
|
| `agal` | command `ansible-galaxy` |
|
||||||
| `apull` | command `ansible-pull` |
|
| `apull` | command `ansible-pull` |
|
||||||
|
@ -29,6 +28,6 @@ plugins=(... ansible)
|
||||||
|
|
||||||
## Maintainer
|
## Maintainer
|
||||||
|
|
||||||
### [Deepankumar](https://github.com/deepan10)
|
### [Deepankumar](https://github.com/deepan10)
|
||||||
|
|
||||||
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
|
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
|
||||||
|
|
|
@ -179,8 +179,8 @@ fi
|
||||||
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
||||||
function upgrade() {
|
function upgrade() {
|
||||||
echo ":: Checking Arch Linux PGP Keyring..."
|
echo ":: Checking Arch Linux PGP Keyring..."
|
||||||
local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||||
local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||||
if [ $installedver != $currentver ]; then
|
if [ $installedver != $currentver ]; then
|
||||||
echo " Arch Linux PGP Keyring is out of date."
|
echo " Arch Linux PGP Keyring is out of date."
|
||||||
echo " Updating before full system upgrade."
|
echo " Updating before full system upgrade."
|
||||||
|
|
|
@ -2,26 +2,29 @@
|
||||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||||
|
|
||||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
||||||
ASDF_DIR="/opt/asdf-vm"
|
if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
||||||
ASDF_COMPLETIONS="$ASDF_DIR"
|
ASDF_DIR="/opt/asdf-vm"
|
||||||
fi
|
ASDF_COMPLETIONS="$ASDF_DIR"
|
||||||
|
# If not found, check for Homebrew package
|
||||||
# If not found, check for Homebrew package
|
elif (( $+commands[brew] )); then
|
||||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
|
_ASDF_PREFIX="$(brew --prefix asdf)"
|
||||||
brew_prefix="$(brew --prefix asdf)"
|
ASDF_DIR="${_ASDF_PREFIX}/libexec"
|
||||||
ASDF_DIR="${brew_prefix}/libexec"
|
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
||||||
ASDF_COMPLETIONS="${brew_prefix}/etc/bash_completion.d"
|
unset _ASDF_PREFIX
|
||||||
unset brew_prefix
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load command
|
# Load command
|
||||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||||
. "$ASDF_DIR/asdf.sh"
|
source "$ASDF_DIR/asdf.sh"
|
||||||
|
|
||||||
# Load completions
|
# Load completions
|
||||||
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
|
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||||
. "$ASDF_COMPLETIONS/asdf.bash"
|
fpath+=("$ASDF_COMPLETIONS")
|
||||||
|
autoload -Uz _asdf
|
||||||
|
compdef _asdf asdf # compdef is already loaded before loading plugins
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
declare -a autojump_paths
|
declare -a autojump_paths
|
||||||
autojump_paths=(
|
autojump_paths=(
|
||||||
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
||||||
$HOME/.autojump/share/autojump/autojump.zsh # manual installation
|
$HOME/.autojump/share/autojump/autojump.zsh # manual installation
|
||||||
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
|
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
|
||||||
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
||||||
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
/etc/profiles/per-user/$USER/share/autojump/autojump.zsh # Home Manager, NixOS with user-scoped packages
|
||||||
/etc/profile.d/autojump.zsh # manual installation
|
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
||||||
/etc/profile.d/autojump.sh # Gentoo installation
|
/etc/profile.d/autojump.zsh # manual installation
|
||||||
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
/etc/profile.d/autojump.sh # Gentoo installation
|
||||||
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
|
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
||||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
|
||||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||||
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||||
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
||||||
|
/opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
|
||||||
|
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
||||||
|
/nix/var/nix/gcroots/current-system/sw/share/zsh/site-functions/autojump.zsh # macOS Nix, nix-darwin
|
||||||
)
|
)
|
||||||
|
|
||||||
for file in $autojump_paths; do
|
for file in $autojump_paths; do
|
||||||
|
|
|
@ -16,6 +16,8 @@ plugins=(... aws)
|
||||||
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
|
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
|
||||||
Run `asp` without arguments to clear the profile.
|
Run `asp` without arguments to clear the profile.
|
||||||
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
|
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
|
||||||
|
* `asp [<profile>] login [<sso_session>]`: In addition to `asp [<profile>] login`, if SSO session has been configured in your aws profile, it will run the `aws sso login --sso-session <sso_session>` command following profile selection.
|
||||||
|
* `asp [<profile>] logout`: If AWS SSO has been configured in your aws profile, it will run the `aws sso logout` command following profile selection.
|
||||||
|
|
||||||
* `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`.
|
* `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`.
|
||||||
Run `asr` without arguments to clear the profile.
|
Run `asr` without arguments to clear the profile.
|
||||||
|
@ -45,6 +47,11 @@ plugins=(... aws)
|
||||||
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
|
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
|
||||||
see the AWS profile/region prompt.
|
see the AWS profile/region prompt.
|
||||||
|
|
||||||
|
* Set `AWS_PROFILE_STATE_ENABLED=true` in your zshrc file if you want the aws profile to persist between shell sessions.
|
||||||
|
This option might slow down your shell startup time.
|
||||||
|
By default the state file path is `/tmp/.aws_current_profile`. This means that the state won't survive a reboot or otherwise GC.
|
||||||
|
You can control the state file path using the `AWS_STATE_FILE` environment variable.
|
||||||
|
|
||||||
## Theme
|
## Theme
|
||||||
|
|
||||||
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
||||||
|
|
|
@ -6,10 +6,26 @@ function agr() {
|
||||||
echo $AWS_REGION
|
echo $AWS_REGION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Update state file if enabled
|
||||||
|
function _aws_update_state() {
|
||||||
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
|
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
||||||
|
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function _aws_clear_state() {
|
||||||
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
|
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
||||||
|
echo -n > "${AWS_STATE_FILE}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# AWS profile selection
|
# AWS profile selection
|
||||||
function asp() {
|
function asp() {
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
|
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
|
||||||
|
_aws_clear_state
|
||||||
echo AWS profile cleared.
|
echo AWS profile cleared.
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -28,8 +44,16 @@ function asp() {
|
||||||
|
|
||||||
export AWS_PROFILE_REGION=$(aws configure get region)
|
export AWS_PROFILE_REGION=$(aws configure get region)
|
||||||
|
|
||||||
|
_aws_update_state
|
||||||
|
|
||||||
if [[ "$2" == "login" ]]; then
|
if [[ "$2" == "login" ]]; then
|
||||||
aws sso login
|
if [[ -n "$3" ]]; then
|
||||||
|
aws sso login --sso-session $3
|
||||||
|
else
|
||||||
|
aws sso login
|
||||||
|
fi
|
||||||
|
elif [[ "$2" == "logout" ]]; then
|
||||||
|
aws sso logout
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +61,7 @@ function asp() {
|
||||||
function asr() {
|
function asr() {
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
unset AWS_DEFAULT_REGION AWS_REGION
|
unset AWS_DEFAULT_REGION AWS_REGION
|
||||||
|
_aws_update_state
|
||||||
echo AWS region cleared.
|
echo AWS region cleared.
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -50,6 +75,7 @@ function asr() {
|
||||||
|
|
||||||
export AWS_REGION=$1
|
export AWS_REGION=$1
|
||||||
export AWS_DEFAULT_REGION=$1
|
export AWS_DEFAULT_REGION=$1
|
||||||
|
_aws_update_state
|
||||||
}
|
}
|
||||||
|
|
||||||
# AWS profile switch
|
# AWS profile switch
|
||||||
|
@ -196,8 +222,17 @@ function aws_change_access_key() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function aws_regions() {
|
function aws_regions() {
|
||||||
|
local region
|
||||||
|
if [[ $AWS_DEFAULT_REGION ]];then
|
||||||
|
region="$AWS_DEFAULT_REGION"
|
||||||
|
elif [[ $AWS_REGION ]];then
|
||||||
|
region="$AWS_REGION"
|
||||||
|
else
|
||||||
|
region="us-west-1"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
|
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
|
||||||
aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
aws ec2 describe-regions --region $region |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
||||||
else
|
else
|
||||||
echo "You must specify a AWS profile."
|
echo "You must specify a AWS profile."
|
||||||
fi
|
fi
|
||||||
|
@ -240,6 +275,22 @@ if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; th
|
||||||
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
|
AWS_STATE_FILE="${AWS_STATE_FILE:-/tmp/.aws_current_profile}"
|
||||||
|
test -s "${AWS_STATE_FILE}" || return
|
||||||
|
|
||||||
|
aws_state=($(cat $AWS_STATE_FILE))
|
||||||
|
|
||||||
|
export AWS_DEFAULT_PROFILE="${aws_state[1]}"
|
||||||
|
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||||
|
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||||
|
|
||||||
|
test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
|
||||||
|
|
||||||
|
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
|
||||||
|
export AWS_DEFAULT_REGION="$AWS_REGION"
|
||||||
|
fi
|
||||||
|
|
||||||
# Load awscli completions
|
# Load awscli completions
|
||||||
|
|
||||||
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
|
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
# Author: Avneet Singh (kalsi-avneet) #
|
# Author: Avneet Singh (kalsi-avneet) #
|
||||||
# Modified to add support for Android #
|
# Modified to add support for Android #
|
||||||
###########################################
|
###########################################
|
||||||
|
# Author: Not Pua (im-notpua) #
|
||||||
|
# Modified to add support for OpenBSD #
|
||||||
|
###########################################
|
||||||
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" = darwin* ]]; then
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
function battery_is_charging() {
|
function battery_is_charging() {
|
||||||
|
@ -139,6 +143,46 @@ elif [[ "$OSTYPE" = linux-android ]] && (( ${+commands[termux-battery-status]} )
|
||||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
elif [[ "$OSTYPE" = openbsd* ]]; then
|
||||||
|
function battery_is_charging() {
|
||||||
|
[[ $(apm -b) -eq 3 ]]
|
||||||
|
}
|
||||||
|
function battery_pct() {
|
||||||
|
apm -l
|
||||||
|
}
|
||||||
|
function battery_pct_remaining() {
|
||||||
|
if ! battery_is_charging; then
|
||||||
|
battery_pct
|
||||||
|
else
|
||||||
|
echo "External Power"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function battery_time_remaining() {
|
||||||
|
local remaining_time
|
||||||
|
remaining_time=$(apm -m)
|
||||||
|
if [[ $remaining_time -ge 0 ]]; then
|
||||||
|
((hour = $remaining_time / 60 ))
|
||||||
|
((minute = $remaining_time % 60 ))
|
||||||
|
printf %02d:%02d $hour $minute
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function battery_pct_prompt() {
|
||||||
|
local battery_pct color
|
||||||
|
battery_pct=$(battery_pct_remaining)
|
||||||
|
if battery_is_charging; then
|
||||||
|
echo "∞"
|
||||||
|
else
|
||||||
|
if [[ $battery_pct -gt 50 ]]; then
|
||||||
|
color='green'
|
||||||
|
elif [[ $battery_pct -gt 20 ]]; then
|
||||||
|
color='yellow'
|
||||||
|
else
|
||||||
|
color='red'
|
||||||
|
fi
|
||||||
|
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
elif [[ "$OSTYPE" = linux* ]]; then
|
elif [[ "$OSTYPE" = linux* ]]; then
|
||||||
function battery_is_charging() {
|
function battery_is_charging() {
|
||||||
if (( $+commands[acpitool] )); then
|
if (( $+commands[acpitool] )); then
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Bazel plugin
|
# Bazel plugin
|
||||||
|
|
||||||
This plugin adds completion for [bazel](https://bazel.build), an open-source build and
|
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool that scalably supports multi-language and multi-platform projects.
|
||||||
test tool that scalably supports multi-language and multi-platform projects.
|
|
||||||
|
|
||||||
To use it, add `bazel` to the plugins array in your zshrc file:
|
To use it, add `bazel` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
@ -12,3 +11,12 @@ plugins=(... bazel)
|
||||||
The plugin has a copy of [the completion script from the git repository][1].
|
The plugin has a copy of [the completion script from the git repository][1].
|
||||||
|
|
||||||
[1]: https://github.com/bazelbuild/bazel/blob/master/scripts/zsh_completion/_bazel
|
[1]: https://github.com/bazelbuild/bazel/blob/master/scripts/zsh_completion/_bazel
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
| ------- | -------------------------------------- | ------------------------------------------------------ |
|
||||||
|
| bzb | `bazel build` | The `bazel build` command |
|
||||||
|
| bzt | `bazel test` | The `bazel test` command |
|
||||||
|
| bzr | `bazel run` | The `bazel run` command |
|
||||||
|
| bzq | `bazel query` | The `bazel query` command |
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#compdef bazel
|
#compdef bazel bazelisk
|
||||||
|
|
||||||
# Copyright 2015 The Bazel Authors. All rights reserved.
|
# Copyright 2015 The Bazel Authors. All rights reserved.
|
||||||
#
|
#
|
||||||
|
|
5
plugins/bazel/bazel.plugin.zsh
Normal file
5
plugins/bazel/bazel.plugin.zsh
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Aliases for bazel
|
||||||
|
alias bzb='bazel build'
|
||||||
|
alias bzt='bazel test'
|
||||||
|
alias bzr='bazel run'
|
||||||
|
alias bzq='bazel query'
|
|
@ -1,19 +1,19 @@
|
||||||
# bgnotify zsh plugin
|
# bgnotify zsh plugin
|
||||||
|
|
||||||
cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux.
|
cross-platform background notifications for long running commands! Supports OSX and Linux.
|
||||||
|
|
||||||
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
|
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
|
||||||
|
|
||||||
----------------------------------
|
---
|
||||||
|
|
||||||
## How to use!
|
## How to use
|
||||||
|
|
||||||
Just add bgnotify to your plugins list in your `.zshrc`
|
Just add bgnotify to your plugins list in your `.zshrc`
|
||||||
|
|
||||||
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
|
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
|
||||||
* `brew install terminal-notifier` (or `gem install terminal-notifier`)
|
* `brew install terminal-notifier` (or `gem install terminal-notifier`)
|
||||||
- On ubuntu you're already all set!
|
- On Linux, make sure you have `notify-send` or `kdialog` installed. If you're using Ubuntu you should already be all set!
|
||||||
- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
- On Windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||||
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
@ -35,20 +35,29 @@ Just add bgnotify to your plugins list in your `.zshrc`
|
||||||
|
|
||||||
One can configure a few things:
|
One can configure a few things:
|
||||||
|
|
||||||
|
- `bgnotify_bell` enabled or disables the terminal bell (default true)
|
||||||
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
||||||
- `function bgnotify_formatted` lets you change the notification
|
- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
|
||||||
|
|
||||||
Use these by adding a function definition before the your call to source. Example:
|
Use these by adding a function definition before the your call to source. Example:
|
||||||
|
|
||||||
~~~ sh
|
```sh
|
||||||
|
bgnotify_bell=false ## disable terminal bell
|
||||||
bgnotify_threshold=4 ## set your own notification threshold
|
bgnotify_threshold=4 ## set your own notification threshold
|
||||||
|
|
||||||
function bgnotify_formatted {
|
function bgnotify_formatted {
|
||||||
## $1=exit_status, $2=command, $3=elapsed_time
|
## $1=exit_status, $2=command, $3=elapsed_time
|
||||||
[ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!"
|
|
||||||
bgnotify "$title -- after $3 s" "$2";
|
# Humanly readable elapsed time
|
||||||
|
local elapsed="$(( $3 % 60 ))s"
|
||||||
|
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||||
|
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||||
|
|
||||||
|
[ $1 -eq 0 ] && title="Holy Smokes Batman" || title="Holy Graf Zeppelin"
|
||||||
|
[ $1 -eq 0 ] && icon="$HOME/icons/success.png" || icon="$HOME/icons/fail.png"
|
||||||
|
bgnotify "$title - took ${elapsed}" "$2" "$icon"
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins=(git bgnotify) ## add to plugins list
|
plugins=(git bgnotify) ## add to plugins list
|
||||||
source $ZSH/oh-my-zsh.sh ## existing source call
|
source $ZSH/oh-my-zsh.sh ## existing source call
|
||||||
~~~
|
```
|
||||||
|
|
|
@ -21,13 +21,12 @@ function bgnotify_end {
|
||||||
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
||||||
|
|
||||||
# check time elapsed
|
# check time elapsed
|
||||||
[[ $bgnotify_timestamp -gt 0 ]] || return
|
[[ $bgnotify_timestamp -gt 0 ]] || return 0
|
||||||
[[ $elapsed -ge $bgnotify_threshold ]] || return
|
[[ $elapsed -ge $bgnotify_threshold ]] || return 0
|
||||||
|
|
||||||
# check if Terminal app is not active
|
# check if Terminal app is not active
|
||||||
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
|
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return 0
|
||||||
|
|
||||||
printf '\a' # beep sound
|
|
||||||
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
|
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
|
||||||
} always {
|
} always {
|
||||||
bgnotify_timestamp=0
|
bgnotify_timestamp=0
|
||||||
|
@ -52,53 +51,89 @@ function bgnotify_formatted {
|
||||||
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||||
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||||
|
|
||||||
if [[ $1 -eq 0 ]]; then
|
[[ $bgnotify_bell = true ]] && printf '\a' # beep sound
|
||||||
bgnotify "#win (took $elapsed)" "$2"
|
if [[ $exit_status -eq 0 ]]; then
|
||||||
|
bgnotify "#win (took $elapsed)" "$cmd"
|
||||||
else
|
else
|
||||||
bgnotify "#fail (took $elapsed)" "$2"
|
bgnotify "#fail (took $elapsed)" "$cmd"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# for macOS, output is "app ID, window ID" (com.googlecode.iterm2, 116)
|
|
||||||
function bgnotify_appid {
|
function bgnotify_appid {
|
||||||
if (( ${+commands[osascript]} )); then
|
if (( ${+commands[osascript]} )); then
|
||||||
osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
|
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
|
||||||
elif (( ${+commands[xprop]} )); then
|
elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway
|
||||||
|
local app_id=$(bgnotify_find_sway_appid)
|
||||||
|
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
||||||
|
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
|
||||||
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
|
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
|
||||||
else
|
else
|
||||||
echo $EPOCHSECONDS
|
echo $EPOCHSECONDS
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function bgnotify {
|
|
||||||
# $1: title, $2: message
|
|
||||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
|
||||||
local term_id="${bgnotify_termid%%,*}" # remove window id
|
|
||||||
if [[ -z "$term_id" ]]; then
|
|
||||||
case "$TERM_PROGRAM" in
|
|
||||||
iTerm.app) term_id='com.googlecode.iterm2' ;;
|
|
||||||
Apple_Terminal) term_id='com.apple.terminal' ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$term_id" ]]; then
|
function bgnotify_find_sway_appid {
|
||||||
terminal-notifier -message "$2" -title "$1" &>/dev/null
|
# output is "app_id,container_id", for example "Alacritty,1694"
|
||||||
else
|
# see example swaymsg output: https://github.com/ohmyzsh/ohmyzsh/files/13463939/output.json
|
||||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null
|
if (( ${+commands[jq]} )); then
|
||||||
fi
|
swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(",")'
|
||||||
|
else
|
||||||
|
swaymsg -t get_tree | awk '
|
||||||
|
BEGIN { Id = ""; Appid = ""; FocusNesting = -1; Nesting = 0 }
|
||||||
|
{
|
||||||
|
# Enter a block
|
||||||
|
if ($0 ~ /.*{$/) Nesting++
|
||||||
|
|
||||||
|
# Exit a block. If Nesting is now less than FocusNesting, we have the data we are looking for
|
||||||
|
if ($0 ~ /^[[:blank:]]*}.*/) { Nesting--; if (FocusNesting > 0 && Nesting < FocusNesting) exit 0 }
|
||||||
|
|
||||||
|
# Save the Id, it is potentially what we are looking for
|
||||||
|
if ($0 ~ /^[[:blank:]]*"id": [0-9]*,?$/) { sub(/^[[:blank:]]*"id": /, ""); sub(/,$/, ""); Id = $0 }
|
||||||
|
|
||||||
|
# Save the Appid, it is potentially what we are looking for
|
||||||
|
if ($0 ~ /^[[:blank:]]*"app_id": ".*",?$/) { sub(/^[[:blank:]]*"app_id": "/, ""); sub(/",$/, ""); Appid = $0 }
|
||||||
|
|
||||||
|
# Window is focused, this nesting block contains the Id and Appid we want!
|
||||||
|
if ($0 ~ /^[[:blank:]]*"focused": true,?$/) { FocusNesting = Nesting }
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (Appid != "" && Id != "" && FocusNesting != -1) print Appid "," Id
|
||||||
|
else print ""
|
||||||
|
}'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function bgnotify_programid {
|
||||||
|
case "$TERM_PROGRAM" in
|
||||||
|
iTerm.app) echo 'com.googlecode.iterm2' ;;
|
||||||
|
Apple_Terminal) echo 'com.apple.terminal' ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function bgnotify {
|
||||||
|
local title="$1"
|
||||||
|
local message="$2"
|
||||||
|
local icon="$3"
|
||||||
|
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||||
|
local term_id=$(bgnotify_programid)
|
||||||
|
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null
|
||||||
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
||||||
growlnotify -m "$1" "$2"
|
growlnotify -m "$title" "$message"
|
||||||
elif (( ${+commands[notify-send]} )); then # GNOME
|
elif (( ${+commands[notify-send]} )); then
|
||||||
notify-send "$1" "$2"
|
notify-send "$title" "$message" ${=icon:+--icon "$icon"}
|
||||||
elif (( ${+commands[kdialog]} )); then # KDE
|
elif (( ${+commands[kdialog]} )); then # KDE
|
||||||
kdialog --title "$1" --passivepopup "$2" 5
|
kdialog --title "$title" --passivepopup "$message" 5
|
||||||
elif (( ${+commands[notifu]} )); then # cygwin
|
elif (( ${+commands[notifu]} )); then # cygwin
|
||||||
notifu /m "$2" /p "$1"
|
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## Defaults
|
## Defaults
|
||||||
|
|
||||||
|
# enable terminal bell on notify by default
|
||||||
|
bgnotify_bell=${bgnotify_bell:-true}
|
||||||
|
|
||||||
# notify if command took longer than 5s by default
|
# notify if command took longer than 5s by default
|
||||||
bgnotify_threshold=${bgnotify_threshold:-5}
|
bgnotify_threshold=${bgnotify_threshold:-5}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ index 2fd5f2cd..9d89a464 100644
|
||||||
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
||||||
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
|
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
|
||||||
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
|
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||||
```
|
```
|
||||||
|
|
|
@ -10,10 +10,12 @@ plugins=(... brew)
|
||||||
|
|
||||||
## Shellenv
|
## Shellenv
|
||||||
|
|
||||||
If `brew` is not found in the PATH, this plugin will attempt to find it in common
|
If `brew` is not found in the PATH, this plugin will attempt to find it in common locations, and execute
|
||||||
locations, and execute `brew shellenv` to set the environment appropriately.
|
`brew shellenv` to set the environment appropriately. This plugin will also export
|
||||||
This plugin will also export `HOMEBREW_PREFIX="$(brew --prefix)"` if not previously
|
`HOMEBREW_PREFIX="$(brew --prefix)"` if not previously defined for convenience.
|
||||||
defined for convenience.
|
|
||||||
|
In case you installed `brew` in a non-common location, you can still set `BREW_LOCATION` variable pointing to
|
||||||
|
the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environment.
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
|
@ -33,9 +35,9 @@ defined for convenience.
|
||||||
|
|
||||||
## Completion
|
## Completion
|
||||||
|
|
||||||
This plugin configures paths with Homebrew's completion functions automatically, so you don't need to do it manually. See: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh.
|
This plugin configures paths with Homebrew's completion functions automatically, so you don't need to do it
|
||||||
|
manually. See: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh.
|
||||||
|
|
||||||
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the
|
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the brew installation,
|
||||||
brew installation, so we no longer ship it with the brew plugin; now it only has brew
|
so we no longer ship it with the brew plugin; now it only has brew aliases. If you find that brew completion
|
||||||
aliases. If you find that brew completion no longer works, make sure you have your Homebrew
|
no longer works, make sure you have your Homebrew installation fully up to date.
|
||||||
installation fully up to date.
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
if (( ! $+commands[brew] )); then
|
if (( ! $+commands[brew] )); then
|
||||||
if [[ -x /opt/homebrew/bin/brew ]]; then
|
if [[ -n "$BREW_LOCATION" ]]; then
|
||||||
|
if [[ ! -x "$BREW_LOCATION" ]]; then
|
||||||
|
echo "[oh-my-zsh] $BREW_LOCATION is not executable"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
elif [[ -x /opt/homebrew/bin/brew ]]; then
|
||||||
BREW_LOCATION="/opt/homebrew/bin/brew"
|
BREW_LOCATION="/opt/homebrew/bin/brew"
|
||||||
elif [[ -x /usr/local/bin/brew ]]; then
|
elif [[ -x /usr/local/bin/brew ]]; then
|
||||||
BREW_LOCATION="/usr/local/bin/brew"
|
BREW_LOCATION="/usr/local/bin/brew"
|
||||||
|
@ -31,7 +36,6 @@ fi
|
||||||
|
|
||||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||||
alias bcubo='brew update && brew outdated --cask'
|
alias bcubo='brew update && brew outdated --cask'
|
||||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
|
||||||
alias brewp='brew pin'
|
alias brewp='brew pin'
|
||||||
alias brewsp='brew list --pinned'
|
alias brewsp='brew list --pinned'
|
||||||
alias bubc='brew upgrade && brew cleanup'
|
alias bubc='brew upgrade && brew cleanup'
|
||||||
|
|
20
plugins/bun/README.md
Normal file
20
plugins/bun/README.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Bun Plugin
|
||||||
|
|
||||||
|
This plugin sets up completion for [Bun](https://bun.sh).
|
||||||
|
|
||||||
|
To use it, add `bun` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... bun)
|
||||||
|
```
|
||||||
|
|
||||||
|
This plugin does not add any aliases.
|
||||||
|
|
||||||
|
## Cache
|
||||||
|
|
||||||
|
This plugin caches the completion script and is automatically updated when the
|
||||||
|
plugin is loaded, which is usually when you start up a new terminal emulator.
|
||||||
|
|
||||||
|
The cache is stored at:
|
||||||
|
|
||||||
|
- `$ZSH_CACHE_DIR/completions/_bun_` completions script
|
14
plugins/bun/bun.plugin.zsh
Normal file
14
plugins/bun/bun.plugin.zsh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# If Bun is not found, don't do the rest of the script
|
||||||
|
if (( ! $+commands[bun] )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
|
# bind it to `bun`. Otherwise, compinit will have already done that.
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_bun" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _bun
|
||||||
|
_comps[bun]=_bun
|
||||||
|
fi
|
||||||
|
|
||||||
|
bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|
|
|
@ -1,6 +1,6 @@
|
||||||
# catimg
|
# catimg
|
||||||
|
|
||||||
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
Plugin for displaying images on the terminal using the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
||||||
|
|
||||||
To use it, add `catimg` to the plugins array in your zshrc file:
|
To use it, add `catimg` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
_source-from-omz-settings() {
|
_source-from-omz-settings() {
|
||||||
local _chruby_path _chruby_auto
|
local _chruby_path _chruby_auto
|
||||||
|
|
||||||
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
|
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
|
||||||
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
|
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ _source-from-homebrew() {
|
||||||
if [[ -h /usr/local/opt/chruby ]];then
|
if [[ -h /usr/local/opt/chruby ]];then
|
||||||
_brew_prefix="/usr/local/opt/chruby"
|
_brew_prefix="/usr/local/opt/chruby"
|
||||||
else
|
else
|
||||||
# ok , it is not default prefix
|
# ok , it is not default prefix
|
||||||
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
||||||
_brew_prefix=$(brew --prefix chruby)
|
_brew_prefix=$(brew --prefix chruby)
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -50,7 +50,7 @@ Alternatively, seek out the [online documentation][3]. And don't forget, there a
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
Contributed to `oh_my_zsh` by [benwilcock][2].
|
Contributed to `oh_my_zsh` by [benwilcock][2].
|
||||||
|
|
||||||
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
|
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
|
||||||
[2]: https://github.com/benwilcock
|
[2]: https://github.com/benwilcock
|
||||||
|
|
|
@ -24,7 +24,7 @@ Also provides the following aliases:
|
||||||
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
|
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
|
||||||
to run the code in a JS console.
|
to run the code in a JS console.
|
||||||
|
|
||||||
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
||||||
to compile large/multi-line snippets
|
to compile large/multi-line snippets
|
||||||
|
|
||||||
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
|
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
|
||||||
|
|
|
@ -36,6 +36,7 @@ function colored() {
|
||||||
# Prefer `less` whenever available, since we specifically configured
|
# Prefer `less` whenever available, since we specifically configured
|
||||||
# environment for it.
|
# environment for it.
|
||||||
environment+=( PAGER="${commands[less]:-$PAGER}" )
|
environment+=( PAGER="${commands[less]:-$PAGER}" )
|
||||||
|
environment+=( GROFF_NO_SGR=1 )
|
||||||
|
|
||||||
# See ./nroff script.
|
# See ./nroff script.
|
||||||
if [[ "$OSTYPE" = solaris* ]]; then
|
if [[ "$OSTYPE" = solaris* ]]; then
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
for file (
|
for file (
|
||||||
# Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found
|
# Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found
|
||||||
/usr/share/doc/pkgfile/command-not-found.zsh
|
/usr/share/doc/pkgfile/command-not-found.zsh
|
||||||
# macOS (M1 and classic Homebrew): https://github.com/Homebrew/homebrew-command-not-found
|
# Homebrew: https://github.com/Homebrew/homebrew-command-not-found
|
||||||
/opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
/opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||||
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||||
|
/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||||
); do
|
); do
|
||||||
if [[ -r "$file" ]]; then
|
if [[ -r "$file" ]]; then
|
||||||
source "$file"
|
source "$file"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
if (( ${+commands[compleat]} )); then
|
if (( ${+commands[compleat]} )); then
|
||||||
local prefix="${commands[compleat]:h:h}"
|
local prefix="${commands[compleat]:h:h}"
|
||||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||||
|
|
||||||
if [[ -f "$setup" ]]; then
|
if [[ -f "$setup" ]]; then
|
||||||
if ! bashcompinit >/dev/null 2>&1; then
|
if ! bashcompinit >/dev/null 2>&1; then
|
||||||
|
@ -15,6 +15,6 @@ if (( ${+commands[compleat]} )); then
|
||||||
bashcompinit -i
|
bashcompinit -i
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "$setup"
|
source "$setup"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# copy the active line from the command line buffer
|
# copy the active line from the command line buffer
|
||||||
# onto the system clipboard
|
# onto the system clipboard
|
||||||
|
|
||||||
copybuffer () {
|
copybuffer () {
|
||||||
if which clipcopy &>/dev/null; then
|
if builtin which clipcopy &>/dev/null; then
|
||||||
printf "%s" "$BUFFER" | clipcopy
|
printf "%s" "$BUFFER" | clipcopy
|
||||||
else
|
else
|
||||||
zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly."
|
zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly."
|
||||||
|
|
|
@ -19,7 +19,7 @@ dash
|
||||||
|
|
||||||
- Query for something in dash app: `dash query`
|
- Query for something in dash app: `dash query`
|
||||||
```
|
```
|
||||||
dash golang
|
dash golang
|
||||||
```
|
```
|
||||||
|
|
||||||
- You can optionally provide a keyword: `dash [keyword:]query`
|
- You can optionally provide a keyword: `dash [keyword:]query`
|
||||||
|
|
|
@ -13,7 +13,12 @@ plugins=(... debian)
|
||||||
- `$apt_pref`: use aptitude or apt if installed, fallback is apt-get.
|
- `$apt_pref`: use aptitude or apt if installed, fallback is apt-get.
|
||||||
- `$apt_upgr`: use upgrade or safe-upgrade (for aptitude).
|
- `$apt_upgr`: use upgrade or safe-upgrade (for aptitude).
|
||||||
|
|
||||||
Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior.
|
Set **both** `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior, e.g.:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
apt_pref='apt'
|
||||||
|
apt_upgr='full-upgrade'
|
||||||
|
```
|
||||||
|
|
||||||
## Common Aliases
|
## Common Aliases
|
||||||
|
|
||||||
|
@ -21,7 +26,7 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
|
||||||
| ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- |
|
| ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- |
|
||||||
| `age` | `apt-get` | Command line tool for handling packages |
|
| `age` | `apt-get` | Command line tool for handling packages |
|
||||||
| `api` | `aptitude` | Same functionality as `apt-get`, provides extra options |
|
| `api` | `aptitude` | Same functionality as `apt-get`, provides extra options |
|
||||||
| `acse` | `apt-cache search` | Command line tool for searching apt software package cache |
|
| `acs` | `apt-cache search` | Command line tool for searching apt software package cache |
|
||||||
| `aps` | `aptitude search` | Searches installed packages using aptitude |
|
| `aps` | `aptitude search` | Searches installed packages using aptitude |
|
||||||
| `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format |
|
| `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format |
|
||||||
| `afs` | `apt-file search --regexp` | Search file in packages |
|
| `afs` | `apt-file search --regexp` | Search file in packages |
|
||||||
|
|
|
@ -26,7 +26,7 @@ alias age='apt-get'
|
||||||
alias api='aptitude'
|
alias api='aptitude'
|
||||||
|
|
||||||
# Some self-explanatory aliases
|
# Some self-explanatory aliases
|
||||||
alias acse="apt-cache search"
|
alias acs="apt-cache search"
|
||||||
alias aps='aptitude search'
|
alias aps='aptitude search'
|
||||||
alias as="aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search"
|
alias as="aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search"
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@ _direnv_hook() {
|
||||||
trap - SIGINT;
|
trap - SIGINT;
|
||||||
}
|
}
|
||||||
typeset -ag precmd_functions;
|
typeset -ag precmd_functions;
|
||||||
if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
|
if [[ -z "${precmd_functions[(r)_direnv_hook]+1}" ]]; then
|
||||||
precmd_functions=( _direnv_hook ${precmd_functions[@]} )
|
precmd_functions=( _direnv_hook ${precmd_functions[@]} )
|
||||||
fi
|
fi
|
||||||
typeset -ag chpwd_functions;
|
typeset -ag chpwd_functions;
|
||||||
if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then
|
if [[ -z "${chpwd_functions[(r)_direnv_hook]+1}" ]]; then
|
||||||
chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
|
chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -10,6 +10,9 @@ To use it, add `dnf` to the plugins array in your zshrc file:
|
||||||
plugins=(... dnf)
|
plugins=(... dnf)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Classic `dnf` is getting superseded by `dnf5`; this plugin detects the presence
|
||||||
|
of `dnf5` and uses it as drop-in alternative to the slower `dnf`.
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
## Aliases
|
## Aliases
|
||||||
|
local dnfprog="dnf"
|
||||||
|
|
||||||
alias dnfl="dnf list" # List packages
|
# Prefer dnf5 if installed
|
||||||
alias dnfli="dnf list installed" # List installed packages
|
command -v dnf5 > /dev/null && dnfprog=dnf5
|
||||||
alias dnfgl="dnf grouplist" # List package groups
|
|
||||||
alias dnfmc="dnf makecache" # Generate metadata cache
|
|
||||||
alias dnfp="dnf info" # Show package information
|
|
||||||
alias dnfs="dnf search" # Search package
|
|
||||||
|
|
||||||
alias dnfu="sudo dnf upgrade" # Upgrade package
|
alias dnfl="${dnfprog} list" # List packages
|
||||||
alias dnfi="sudo dnf install" # Install package
|
alias dnfli="${dnfprog} list installed" # List installed packages
|
||||||
alias dnfgi="sudo dnf groupinstall" # Install package group
|
alias dnfgl="${dnfprog} grouplist" # List package groups
|
||||||
alias dnfr="sudo dnf remove" # Remove package
|
alias dnfmc="${dnfprog} makecache" # Generate metadata cache
|
||||||
alias dnfgr="sudo dnf groupremove" # Remove package group
|
alias dnfp="${dnfprog} info" # Show package information
|
||||||
alias dnfc="sudo dnf clean all" # Clean cache
|
alias dnfs="${dnfprog} search" # Search package
|
||||||
|
|
||||||
|
alias dnfu="sudo ${dnfprog} upgrade" # Upgrade package
|
||||||
|
alias dnfi="sudo ${dnfprog} install" # Install package
|
||||||
|
alias dnfgi="sudo ${dnfprog} groupinstall" # Install package group
|
||||||
|
alias dnfr="sudo ${dnfprog} remove" # Remove package
|
||||||
|
alias dnfgr="sudo ${dnfprog} groupremove" # Remove package group
|
||||||
|
alias dnfc="sudo ${dnfprog} clean all" # Clean cache
|
||||||
|
|
|
@ -11,23 +11,24 @@ plugins=(... docker-compose)
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|-----------|--------------------------------|----------------------------------------------------------------------------------|
|
|-----------|----------------------------------|----------------------------------------------------------------------------------|
|
||||||
| dco | `docker-compose` | Docker-compose main command |
|
| dco | `docker-compose` | Docker-compose main command |
|
||||||
| dcb | `docker-compose build` | Build containers |
|
| dcb | `docker-compose build` | Build containers |
|
||||||
| dce | `docker-compose exec` | Execute command inside a container |
|
| dce | `docker-compose exec` | Execute command inside a container |
|
||||||
| dcps | `docker-compose ps` | List containers |
|
| dcps | `docker-compose ps` | List containers |
|
||||||
| dcrestart | `docker-compose restart` | Restart container |
|
| dcrestart | `docker-compose restart` | Restart container |
|
||||||
| dcrm | `docker-compose rm` | Remove container |
|
| dcrm | `docker-compose rm` | Remove container |
|
||||||
| dcr | `docker-compose run` | Run a command in container |
|
| dcr | `docker-compose run` | Run a command in container |
|
||||||
| dcstop | `docker-compose stop` | Stop a container |
|
| dcstop | `docker-compose stop` | Stop a container |
|
||||||
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
||||||
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
|
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
|
||||||
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
||||||
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
|
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
|
||||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||||
| dcl | `docker-compose logs` | Show logs of container |
|
| dcl | `docker-compose logs` | Show logs of container |
|
||||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
|
||||||
| dcstart | `docker-compose start` | Start a container |
|
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||||
| dck | `docker-compose kill` | Kills containers |
|
| dcstart | `docker-compose start` | Start a container |
|
||||||
|
| dck | `docker-compose kill` | Kills containers |
|
||||||
|
|
|
@ -128,7 +128,7 @@ __docker-compose_subcommand() {
|
||||||
'--resolve-image-digests[Pin image tags to digests.]' \
|
'--resolve-image-digests[Pin image tags to digests.]' \
|
||||||
'--services[Print the service names, one per line.]' \
|
'--services[Print the service names, one per line.]' \
|
||||||
'--volumes[Print the volume names, one per line.]' \
|
'--volumes[Print the volume names, one per line.]' \
|
||||||
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
|
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' && ret=0
|
||||||
;;
|
;;
|
||||||
(create)
|
(create)
|
||||||
_arguments \
|
_arguments \
|
||||||
|
|
|
@ -16,6 +16,7 @@ alias dcupdb="$dccmd up -d --build"
|
||||||
alias dcdn="$dccmd down"
|
alias dcdn="$dccmd down"
|
||||||
alias dcl="$dccmd logs"
|
alias dcl="$dccmd logs"
|
||||||
alias dclf="$dccmd logs -f"
|
alias dclf="$dccmd logs -f"
|
||||||
|
alias dclF="$dccmd logs -f --tail 0"
|
||||||
alias dcpull="$dccmd pull"
|
alias dcpull="$dccmd pull"
|
||||||
alias dcstart="$dccmd start"
|
alias dcstart="$dccmd start"
|
||||||
alias dck="$dccmd kill"
|
alias dck="$dccmd kill"
|
||||||
|
|
|
@ -30,6 +30,15 @@ file**, but be aware of the side effects:
|
||||||
> zstyle ':completion:*:*:docker-*:*' option-stacking yes
|
> zstyle ':completion:*:*:docker-*:*' option-stacking yes
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
### Use old-style completion
|
||||||
|
|
||||||
|
If the current completion does not work well for you, you can enable legacy completion instead with the
|
||||||
|
following setting. See https://github.com/ohmyzsh/ohmyzsh/issues/11789 for more information.
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:docker' legacy-completion yes
|
||||||
|
```
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|
@ -58,7 +67,7 @@ file**, but be aware of the side effects:
|
||||||
| drm | `docker container rm` | Remove the specified container(s) |
|
| drm | `docker container rm` | Remove the specified container(s) |
|
||||||
| drm! | `docker container rm -f` | Force the removal of a running container (uses SIGKILL) |
|
| drm! | `docker container rm -f` | Force the removal of a running container (uses SIGKILL) |
|
||||||
| dst | `docker container start` | Start one or more stopped containers |
|
| dst | `docker container start` | Start one or more stopped containers |
|
||||||
| drs | `docker container restart` | Restart one or more containers
|
| drs | `docker container restart` | Restart one or more containers |
|
||||||
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
|
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
|
||||||
| dstp | `docker container stop` | Stop one or more running containers |
|
| dstp | `docker container stop` | Stop one or more running containers |
|
||||||
| dtop | `docker top` | Display the running processes of a container |
|
| dtop | `docker top` | Display the running processes of a container |
|
||||||
|
|
3126
plugins/docker/completions/_docker
Normal file
3126
plugins/docker/completions/_docker
Normal file
File diff suppressed because it is too large
Load diff
|
@ -36,17 +36,27 @@ if (( ! $+commands[docker] )); then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Standarized $0 handling
|
||||||
|
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||||
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||||
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||||
|
|
||||||
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
|
# bind it to `docker`. Otherwise, compinit will have already done that.
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _docker
|
||||||
|
_comps[docker]=_docker
|
||||||
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
# `docker completion` is only available from 23.0.0 on
|
# `docker completion` is only available from 23.0.0 on
|
||||||
local _docker_version=$(command docker version --format '{{.Client.Version}}' 2>/dev/null)
|
# docker version returns `Docker version 24.0.2, build cb74dfcd85`
|
||||||
if is-at-least 23.0.0 $_docker_version; then
|
# with `s:,:` remove the comma after the version, and select third word of it
|
||||||
# If the completion file doesn't exist yet, we need to autoload it and
|
if zstyle -t ':omz:plugins:docker' legacy-completion || \
|
||||||
# bind it to `docker`. Otherwise, compinit will have already done that.
|
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
|
||||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
||||||
typeset -g -A _comps
|
else
|
||||||
autoload -Uz _docker
|
command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
|
||||||
_comps[docker]=_docker
|
|
||||||
fi
|
|
||||||
command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
|
|
||||||
fi
|
fi
|
||||||
} &|
|
} &|
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
# This scripts is copied from (MIT License):
|
# This scripts is copied from (MIT License):
|
||||||
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
|
# https://raw.githubusercontent.com/dotnet/sdk/main/scripts/register-completions.zsh
|
||||||
|
|
||||||
_dotnet_zsh_complete()
|
#compdef dotnet
|
||||||
{
|
_dotnet_completion() {
|
||||||
local completions=("$(dotnet complete "$words")")
|
local -a completions=("${(@f)$(dotnet complete "${words}")}")
|
||||||
|
compadd -a completions
|
||||||
# If the completion list is empty, just continue with filename selection
|
_files
|
||||||
if [ -z "$completions" ]
|
|
||||||
then
|
|
||||||
_arguments '*::arguments: _normal'
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This is not a variable assignment, don't remove spaces!
|
|
||||||
_values = "${(ps:\n:)completions}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compdef _dotnet_zsh_complete dotnet
|
compdef _dotnet_completion dotnet
|
||||||
|
|
||||||
# Aliases bellow are here for backwards compatibility
|
# Aliases bellow are here for backwards compatibility
|
||||||
# added by Shaun Tabone (https://github.com/xontab)
|
# added by Shaun Tabone (https://github.com/xontab)
|
||||||
|
|
||||||
alias dn='dotnet new'
|
alias dn='dotnet new'
|
||||||
alias dr='dotnet run'
|
alias dr='dotnet run'
|
||||||
|
|
|
@ -27,4 +27,4 @@ The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that
|
||||||
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
|
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
|
||||||
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
|
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
|
||||||
| efile | - | Print the path to the file open in the current buffer |
|
| efile | - | Print the path to the file open in the current buffer |
|
||||||
| ecd | - | Print the directory of the file open in the the current buffer |
|
| ecd | - | Print the directory of the file open in the current buffer |
|
||||||
|
|
|
@ -60,7 +60,7 @@ function efile {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write to standard output the directory of the file
|
# Write to standard output the directory of the file
|
||||||
# opened in the the current buffer
|
# opened in the current buffer
|
||||||
function ecd {
|
function ecd {
|
||||||
local file
|
local file
|
||||||
file="$(efile)" || return $?
|
file="$(efile)" || return $?
|
||||||
|
|
|
@ -24,7 +24,7 @@ unset _omz_emoji_plugin_dir
|
||||||
|
|
||||||
# This is a combining character that can be placed after any other character to surround
|
# This is a combining character that can be placed after any other character to surround
|
||||||
# it in a "keycap" symbol.
|
# it in a "keycap" symbol.
|
||||||
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
||||||
# It's unclear whether this should be in the $emoji array, because those characters are all ones
|
# It's unclear whether this should be in the $emoji array, because those characters are all ones
|
||||||
# which can be displayed on their own.
|
# which can be displayed on their own.
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ function random_emoji() {
|
||||||
[[ $list_size -eq 0 ]] && return 1
|
[[ $list_size -eq 0 ]] && return 1
|
||||||
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
||||||
local name=${names[$random_index]}
|
local name=${names[$random_index]}
|
||||||
if [[ "$group" == "flags" ]]; then
|
if [[ "$group" == "flags" ]]; then
|
||||||
echo ${emoji_flags[$name]}
|
echo ${emoji_flags[$name]}
|
||||||
else
|
else
|
||||||
echo ${emoji[$name]}
|
echo ${emoji[$name]}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -86,22 +86,22 @@ function display_emoji() {
|
||||||
# terminals treat these emoji chars as single-width.
|
# terminals treat these emoji chars as single-width.
|
||||||
local counter=1
|
local counter=1
|
||||||
for i in $names; do
|
for i in $names; do
|
||||||
if [[ "$group" == "flags" ]]; then
|
if [[ "$group" == "flags" ]]; then
|
||||||
printf '%s ' "$emoji_flags[$i]"
|
printf '%s ' "$emoji_flags[$i]"
|
||||||
else
|
else
|
||||||
printf '%s ' "$emoji[$i]"
|
printf '%s ' "$emoji[$i]"
|
||||||
fi
|
fi
|
||||||
# New line every 20 emoji, to avoid weirdnesses
|
# New line every 20 emoji, to avoid weirdnesses
|
||||||
if (($counter % 20 == 0)); then
|
if (($counter % 20 == 0)); then
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
let counter=$counter+1
|
let counter=$counter+1
|
||||||
done
|
done
|
||||||
print
|
print
|
||||||
for i in $names; do
|
for i in $names; do
|
||||||
if [[ "$group" == "flags" ]]; then
|
if [[ "$group" == "flags" ]]; then
|
||||||
echo "${emoji_flags[$i]} = $i"
|
echo "${emoji_flags[$i]} = $i"
|
||||||
else
|
else
|
||||||
echo "${emoji[$i]} = $i"
|
echo "${emoji[$i]} = $i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
||||||
# VERSION: 1.0.0
|
# VERSION: 1.0.0
|
||||||
# DEPENDS: emoji plugin
|
# DEPENDS: emoji plugin
|
||||||
#
|
#
|
||||||
# There are different sets of emoji characters available, to choose a different
|
# There are different sets of emoji characters available, to choose a different
|
||||||
# set export emotty_set to the name of the set you would like to use, e.g.:
|
# set export emotty_set to the name of the set you would like to use, e.g.:
|
||||||
# % export emotty_set=nature
|
# % export emotty_set=nature
|
||||||
|
|
|
@ -40,7 +40,7 @@ plugins=(... encode64)
|
||||||
|
|
||||||
### Encoding a file
|
### Encoding a file
|
||||||
|
|
||||||
Encode a file's contents to base64 and save output to text file.
|
Encode a file's contents to base64 and save output to text file.
|
||||||
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
|
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
|
||||||
|
|
||||||
- From parameter
|
- From parameter
|
||||||
|
|
|
@ -30,6 +30,11 @@ EOF
|
||||||
local file="$1" full_path="${1:A}"
|
local file="$1" full_path="${1:A}"
|
||||||
local extract_dir="${1:t:r}"
|
local extract_dir="${1:t:r}"
|
||||||
|
|
||||||
|
# Remove the .tar extension if the file name is .tar.*
|
||||||
|
if [[ $extract_dir =~ '\.tar$' ]]; then
|
||||||
|
extract_dir="${extract_dir:r}"
|
||||||
|
fi
|
||||||
|
|
||||||
# If there's a file or directory with the same name as the archive
|
# If there's a file or directory with the same name as the archive
|
||||||
# add a random string to the end of the extract directory
|
# add a random string to the end of the extract directory
|
||||||
if [[ -e "$extract_dir" ]]; then
|
if [[ -e "$extract_dir" ]]; then
|
||||||
|
@ -64,8 +69,8 @@ EOF
|
||||||
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
|
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
|
||||||
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
|
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
|
||||||
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
|
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
|
||||||
(*.gz) (( $+commands[pigz] )) && pigz -dk "$full_path" || gunzip -k "$full_path" ;;
|
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
|
||||||
(*.bz2) bunzip2 "$full_path" ;;
|
(*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
|
||||||
(*.xz) unxz "$full_path" ;;
|
(*.xz) unxz "$full_path" ;;
|
||||||
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
|
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
|
||||||
(*.lz4) lz4 -d "$full_path" ;;
|
(*.lz4) lz4 -d "$full_path" ;;
|
||||||
|
@ -82,7 +87,7 @@ EOF
|
||||||
builtin cd -q control; extract ../control.tar.*
|
builtin cd -q control; extract ../control.tar.*
|
||||||
builtin cd -q ../data; extract ../data.tar.*
|
builtin cd -q ../data; extract ../data.tar.*
|
||||||
builtin cd -q ..; command rm *.tar.* debian-binary ;;
|
builtin cd -q ..; command rm *.tar.* debian-binary ;;
|
||||||
(*.zst) unzstd "$full_path" ;;
|
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
|
||||||
(*.cab|*.exe) cabextract "$full_path" ;;
|
(*.cab|*.exe) cabextract "$full_path" ;;
|
||||||
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
|
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
|
||||||
(*.zpaq) zpaq x "$full_path" ;;
|
(*.zpaq) zpaq x "$full_path" ;;
|
||||||
|
@ -106,19 +111,19 @@ EOF
|
||||||
# - Y2: at most give 2 files
|
# - Y2: at most give 2 files
|
||||||
local -a content
|
local -a content
|
||||||
content=("${extract_dir}"/*(DNY2))
|
content=("${extract_dir}"/*(DNY2))
|
||||||
if [[ ${#content} -eq 1 && -d "${content[1]}" ]]; then
|
if [[ ${#content} -eq 1 && -e "${content[1]}" ]]; then
|
||||||
# The extracted folder (${content[1]}) may have the same name as $extract_dir
|
# The extracted file/folder (${content[1]}) may have the same name as $extract_dir
|
||||||
# If so, we need to rename it to avoid conflicts in a 3-step process
|
# If so, we need to rename it to avoid conflicts in a 3-step process
|
||||||
#
|
#
|
||||||
# 1. Move and rename the extracted folder to a temporary random name
|
# 1. Move and rename the extracted file/folder to a temporary random name
|
||||||
# 2. Delete the empty folder
|
# 2. Delete the empty folder
|
||||||
# 3. Rename the extracted folder to the original name
|
# 3. Rename the extracted file/folder to the original name
|
||||||
if [[ "${content[1]:t}" == "$extract_dir" ]]; then
|
if [[ "${content[1]:t}" == "$extract_dir" ]]; then
|
||||||
# =(:) gives /tmp/zsh<random>, with :t it gives zsh<random>
|
# =(:) gives /tmp/zsh<random>, with :t it gives zsh<random>
|
||||||
local tmp_dir==(:); tmp_dir="${tmp_dir:t}"
|
local tmp_name==(:); tmp_name="${tmp_name:t}"
|
||||||
command mv "${content[1]}" "$tmp_dir" \
|
command mv "${content[1]}" "$tmp_name" \
|
||||||
&& command rmdir "$extract_dir" \
|
&& command rmdir "$extract_dir" \
|
||||||
&& command mv "$tmp_dir" "$extract_dir"
|
&& command mv "$tmp_name" "$extract_dir"
|
||||||
# Otherwise, if the extracted folder name already exists in the current
|
# Otherwise, if the extracted folder name already exists in the current
|
||||||
# directory (because of a previous file / folder), keep the extract_dir
|
# directory (because of a previous file / folder), keep the extract_dir
|
||||||
elif [[ ! -e "${content[1]:t}" ]]; then
|
elif [[ ! -e "${content[1]:t}" ]]; then
|
||||||
|
|
101
plugins/eza/README.md
Normal file
101
plugins/eza/README.md
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
# eza plugin
|
||||||
|
|
||||||
|
This provides aliases that invoke the [`eza`](https://github.com/eza-community/eza) utility rather than `ls`
|
||||||
|
|
||||||
|
To use it add `eza` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... eza)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
All configurations are done using the `zstyle` command in the `:omz:plugins:eza` namespace.
|
||||||
|
|
||||||
|
**NOTE:** The configuring needs to be done prior to OMZ loading the plugins. When the plugin is loaded,
|
||||||
|
changing the `zstyle` won't have any effect.
|
||||||
|
|
||||||
|
### `dirs-first`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'dirs-first' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, directories will be grouped first.
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `git-status`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'git-status' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, always add `--git` flag to indicate git status (if tracked / in a git repo).
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `header`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'header' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, always add `-h` flag to add a header row for each column.
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `show-group`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'show-group' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes` (default), always add `-g` flag to show the group ownership.
|
||||||
|
|
||||||
|
Default: `yes`
|
||||||
|
|
||||||
|
### `size-prefix`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'size-prefix' (binary|none|si)
|
||||||
|
```
|
||||||
|
|
||||||
|
Choose the prefix to be used in displaying file size:
|
||||||
|
|
||||||
|
- `binary` -- use [binary prefixes](https://en.wikipedia.org/wiki/Binary_prefix) such as "Ki", "Mi", "Gi" and
|
||||||
|
so on
|
||||||
|
- `none` -- don't use any prefix, show size in bytes
|
||||||
|
- `si` (default) -- use [Metric/S.I. prefixes](https://en.wikipedia.org/wiki/Metric_prefix)
|
||||||
|
|
||||||
|
Default: `si`
|
||||||
|
|
||||||
|
### `time-style`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'time-style' $TIME_STYLE
|
||||||
|
```
|
||||||
|
|
||||||
|
Sets the `--time-style` option of `eza`. (See `man eza` for the options)
|
||||||
|
|
||||||
|
Default: Not set, which means the default behavior of `eza` will take place.
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
**Notes:**
|
||||||
|
|
||||||
|
- Aliases may be modified by Configuration
|
||||||
|
- The term "files" without "only" qualifier means both files & directories
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
| ------ | ----------------- | -------------------------------------------------------------------------- |
|
||||||
|
| `la` | `eza -la` | List all files (except . and ..) as a long list |
|
||||||
|
| `ldot` | `eza -ld .*` | List dotfiles only (directories shown as entries instead of recursed into) |
|
||||||
|
| `lD` | `eza -lD` | List only directories (excluding dotdirs) as a long list |
|
||||||
|
| `lDD` | `eza -laD` | List only directories (including dotdirs) as a long list |
|
||||||
|
| `ll` | `eza -l` | List files as a long list |
|
||||||
|
| `ls` | `eza` | Plain eza call |
|
||||||
|
| `lsd` | `eza -d` | List specified files with directories as entries, in a grid |
|
||||||
|
| `lsdl` | `eza -dl` | List specified files with directories as entries, in a long list |
|
||||||
|
| `lS` | `eza -l -ssize` | List files as a long list, sorted by size |
|
||||||
|
| `lT` | `eza -l -snewest` | List files as a long list, sorted by date (newest last) |
|
62
plugins/eza/eza.plugin.zsh
Normal file
62
plugins/eza/eza.plugin.zsh
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
if ! (( $+commands[eza] )); then
|
||||||
|
print "zsh eza plugin: eza not found. Please install eza before using this plugin." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
typeset -a _EZA_HEAD
|
||||||
|
typeset -a _EZA_TAIL
|
||||||
|
|
||||||
|
function _configure_eza() {
|
||||||
|
local _val
|
||||||
|
# Get the head flags
|
||||||
|
if zstyle -T ':omz:plugins:eza' 'show-group'; then
|
||||||
|
_EZA_HEAD+=("g")
|
||||||
|
fi
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'header'; then
|
||||||
|
_EZA_HEAD+=("h")
|
||||||
|
fi
|
||||||
|
zstyle -s ':omz:plugins:eza' 'size-prefix' _val
|
||||||
|
case "${_val:l}" in
|
||||||
|
binary)
|
||||||
|
_EZA_HEAD+=("b")
|
||||||
|
;;
|
||||||
|
none)
|
||||||
|
_EZA_HEAD+=("B")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Get the tail long-options
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'dirs-first'; then
|
||||||
|
_EZA_TAIL+=("--group-directories-first")
|
||||||
|
fi
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'git-status'; then
|
||||||
|
_EZA_TAIL+=("--git")
|
||||||
|
fi
|
||||||
|
zstyle -s ':omz:plugins:eza' 'time-style' _val
|
||||||
|
if [[ $_val ]]; then
|
||||||
|
_EZA_TAIL+=("--time-style='$_val'")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_configure_eza
|
||||||
|
|
||||||
|
function _alias_eza() {
|
||||||
|
local _head="${(j::)_EZA_HEAD}$2"
|
||||||
|
local _tail="${(j: :)_EZA_TAIL}"
|
||||||
|
alias "$1"="eza${_head:+ -}${_head}${_tail:+ }${_tail}${3:+ }$3"
|
||||||
|
}
|
||||||
|
|
||||||
|
_alias_eza la la
|
||||||
|
_alias_eza ldot ld ".*"
|
||||||
|
_alias_eza lD lD
|
||||||
|
_alias_eza lDD lDa
|
||||||
|
_alias_eza ll l
|
||||||
|
_alias_eza ls
|
||||||
|
_alias_eza lsd d
|
||||||
|
_alias_eza lsdl dl
|
||||||
|
_alias_eza lS "l -ssize"
|
||||||
|
_alias_eza lT "l -snewest"
|
||||||
|
|
||||||
|
unfunction _alias_eza
|
||||||
|
unfunction _configure_eza
|
||||||
|
unset _EZA_HEAD
|
||||||
|
unset _EZA_TAIL
|
|
@ -1,14 +1,14 @@
|
||||||
# Use Ctrl-Z to switch back to Vim
|
# Use Ctrl-Z to switch back to Vim
|
||||||
|
|
||||||
I frequently need to execute random commands in my shell. To achieve it I pause
|
I frequently need to execute random commands in my shell. To achieve it I pause
|
||||||
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
|
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
|
||||||
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
|
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
|
||||||
to Vim. I could not find a solution, so I developed one on my own that
|
to Vim. I could not find a solution, so I developed one on my own that
|
||||||
works wonderfully with ZSH.
|
works wonderfully with ZSH.
|
||||||
|
|
||||||
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
|
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
|
||||||
|
|
||||||
Credits:
|
Credits:
|
||||||
- original idea by @sheerun
|
- original idea by @sheerun
|
||||||
- added to OMZ by @mbologna
|
- added to OMZ by @mbologna
|
||||||
|
|
||||||
|
|
|
@ -71,13 +71,13 @@ them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
|
||||||
For example: `fastfile_var_prefix='@'`.
|
For example: `fastfile_var_prefix='@'`.
|
||||||
|
|
||||||
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
|
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
|
||||||
created global aliases.
|
created global aliases.
|
||||||
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
|
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
|
||||||
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
|
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
|
||||||
or using `⌥ Option`+`6` in macOS.
|
or using `⌥ Option`+`6` in macOS.
|
||||||
|
|
||||||
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
|
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
|
||||||
with a trailing slash.
|
with a trailing slash.
|
||||||
**Default:** `$HOME/.fastfile/`.
|
**Default:** `$HOME/.fastfile/`.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
|
@ -9,7 +9,7 @@ function fwl () {
|
||||||
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
|
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
|
||||||
|
|
||||||
for i in $zones; do
|
for i in $zones; do
|
||||||
sudo firewall-cmd --zone $i --list-all
|
sudo firewall-cmd --zone ${i/ \(default\)} --list-all
|
||||||
done
|
done
|
||||||
|
|
||||||
echo 'Direct Rules:'
|
echo 'Direct Rules:'
|
||||||
|
|
|
@ -58,7 +58,7 @@ function fl {
|
||||||
tell application forkLiftSetapp
|
tell application forkLiftSetapp
|
||||||
activate
|
activate
|
||||||
set forkLiftVersion to version
|
set forkLiftVersion to version
|
||||||
end tell
|
end tell
|
||||||
else if forkLift3 is not null and application forkLift3 is running then
|
else if forkLift3 is not null and application forkLift3 is running then
|
||||||
tell application forkLift3
|
tell application forkLift3
|
||||||
activate
|
activate
|
||||||
|
@ -84,7 +84,7 @@ function fl {
|
||||||
else if forkLift is not null then
|
else if forkLift is not null then
|
||||||
set appName to forkLift
|
set appName to forkLift
|
||||||
end if
|
end if
|
||||||
|
|
||||||
tell application appName
|
tell application appName
|
||||||
activate
|
activate
|
||||||
set forkLiftVersion to version
|
set forkLiftVersion to version
|
||||||
|
|
|
@ -60,12 +60,22 @@ Available search contexts are:
|
||||||
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
|
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
|
||||||
| unheap | `http://www.unheap.com/?s=` |
|
| unheap | `http://www.unheap.com/?s=` |
|
||||||
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
|
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
|
||||||
|
| nextjs | `https://www.google.com/search?as_sitesearch=nextjs.org&as_q=` |
|
||||||
|
|
||||||
If you want to have another context, open an Issue and tell us!
|
If you want to have another context, open an Issue and tell us!
|
||||||
|
|
||||||
## Fallback search behaviour
|
## Fallback search behaviour
|
||||||
|
|
||||||
The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
The plugin will use Google as a fallback if the docs site for a search context does not have a search
|
||||||
|
function. You can set the fallback search engine to DuckDuckGo by setting
|
||||||
|
`FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
||||||
|
|
||||||
|
## DuckDuckGo Lucky Search
|
||||||
|
|
||||||
|
Enable DuckDuckGo's "ducky" (lucky) search feature to automatically access the top search result. This feature
|
||||||
|
is optimized for DuckDuckGo, as Google redirects to an intermediate page. The FRONTEND_SEARCH_FALLBACK_LUCKY
|
||||||
|
environment variable triggers the use of DuckDuckGo's lucky search, rendering the FRONTEND_SEARCH_FALLBACK
|
||||||
|
setting unnecessary in this context.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,19 @@ alias stackoverflow='frontend stackoverflow'
|
||||||
alias typescript='frontend typescript'
|
alias typescript='frontend typescript'
|
||||||
alias unheap='frontend unheap'
|
alias unheap='frontend unheap'
|
||||||
alias vuejs='frontend vuejs'
|
alias vuejs='frontend vuejs'
|
||||||
|
alias nextjs='frontend nextjs'
|
||||||
|
|
||||||
function _frontend_fallback() {
|
function _frontend_fallback() {
|
||||||
case "$FRONTEND_SEARCH_FALLBACK" in
|
if [[ "$FRONTEND_SEARCH_FALLBACK_LUCKY" == "true" ]]; then
|
||||||
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
case true in
|
||||||
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
*) echo "https://duckduckgo.com/?q=!ducky+site%3A$1+" ;;
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
case "$FRONTEND_SEARCH_FALLBACK" in
|
||||||
|
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
||||||
|
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function frontend() {
|
function frontend() {
|
||||||
|
@ -70,6 +77,7 @@ function frontend() {
|
||||||
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
||||||
unheap 'http://www.unheap.com/?s='
|
unheap 'http://www.unheap.com/?s='
|
||||||
vuejs $(_frontend_fallback 'vuejs.org')
|
vuejs $(_frontend_fallback 'vuejs.org')
|
||||||
|
nextjs $(_frontend_fallback 'nextjs.org')
|
||||||
)
|
)
|
||||||
|
|
||||||
# show help for command list
|
# show help for command list
|
||||||
|
@ -81,7 +89,7 @@ function frontend() {
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||||
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
|
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
|
||||||
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
||||||
print -P ""
|
print -P ""
|
||||||
|
@ -96,7 +104,7 @@ function frontend() {
|
||||||
echo ""
|
echo ""
|
||||||
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||||
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
|
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
|
||||||
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||||
echo ""
|
echo ""
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
function fzf_setup_using_fzf() {
|
||||||
|
(( ${+commands[fzf]} )) || return 1
|
||||||
|
|
||||||
|
# we remove "fzf " prefix, this fixes really old fzf versions behaviour
|
||||||
|
# see https://github.com/ohmyzsh/ohmyzsh/issues/12387
|
||||||
|
local fzf_ver=${"$(fzf --version)"#fzf }
|
||||||
|
is-at-least 0.48.0 ${${(s: :)fzf_ver}[1]} || return 1
|
||||||
|
|
||||||
|
eval "$(fzf --zsh)"
|
||||||
|
}
|
||||||
|
|
||||||
function fzf_setup_using_base_dir() {
|
function fzf_setup_using_base_dir() {
|
||||||
local fzf_base fzf_shell fzfdirs dir
|
local fzf_base fzf_shell fzfdirs dir
|
||||||
|
|
||||||
|
@ -8,6 +19,7 @@ function fzf_setup_using_base_dir() {
|
||||||
"${HOME}/.fzf"
|
"${HOME}/.fzf"
|
||||||
"${HOME}/.nix-profile/share/fzf"
|
"${HOME}/.nix-profile/share/fzf"
|
||||||
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
|
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
|
||||||
|
"${MSYSTEM_PREFIX}/share/fzf"
|
||||||
"/usr/local/opt/fzf"
|
"/usr/local/opt/fzf"
|
||||||
"/opt/homebrew/opt/fzf"
|
"/opt/homebrew/opt/fzf"
|
||||||
"/usr/share/fzf"
|
"/usr/share/fzf"
|
||||||
|
@ -61,7 +73,7 @@ function fzf_setup_using_base_dir() {
|
||||||
|
|
||||||
function fzf_setup_using_debian() {
|
function fzf_setup_using_debian() {
|
||||||
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
|
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
|
||||||
# Not a debian based distro
|
# Not a debian based distro
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -216,7 +228,8 @@ Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
fzf_setup_using_openbsd \
|
fzf_setup_using_fzf \
|
||||||
|
|| fzf_setup_using_openbsd \
|
||||||
|| fzf_setup_using_debian \
|
|| fzf_setup_using_debian \
|
||||||
|| fzf_setup_using_opensuse \
|
|| fzf_setup_using_opensuse \
|
||||||
|| fzf_setup_using_cygwin \
|
|| fzf_setup_using_cygwin \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Gas plugin
|
# Gas plugin
|
||||||
|
|
||||||
This plugin adds autocompletion for the [gas](http://walle.github.com/gas) command,
|
This plugin adds autocompletion for the [gas](http://ramblingsby.me/gas/) command,
|
||||||
a utility to manage Git authors.
|
a utility to manage Git authors.
|
||||||
|
|
||||||
To use it, add `gas` to the plugins array of your zshrc file:
|
To use it, add `gas` to the plugins array of your zshrc file:
|
||||||
|
|
|
@ -9,6 +9,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
||||||
"/usr/local/share/google-cloud-sdk"
|
"/usr/local/share/google-cloud-sdk"
|
||||||
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||||
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||||
|
"/opt/homebrew/share/google-cloud-sdk"
|
||||||
"/usr/share/google-cloud-sdk"
|
"/usr/share/google-cloud-sdk"
|
||||||
"/snap/google-cloud-sdk/current"
|
"/snap/google-cloud-sdk/current"
|
||||||
"/snap/google-cloud-cli/current"
|
"/snap/google-cloud-cli/current"
|
||||||
|
@ -17,6 +18,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
||||||
"/opt/google-cloud-sdk"
|
"/opt/google-cloud-sdk"
|
||||||
"/opt/google-cloud-cli"
|
"/opt/google-cloud-cli"
|
||||||
"/opt/local/libexec/google-cloud-sdk"
|
"/opt/local/libexec/google-cloud-sdk"
|
||||||
|
"$HOME/.asdf/installs/gcloud/*/"
|
||||||
)
|
)
|
||||||
|
|
||||||
for gcloud_sdk_location in $search_locations; do
|
for gcloud_sdk_location in $search_locations; do
|
||||||
|
@ -29,11 +31,9 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( ${+CLOUDSDK_HOME} )); then
|
if (( ${+CLOUDSDK_HOME} )); then
|
||||||
# Only source this if gcloud isn't already on the path
|
# Source path file
|
||||||
if (( ! $+commands[gcloud] )); then
|
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
|
||||||
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
|
source "${CLOUDSDK_HOME}/path.zsh.inc"
|
||||||
source "${CLOUDSDK_HOME}/path.zsh.inc"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Look for completion file in different paths
|
# Look for completion file in different paths
|
||||||
|
|
|
@ -29,7 +29,7 @@ function git-fetch-all {
|
||||||
date -R &>! "$gitdir/FETCH_LOG"
|
date -R &>! "$gitdir/FETCH_LOG"
|
||||||
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
||||||
GIT_TERMINAL_PROMPT=0 \
|
GIT_TERMINAL_PROMPT=0 \
|
||||||
command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG"
|
command git fetch --all --recurse-submodules=yes 2>/dev/null &>> "$gitdir/FETCH_LOG"
|
||||||
) &|
|
) &|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
47
plugins/git-commit/README.md
Normal file
47
plugins/git-commit/README.md
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# git-commit plugin
|
||||||
|
|
||||||
|
The git-commit plugin adds several
|
||||||
|
[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for
|
||||||
|
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
|
||||||
|
|
||||||
|
To use it, add `git-commit` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... git-commit)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
|
||||||
|
```
|
||||||
|
|
||||||
|
Where `type` is one of the following:
|
||||||
|
|
||||||
|
- `build`
|
||||||
|
- `chore`
|
||||||
|
- `ci`
|
||||||
|
- `docs`
|
||||||
|
- `feat`
|
||||||
|
- `fix`
|
||||||
|
- `perf`
|
||||||
|
- `refactor`
|
||||||
|
- `rev`
|
||||||
|
- `style`
|
||||||
|
- `test`
|
||||||
|
- `wip`
|
||||||
|
|
||||||
|
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
|
||||||
|
> It will still generate a commit message in the format `revert: <message>`
|
||||||
|
|
||||||
|
> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.<type>` that you manually set. Use with
|
||||||
|
> care!
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
| Git alias | Command |
|
||||||
|
| --------------------------------------------- | ---------------------------------------------------- |
|
||||||
|
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
|
||||||
|
| `git wip "work in progress"` | `git commit -m "work in progress"` |
|
||||||
|
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
|
||||||
|
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
|
58
plugins/git-commit/git-commit.plugin.zsh
Normal file
58
plugins/git-commit/git-commit.plugin.zsh
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
local _rev="$(git -C $ZSH rev-parse HEAD 2> /dev/null)"
|
||||||
|
if [[ $_rev == $(git config --global --get oh-my-zsh.git-commit-alias 2> /dev/null) ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
git config --global oh-my-zsh.git-commit-alias "$_rev"
|
||||||
|
|
||||||
|
local -a _git_commit_aliases
|
||||||
|
_git_commit_aliases=(
|
||||||
|
'build'
|
||||||
|
'chore'
|
||||||
|
'ci'
|
||||||
|
'docs'
|
||||||
|
'feat'
|
||||||
|
'fix'
|
||||||
|
'perf'
|
||||||
|
'refactor'
|
||||||
|
'revert'
|
||||||
|
'style'
|
||||||
|
'test'
|
||||||
|
'wip'
|
||||||
|
)
|
||||||
|
|
||||||
|
local _alias _type
|
||||||
|
for _type in "${_git_commit_aliases[@]}"; do
|
||||||
|
# an alias can't be named "revert" because the git command takes precedence
|
||||||
|
# https://stackoverflow.com/a/3538791
|
||||||
|
case "$_type" in
|
||||||
|
revert) _alias=rev ;;
|
||||||
|
*) _alias=$_type ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
local _func='!a() {
|
||||||
|
local _scope _attention _message
|
||||||
|
while [ $# -ne 0 ]; do
|
||||||
|
case $1 in
|
||||||
|
-s | --scope )
|
||||||
|
if [ -z $2 ]; then
|
||||||
|
echo "Missing scope!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_scope="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-a | --attention )
|
||||||
|
_attention="!"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
_message="${_message} $1"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
|
||||||
|
}; a'
|
||||||
|
|
||||||
|
git config --global alias.$_alias "$_func"
|
||||||
|
done
|
|
@ -9,6 +9,10 @@ To use it, add `git-prompt` to the plugins array in your zshrc file:
|
||||||
plugins=(... git-prompt)
|
plugins=(... git-prompt)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You may also need to [customize your theme](https://github.com/ohmyzsh/ohmyzsh/issues/9395#issuecomment-1027130429)
|
||||||
|
to change the way the prompt is built. See the
|
||||||
|
[OMZ wiki on customizing themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes).
|
||||||
|
|
||||||
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
|
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
|
@ -10,254 +10,274 @@ plugins=(... git)
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command |
|
| Alias | Command |
|
||||||
| :------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| g | git |
|
| `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` |
|
||||||
| ga | git add |
|
| `ggpnp` | `ggl && ggp` |
|
||||||
| gaa | git add --all |
|
| `ggpur` | `ggu` |
|
||||||
| gapa | git add --patch |
|
| `g` | `git` |
|
||||||
| gau | git add --update |
|
| `ga` | `git add` |
|
||||||
| gav | git add --verbose |
|
| `gaa` | `git add --all` |
|
||||||
| gap | git apply |
|
| `gapa` | `git add --patch` |
|
||||||
| gapt | git apply --3way |
|
| `gau` | `git add --update` |
|
||||||
| gb | git branch |
|
| `gav` | `git add --verbose` |
|
||||||
| gba | git branch --all |
|
| `gwip` | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` |
|
||||||
| gbd | git branch --delete |
|
| `gam` | `git am` |
|
||||||
| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*(<span>$</span>(git_main_branch)\|<span>$</span>(git_develop_branch))\s*<span>$</span>)" \| xargs git branch --delete 2>/dev/null |
|
| `gama` | `git am --abort` |
|
||||||
| gbD | git branch --delete --force |
|
| `gamc` | `git am --continue` |
|
||||||
| gbg | git branch -vv | grep ": gone\]" |
|
| `gamscp` | `git am --show-current-patch` |
|
||||||
| gbgd | git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d |
|
| `gams` | `git am --skip` |
|
||||||
| gbgD | git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D |
|
| `gap` | `git apply` |
|
||||||
| gbl | git blame -b -w |
|
| `gapt` | `git apply --3way` |
|
||||||
| gbnm | git branch --no-merged |
|
| `gbs` | `git bisect` |
|
||||||
| gbr | git branch --remote |
|
| `gbsb` | `git bisect bad` |
|
||||||
| gbs | git bisect |
|
| `gbsg` | `git bisect good` |
|
||||||
| gbsb | git bisect bad |
|
| `gbsn` | `git bisect new` |
|
||||||
| gbsg | git bisect good |
|
| `gbso` | `git bisect old` |
|
||||||
| gbsr | git bisect reset |
|
| `gbsr` | `git bisect reset` |
|
||||||
| gbss | git bisect start |
|
| `gbss` | `git bisect start` |
|
||||||
| gc | git commit --verbose |
|
| `gbl` | `git blame -w` |
|
||||||
| gc! | git commit --verbose --amend |
|
| `gb` | `git branch` |
|
||||||
| gcn! | git commit --verbose --no-edit --amend |
|
| `gba` | `git branch --all` |
|
||||||
| gca | git commit --verbose --all |
|
| `gbd` | `git branch --delete` |
|
||||||
| gca! | git commit --verbose --all --amend |
|
| `gbD` | `git branch --delete --force` |
|
||||||
| gcan! | git commit --verbose --all --no-edit --amend |
|
| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` |
|
||||||
| gcans! | git commit --verbose --all --signoff --no-edit --amend |
|
| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` |
|
||||||
| gcam | git commit --all --message |
|
| `gbm` | `git branch --move` |
|
||||||
| gcas | git commit --all --signoff |
|
| `gbnm` | `git branch --no-merged` |
|
||||||
| gcasm | git commit --all --signoff --message |
|
| `gbr` | `git branch --remote` |
|
||||||
| gcsm | git commit --signoff --message |
|
| `ggsup` | `git branch --set-upstream-to=origin/$(git_current_branch)` |
|
||||||
| gcb | git checkout -b |
|
| `gbg` | `LANG=C git branch -vv \| grep ": gone\]"` |
|
||||||
| gcf | git config --list |
|
| `gco` | `git checkout` |
|
||||||
| gcl | git clone --recurse-submodules |
|
| `gcor` | `git checkout --recurse-submodules` |
|
||||||
| gccd | git clone --recurse-submodules "<span>$</span>@" && cd "<span>$</span>(basename <span>$</span>\_ .git)" |
|
| `gcb` | `git checkout -b` |
|
||||||
| gclean | git clean --interactive -d |
|
| `gcB` | `git checkout -B` |
|
||||||
| gpristine | git reset --hard && git clean -dffx |
|
| `gcd` | `git checkout $(git_develop_branch)` |
|
||||||
| gcm | git checkout $(git_main_branch) |
|
| `gcm` | `git checkout $(git_main_branch)` |
|
||||||
| gcd | git checkout $(git_develop_branch) |
|
| `gcp` | `git cherry-pick` |
|
||||||
| gcmsg | git commit --message |
|
| `gcpa` | `git cherry-pick --abort` |
|
||||||
| gco | git checkout |
|
| `gcpc` | `git cherry-pick --continue` |
|
||||||
| gcor | git checkout --recurse-submodules |
|
| `gclean` | `git clean --interactive -d` |
|
||||||
| gcount | git shortlog --summary -n |
|
| `gcl` | `git clone --recurse-submodules` |
|
||||||
| gcp | git cherry-pick |
|
| `gccd` | `git clone --recurse-submodules "$@" && cd "$(basename $\_ .git)"` |
|
||||||
| gcpa | git cherry-pick --abort |
|
| `gcam` | `git commit --all --message` |
|
||||||
| gcpc | git cherry-pick --continue |
|
| `gcas` | `git commit --all --signoff` |
|
||||||
| gcs | git commit -S |
|
| `gcasm` | `git commit --all --signoff --message` |
|
||||||
| gcss | git commit -S -s |
|
| `gcmsg` | `git commit --message` |
|
||||||
| gcssm | git commit -S -s -m |
|
| `gcsm` | `git commit --signoff --message` |
|
||||||
| gd | git diff |
|
| `gc` | `git commit --verbose` |
|
||||||
| gdca | git diff --cached |
|
| `gca` | `git commit --verbose --all` |
|
||||||
| gdcw | git diff --cached --word-diff |
|
| `gca!` | `git commit --verbose --all --amend` |
|
||||||
| gdct | git describe --tags $(git rev-list --tags --max-count=1) |
|
| `gcan!` | `git commit --verbose --all --no-edit --amend` |
|
||||||
| gds | git diff --staged |
|
| `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` |
|
||||||
| gdt | git diff-tree --no-commit-id --name-only -r |
|
| `gcann!` | `git commit --verbose --all --date=now --no-edit --amend` |
|
||||||
| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock" |
|
| `gc!` | `git commit --verbose --amend` |
|
||||||
| gdup | git diff @{upstream} |
|
| `gcn!` | `git commit --verbose --no-edit --amend` |
|
||||||
| gdv | git diff -w $@ \| view - |
|
| `gcs` | `git commit -S` |
|
||||||
| gdw | git diff --word-diff |
|
| `gcss` | `git commit -S -s` |
|
||||||
| gf | git fetch |
|
| `gcssm` | `git commit -S -s -m` |
|
||||||
| gfa | git fetch --all --prune |
|
| `gcf` | `git config --list` |
|
||||||
| gfg | git ls-files \| grep |
|
| `gdct` | `git describe --tags $(git rev-list --tags --max-count=1)` |
|
||||||
| gfo | git fetch origin |
|
| `gd` | `git diff` |
|
||||||
| gg | git gui citool |
|
| `gdca` | `git diff --cached` |
|
||||||
| gga | git gui citool --amend |
|
| `gdcw` | `git diff --cached --word-diff` |
|
||||||
| ggf | git push --force origin $(current_branch) |
|
| `gds` | `git diff --staged` |
|
||||||
| ggfl | git push --force-with-lease origin $(current_branch) |
|
| `gdw` | `git diff --word-diff` |
|
||||||
| ggl | git pull origin $(current_branch) |
|
| `gdv` | `git diff -w "$@" \| view -` |
|
||||||
| ggp | git push origin $(current_branch) |
|
| `gdup` | `git diff @{upstream}` |
|
||||||
| ggpnp | ggl && ggp |
|
| `gdnolock` | `git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock"` |
|
||||||
| ggpull | git pull origin "$(git_current_branch)" |
|
| `gdt` | `git diff-tree --no-commit-id --name-only -r` |
|
||||||
| ggpur | ggu |
|
| `gf` | `git fetch` |
|
||||||
| ggpush | git push origin "$(git_current_branch)" |
|
| `gfa` | `git fetch --all --prune` |
|
||||||
| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
|
| `gfo` | `git fetch origin` |
|
||||||
| ggu | git pull --rebase origin $(current_branch) |
|
| `gg` | `git gui citool` |
|
||||||
| gpsup | git push --set-upstream origin $(git_current_branch) |
|
| `gga` | `git gui citool --amend` |
|
||||||
| gpsupf | git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes (git version >= 2.30) |
|
| `ghh` | `git help` |
|
||||||
| gpsupf | git push --set-upstream origin $(git_current_branch) --force-with-lease (git version < 2.30) |
|
| `glgg` | `git log --graph` |
|
||||||
| ghh | git help |
|
| `glgga` | `git log --graph --decorate --all` |
|
||||||
| gignore | git update-index --assume-unchanged |
|
| `glgm` | `git log --graph --max-count=10` |
|
||||||
| gignored | git ls-files -v \| grep "^[[:lower:]]" |
|
| `glod` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'` |
|
||||||
| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk |
|
| `glods` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short` |
|
||||||
| gk | gitk --all --branches &! |
|
| `glol` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'` |
|
||||||
| gke | gitk --all $(git log --walk-reflogs --pretty=%h) &! |
|
| `glola` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all` |
|
||||||
| gl | git pull |
|
| `glols` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat` |
|
||||||
| glg | git log --stat |
|
| `glo` | `git log --oneline --decorate` |
|
||||||
| glgp | git log --stat --patch |
|
| `glog` | `git log --oneline --decorate --graph` |
|
||||||
| glgg | git log --graph |
|
| `gloga` | `git log --oneline --decorate --graph --all` |
|
||||||
| glgga | git log --graph --decorate --all |
|
| `glp` | `git log --pretty=<format>` |
|
||||||
| glgm | git log --graph --max-count=10 |
|
| `glg` | `git log --stat` |
|
||||||
| glo | git log --oneline --decorate |
|
| `glgp` | `git log --stat --patch` |
|
||||||
| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' |
|
| `gignored` | `git ls-files -v \| grep "^[[:lower:]]"` |
|
||||||
| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat |
|
| `gfg` | `git ls-files \| grep` |
|
||||||
| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' |
|
| `gm` | `git merge` |
|
||||||
| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short |
|
| `gma` | `git merge --abort` |
|
||||||
| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all |
|
| `gmc` | `git merge --continue` |
|
||||||
| glog | git log --oneline --decorate --graph |
|
| `gms` | `git merge --squash` |
|
||||||
| gloga | git log --oneline --decorate --graph --all |
|
| `gmom` | `git merge origin/$(git_main_branch)` |
|
||||||
| glp | git log --pretty=\<format\> |
|
| `gmum` | `git merge upstream/$(git_main_branch)` |
|
||||||
| gm | git merge |
|
| `gmtl` | `git mergetool --no-prompt` |
|
||||||
| gms | git merge --squash |
|
| `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` |
|
||||||
| gmom | git merge origin/$(git_main_branch) |
|
| `gl` | `git pull` |
|
||||||
| gmtl | git mergetool --no-prompt |
|
| `gpr` | `git pull --rebase` |
|
||||||
| gmtlvim | git mergetool --no-prompt --tool=vimdiff |
|
| `gprv` | `git pull --rebase -v` |
|
||||||
| gmum | git merge upstream/$(git_main_branch) |
|
| `gpra` | `git pull --rebase --autostash` |
|
||||||
| gma | git merge --abort |
|
| `gprav` | `git pull --rebase --autostash -v` |
|
||||||
| gp | git push |
|
| `gprom` | `git pull --rebase origin $(git_main_branch)` |
|
||||||
| gpd | git push --dry-run |
|
| `gpromi` | `git pull --rebase=interactive origin $(git_main_branch)` |
|
||||||
| gpf | git push --force-with-lease --force-if-includes (git version >= 2.30) |
|
| `ggpull` | `git pull origin "$(git_current_branch)"` |
|
||||||
| gpf | git push --force-with-lease (git version < 2.30) |
|
| `ggl` | `git pull origin $(current_branch)` |
|
||||||
| gpf! | git push --force |
|
| `gluc` | `git pull upstream $(git_current_branch)` |
|
||||||
| gpoat | git push origin --all && git push origin --tags |
|
| `glum` | `git pull upstream $(git_main_branch)` |
|
||||||
| gpod | git push origin --delete |
|
| `gp` | `git push` |
|
||||||
| gpr | git pull --rebase |
|
| `gpd` | `git push --dry-run` |
|
||||||
| gpu | git push upstream |
|
| `gpf!` | `git push --force` |
|
||||||
| gpv | git push --verbose |
|
| `ggf` | `git push --force origin $(current_branch)` |
|
||||||
| gr | git remote |
|
| `gpf` | On Git >= 2.30: `git push --force-with-lease --force-if-includes` |
|
||||||
| gra | git remote add |
|
| `gpf` | On Git < 2.30: `git push --force-with-lease` |
|
||||||
| grb | git rebase |
|
| `ggfl` | `git push --force-with-lease origin $(current_branch)` |
|
||||||
| grba | git rebase --abort |
|
| `gpsup` | `git push --set-upstream origin $(git_current_branch)` |
|
||||||
| grbc | git rebase --continue |
|
| `gpsupf` | On Git >= 2.30: `git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes` |
|
||||||
| grbd | git rebase $(git_develop_branch) |
|
| `gpsupf` | On Git < 2.30: `git push --set-upstream origin $(git_current_branch) --force-with-lease` |
|
||||||
| grbi | git rebase --interactive |
|
| `gpv` | `git push --verbose` |
|
||||||
| grbm | git rebase $(git_main_branch) |
|
| `gpoat` | `git push origin --all && git push origin --tags` |
|
||||||
| grbom | git rebase origin/$(git_main_branch) |
|
| `gpod` | `git push origin --delete` |
|
||||||
| grbo | git rebase --onto |
|
| `ggpush` | `git push origin "$(git_current_branch)"` |
|
||||||
| grbs | git rebase --skip |
|
| `ggp` | `git push origin $(current_branch)` |
|
||||||
| grev | git revert |
|
| `gpu` | `git push upstream` |
|
||||||
| grh | git reset |
|
| `grb` | `git rebase` |
|
||||||
| grhh | git reset --hard |
|
| `grba` | `git rebase --abort` |
|
||||||
| groh | git reset origin/$(git_current_branch) --hard |
|
| `grbc` | `git rebase --continue` |
|
||||||
| grm | git rm |
|
| `grbi` | `git rebase --interactive` |
|
||||||
| grmc | git rm --cached |
|
| `grbo` | `git rebase --onto` |
|
||||||
| grmv | git remote rename |
|
| `grbs` | `git rebase --skip` |
|
||||||
| grrm | git remote remove |
|
| `grbd` | `git rebase $(git_develop_branch)` |
|
||||||
| grs | git restore |
|
| `grbm` | `git rebase $(git_main_branch)` |
|
||||||
| grset | git remote set-url |
|
| `grbom` | `git rebase origin/$(git_main_branch)` |
|
||||||
| grss | git restore --source |
|
| `grf` | `git reflog` |
|
||||||
| grst | git restore --staged |
|
| `gr` | `git remote` |
|
||||||
| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
|
| `grv` | `git remote --verbose` |
|
||||||
| gru | git reset -- |
|
| `gra` | `git remote add` |
|
||||||
| grup | git remote update |
|
| `grrm` | `git remote remove` |
|
||||||
| grv | git remote --verbose |
|
| `grmv` | `git remote rename` |
|
||||||
| gsb | git status --short -b |
|
| `grset` | `git remote set-url` |
|
||||||
| gsd | git svn dcommit |
|
| `grup` | `git remote update` |
|
||||||
| gsh | git show |
|
| `grh` | `git reset` |
|
||||||
| gsi | git submodule init |
|
| `gru` | `git reset --` |
|
||||||
| gsps | git show --pretty=short --show-signature |
|
| `grhh` | `git reset --hard` |
|
||||||
| gsr | git svn rebase |
|
| `grhk` | `git reset --keep` |
|
||||||
| gss | git status --short |
|
| `grhs` | `git reset --soft` |
|
||||||
| gst | git status |
|
| `gpristine` | `git reset --hard && git clean --force -dfx` |
|
||||||
| gsta | git stash push (git version >= 2.13) |
|
| `gwipe` | `git reset --hard && git clean --force -df` |
|
||||||
| gsta | git stash save (git version < 2.13) |
|
| `groh` | `git reset origin/$(git_current_branch) --hard` |
|
||||||
| gstaa | git stash apply |
|
| `grs` | `git restore` |
|
||||||
| gstc | git stash clear |
|
| `grss` | `git restore --source` |
|
||||||
| gstd | git stash drop |
|
| `grst` | `git restore --staged` |
|
||||||
| gstl | git stash list |
|
| `gunwip` | `git rev-list --max-count=1 --format="%s" HEAD \| grep -q "--wip--" && git reset HEAD~1` |
|
||||||
| gstp | git stash pop |
|
| `grev` | `git revert` |
|
||||||
| gsts | git stash show --text |
|
| `grm` | `git rm` |
|
||||||
| gstu | git stash --include-untracked |
|
| `grmc` | `git rm --cached` |
|
||||||
| gstall | git stash --all |
|
| `gcount` | `git shortlog --summary -n` |
|
||||||
| gsu | git submodule update |
|
| `gsh` | `git show` |
|
||||||
| gsw | git switch |
|
| `gsps` | `git show --pretty=short --show-signature` |
|
||||||
| gswc | git switch -c |
|
| `gstall` | `git stash --all` |
|
||||||
| gswm | git switch $(git_main_branch) |
|
| `gstu` | `git stash --include-untracked` |
|
||||||
| gswd | git switch $(git_develop_branch) |
|
| `gstaa` | `git stash apply` |
|
||||||
| gts | git tag -s |
|
| `gstc` | `git stash clear` |
|
||||||
| gtv | git tag \| sort -V |
|
| `gstd` | `git stash drop` |
|
||||||
| gtl | gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl |
|
| `gstl` | `git stash list` |
|
||||||
| gunignore | git update-index --no-assume-unchanged |
|
| `gstp` | `git stash pop` |
|
||||||
| gunwip | git rev-list --max-count=1 --format="%s" HEAD \| grep -q "\-\-wip\-\-" && git reset HEAD~1 |
|
| `gsta` | On Git >= 2.13: `git stash push` |
|
||||||
| gup | git pull --rebase |
|
| `gsta` | On Git < 2.13: `git stash save` |
|
||||||
| gupv | git pull --rebase --verbose |
|
| `gsts` | `git stash show --patch` |
|
||||||
| gupa | git pull --rebase --autostash |
|
| `gst` | `git status` |
|
||||||
| gupav | git pull --rebase --autostash --verbose |
|
| `gss` | `git status --short` |
|
||||||
| gupom | git pull --rebase origin $(git_main_branch) |
|
| `gsb` | `git status --short -b` |
|
||||||
| gupomi | git pull --rebase=interactive origin $(git_main_branch) |
|
| `gsi` | `git submodule init` |
|
||||||
| glum | git pull upstream $(git_main_branch) |
|
| `gsu` | `git submodule update` |
|
||||||
| gluc | git pull upstream $(git_current_branch) |
|
| `gsd` | `git svn dcommit` |
|
||||||
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
|
| `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` |
|
||||||
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]" |
|
| `gsr` | `git svn rebase` |
|
||||||
| gam | git am |
|
| `gsw` | `git switch` |
|
||||||
| gamc | git am --continue |
|
| `gswc` | `git switch -c` |
|
||||||
| gams | git am --skip |
|
| `gswd` | `git switch $(git_develop_branch)` |
|
||||||
| gama | git am --abort |
|
| `gswm` | `git switch $(git_main_branch)` |
|
||||||
| gamscp | git am --show-current-patch |
|
| `gta` | `git tag --annotate` |
|
||||||
| gwt | git worktree |
|
| `gts` | `git tag -s` |
|
||||||
| gwtls | git worktree list |
|
| `gtv` | `git tag \| sort -V` |
|
||||||
| gwtmv | git worktree move |
|
| `gignore` | `git update-index --assume-unchanged` |
|
||||||
| gwtrm | git worktree remove |
|
| `gunignore` | `git update-index --no-assume-unchanged` |
|
||||||
|
| `gwch` | `git whatchanged -p --abbrev-commit --pretty=medium` |
|
||||||
|
| `gwt` | `git worktree` |
|
||||||
|
| `gwtls` | `git worktree list` |
|
||||||
|
| `gwtmv` | `git worktree move` |
|
||||||
|
| `gwtrm` | `git worktree remove` |
|
||||||
|
| `gk` | `gitk --all --branches &!` |
|
||||||
|
| `gke` | `gitk --all $(git log --walk-reflogs --pretty=%h) &!` |
|
||||||
|
| `gtl` | `gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl` |
|
||||||
|
|
||||||
### Main branch preference
|
### Main branch preference
|
||||||
|
|
||||||
Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin favors using
|
Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin
|
||||||
a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive term `main`. This means
|
favors using a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive
|
||||||
that any aliases and functions that previously used `master`, will use `main` if that branch exists. We do this via the
|
term `main`. This means that any aliases and functions that previously used `master`, will use `main` if that
|
||||||
function `git_main_branch`.
|
branch exists. We do this via the function `git_main_branch`.
|
||||||
|
|
||||||
### Deprecated aliases
|
### Deprecated aliases
|
||||||
|
|
||||||
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
|
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not,
|
||||||
|
receive further support.
|
||||||
|
|
||||||
| Alias | Command | Modification |
|
| Alias | Command | Modification |
|
||||||
| :----- | :----------------------------------------------------- | :----------------------------------------------------- |
|
| :------- | :-------------------------------------------------------- | :-------------------------------------------------------- |
|
||||||
| gap | `git add --patch` | new alias `gapa` |
|
| `gap` | `git add --patch` | New alias: `gapa`. |
|
||||||
| gcl | `git config --list` | new alias `gcf` |
|
| `gcl` | `git config --list` | New alias: `gcf`. |
|
||||||
| gdc | `git diff --cached` | new alias `gdca` |
|
| `gdc` | `git diff --cached` | New alias: `gdca`. |
|
||||||
| gdt | `git difftool` | no replacement |
|
| `gdt` | `git difftool` | No replacement. |
|
||||||
| ggpull | `git pull origin $(current_branch)` | new alias `ggl` (`ggpull` still exists for now though) |
|
| `ggpull` | `git pull origin $(current_branch)` | New alias: `ggl`. (`ggpull` still exists for now though.) |
|
||||||
| ggpur | `git pull --rebase origin $(current_branch)` | new alias `ggu` (`ggpur` still exists for now though) |
|
| `ggpur` | `git pull --rebase origin $(current_branch)` | New alias: `ggu`. (`ggpur` still exists for now though.) |
|
||||||
| ggpush | `git push origin $(current_branch)` | new alias `ggp` (`ggpush` still exists for now though) |
|
| `ggpush` | `git push origin $(current_branch)` | New alias: `ggp`. (`ggpush` still exists for now though.) |
|
||||||
| gk | `gitk --all --branches` | now aliased to `gitk --all --branches` |
|
| `gk` | `gitk --all --branches` | Now aliased to `gitk --all --branches`. |
|
||||||
| glg | `git log --stat --max-count = 10` | now aliased to `git log --stat --color` |
|
| `glg` | `git log --stat --max-count=10` | Now aliased to `git log --stat --color`. |
|
||||||
| glgg | `git log --graph --max-count = 10` | now aliased to `git log --graph --color` |
|
| `glgg` | `git log --graph --max-count=10` | Now aliased to `git log --graph --color`. |
|
||||||
| gwc | `git whatchanged -p --abbrev-commit --pretty = medium` | new alias `gwch` |
|
| `gwc` | `git whatchanged -p --abbrev-commit --pretty = medium` | New alias: `gwch`. |
|
||||||
|
| `gup` | `git pull --rebase` | now alias `gpr` |
|
||||||
|
| `gupv` | `git pull --rebase -v` | now alias `gprv` |
|
||||||
|
| `gupa` | `git pull --rebase --autostash` | now alias `gpra` |
|
||||||
|
| `gupav` | `git pull --rebase --autostash -v` | now alias `gprav` |
|
||||||
|
| `gupom` | `git pull --rebase origin $(git_main_branch)` | now alias `gprom` |
|
||||||
|
| `gupomi` | `git pull --rebase=interactive origin $(git_main_branch)` | now alias `gpromi` |
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
### Current
|
### Current
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
| :--------------------- | :------------------------------------------------------------------------------------------------------- |
|
| :----------------------- | :-------------------------------------------------------------------------------------------------------------- |
|
||||||
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote |
|
| `current_branch` | Returns the name of the current branch. |
|
||||||
| current_branch | Return the name of the current branch |
|
| `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) |
|
||||||
| git_current_user_name | Returns the `user.name` config value |
|
| `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) |
|
||||||
| git_current_user_email | Returns the `user.email` config value |
|
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
|
||||||
| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise |
|
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise. |
|
||||||
| git_develop_branch | Returns the name of the develop branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
|
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
|
||||||
|
| `gbda` | Deletes all merged branches |
|
||||||
|
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
|
||||||
|
|
||||||
### Work in Progress (WIP)
|
### Work in Progress (WIP)
|
||||||
|
|
||||||
These features allow to pause a branch development and switch to another one (_"Work in Progress"_, or wip). When you want to go back to work, just unwip it.
|
These features allow you to pause developing one branch and switch to another one (_"Work in Progress"_, or
|
||||||
|
“wip”). When you want to go back to work, just “unwip” it.
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
| :--------------- | :---------------------------------------------- |
|
| :----------------- | :---------------------------------------------- |
|
||||||
| work_in_progress | Echoes a warning if the current branch is a wip |
|
| `gwip` | Commit wip branch |
|
||||||
| gwip | Commit wip branch |
|
| `gunwip` | Uncommit wip branch |
|
||||||
| gunwip | Uncommit wip branch |
|
| `gunwipall` | Uncommit all recent `--wip--` commits |
|
||||||
| gunwipall | Uncommit all recent `--wip--` commits |
|
| `work_in_progress` | Echoes a warning if the current branch is a wip |
|
||||||
|
|
||||||
|
Note that `gwip` and `gunwip` are aliases, but are also documented here to group all related WIP features.
|
||||||
|
|
||||||
### Deprecated functions
|
### Deprecated functions
|
||||||
|
|
||||||
| Command | Description | Reason |
|
| Command | Description | Reason |
|
||||||
| :----------------- | :-------------------------------------- | :-------------------------------------------------------------- |
|
| :------------------- | :-------------------------------------- | :--------------------------------------------------------------- |
|
||||||
| current_repository | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias) |
|
| `current_repository` | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias). |
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue