mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-15 23:08:16 +08:00
Compare commits
10 Commits
53dc8725a4
...
bc59fee62e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc59fee62e | ||
|
|
a79b37b954 | ||
|
|
0f45f82c0a | ||
|
|
129aeee6bc | ||
|
|
3a73094983 | ||
|
|
a4a8968be1 | ||
|
|
1b4703387d | ||
|
|
2cf9ad072d | ||
|
|
7ab8271cd9 | ||
|
|
09976595be |
2
.github/workflows/scorecard.yml
vendored
2
.github/workflows/scorecard.yml
vendored
@ -60,6 +60,6 @@ jobs:
|
||||
retention-days: 5
|
||||
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
|
||||
uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
@ -82,7 +82,7 @@ function detect-clipboard() {
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; }
|
||||
function clippaste() { termux-clipboard-get; }
|
||||
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
|
||||
function clipcopy() { tmux load-buffer "${1:--}"; }
|
||||
function clipcopy() { tmux load-buffer -w "${1:--}"; }
|
||||
function clippaste() { tmux save-buffer -; }
|
||||
else
|
||||
function _retry_clipboard_detection_or_fail() {
|
||||
|
||||
15
plugins/git-checkout-interactive/README.md
Normal file
15
plugins/git-checkout-interactive/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# lol
|
||||
|
||||
This plugin adds a command that lets you interactively switch between branches.
|
||||
|
||||
To use it, add `git-checkout-interactive` to the plugins array in your `.zshrc` file:
|
||||
|
||||
```zsh
|
||||
plugins=(... git-checkout-interactive)
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```sh
|
||||
gci
|
||||
```
|
||||
@ -0,0 +1,57 @@
|
||||
#######################################
|
||||
# git checkout interactive #
|
||||
#######################################
|
||||
|
||||
function git-checkout-interactive() {
|
||||
local ITEMS_TO_SHOW=10
|
||||
# Get all branches sorted by committer date, along with their last commit hash
|
||||
local branches
|
||||
branches=$(git for-each-ref --count="$ITEMS_TO_SHOW" --sort=-committerdate --format='%(refname:short) %(objectname:short)' refs/heads/)
|
||||
|
||||
# Parse branches
|
||||
local branch_list=()
|
||||
local current_branch
|
||||
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [[ "$current_branch" == "" ]]; then
|
||||
return 0
|
||||
fi
|
||||
while read -r branch hash; do
|
||||
if [[ "$branch" == "$current_branch" ]]; then
|
||||
echo "On branch $branch \n"
|
||||
else
|
||||
branch_list+=("$branch ($hash)")
|
||||
fi
|
||||
done <<< "$branches"
|
||||
|
||||
if (( ${#branch_list} == 0 )); then
|
||||
echo "No other branches available."
|
||||
return 0
|
||||
else
|
||||
echo "Select a branch to switch to:\n"
|
||||
fi
|
||||
|
||||
# Display menu
|
||||
local i=1
|
||||
for branch in "${branch_list[@]}"; do
|
||||
echo "($i) $branch"
|
||||
((i++))
|
||||
done
|
||||
echo -n "\nPlease enter your choice: "
|
||||
|
||||
# Handle user input
|
||||
while :; do
|
||||
local choice
|
||||
read -r choice
|
||||
if (( choice > 0 && choice <= ${#branch_list[@]} )); then
|
||||
local selected_branch="${branch_list[$((choice))]}"
|
||||
local target_branch="${selected_branch//->}"
|
||||
target_branch="${target_branch%% *}"
|
||||
git checkout "$target_branch"
|
||||
break
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
alias gci="git-checkout-interactive || return 0"
|
||||
@ -90,7 +90,7 @@ plugins=(... kubectl)
|
||||
| kga | `kubectl get all` | List all resources in ps format |
|
||||
| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces |
|
||||
| | | **Logs** |
|
||||
| klog | `kubectl logs` | Print the logs for a container or resource |
|
||||
| kl | `kubectl logs` | Print the logs for a container or resource |
|
||||
| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) |
|
||||
| | | **File copy** |
|
||||
| kcp | `kubectl cp` | Copy files and directories to and from containers |
|
||||
|
||||
@ -135,7 +135,7 @@ alias kga='kubectl get all'
|
||||
alias kgaa='kubectl get all --all-namespaces'
|
||||
|
||||
# Logs
|
||||
alias klog='kubectl logs'
|
||||
alias kl='kubectl logs'
|
||||
alias kl1h='kubectl logs --since 1h'
|
||||
alias kl1m='kubectl logs --since 1m'
|
||||
alias kl1s='kubectl logs --since 1s'
|
||||
|
||||
@ -23,6 +23,7 @@ The plugin also supports the following:
|
||||
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
|
||||
| `tksv` | tmux kill-server | Terminate all running tmux sessions |
|
||||
| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
|
||||
| `to` | tmux new-session -A -s | Create or attach to a named tmux session |
|
||||
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
|
||||
| `tmuxconf` | `$EDITOR $ZSH_TMUX_CONFIG` | Open .tmux.conf file with an editor |
|
||||
| `ts` | tmux new-session -s | Create a new named tmux session |
|
||||
|
||||
@ -81,6 +81,7 @@ alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
|
||||
|
||||
_build_tmux_alias "ta" "attach" "-t"
|
||||
_build_tmux_alias "tad" "attach -d" "-t"
|
||||
_build_tmux_alias "to" "new-session -A" "-s"
|
||||
_build_tmux_alias "ts" "new-session" "-s"
|
||||
_build_tmux_alias "tkss" "kill-session" "-t"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user