mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-04 20:37:37 +08:00
Compare commits
6 Commits
e8e8043acf
...
8ea9ac223a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ea9ac223a | ||
|
|
b42f22643a | ||
|
|
7de13621b3 | ||
|
|
0347ab360f | ||
|
|
784c200258 | ||
|
|
176d528f97 |
2
.github/dependencies.yml
vendored
2
.github/dependencies.yml
vendored
@ -12,7 +12,7 @@ dependencies:
|
||||
plugins/gradle:
|
||||
repo: gradle/gradle-completion
|
||||
branch: master
|
||||
version: a9d7c822e42cc6a5b028b59e46cffcc8e7bc1134
|
||||
version: dd3a8adb47e51b1f6e4dc180cb04bd02d5fccd4a
|
||||
precopy: |
|
||||
set -e
|
||||
find . ! -name _gradle ! -name LICENSE -delete
|
||||
|
||||
2
.github/workflows/dependencies.yml
vendored
2
.github/workflows/dependencies.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- name: Authenticate as @ohmyzsh
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
||||
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
|
||||
with:
|
||||
app-id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||
|
||||
2
.github/workflows/project.yml
vendored
2
.github/workflows/project.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
- name: Authenticate as @ohmyzsh
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
||||
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
|
||||
with:
|
||||
app-id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||
|
||||
17
plugins/ghostty-copypaste/README.md
Normal file
17
plugins/ghostty-copypaste/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# zsh-ghostty-copypaste
|
||||
|
||||
[ghostty](https://ghostty.org/) users, this `zsh` plugin allows you to copy / paste a text selected with the keyboard with `ctrl+shift+c` / `ctrl+shift+v`.
|
||||
|
||||
This is a complement to [zsh-shift-select](https://github.com/jirutka/zsh-shift-select), allowing to copy with `{ctrl+}shift+{left,right,up,down,home,end}`.
|
||||
|
||||
To use it, add `ghostty-copypaste` to the plugins array of your `.zshrc` file:
|
||||
|
||||
```
|
||||
plugins=(... ghostty-copypaste)
|
||||
```
|
||||
|
||||
## Principle
|
||||
|
||||
- `ghossty` allows to copy / paste a text selected with the mouse, but not with the keyboard, because this is an action devoted to a terminal (`zsh`) and not to a terminal emulator (`ghostty`).
|
||||
- When no mouse selection is started, `ghostty` passes a Control Sequence Introducer `^[[99;6u` / `^[[118;6u` to `zsh`. The plugin binds these CSI to the correct copy / paste functions for X11 or Wayland.
|
||||
- Be careful, `ghostty` can lose focus when copying and pasting because of `xclip` or `wl-copy`/`wl-paste` in the plugin. If you use it as a context terminal ("quake"), it is best not to close it when it loses focus.
|
||||
42
plugins/ghostty-copypaste/ghostty-copypaste.plugin.zsh
Normal file
42
plugins/ghostty-copypaste/ghostty-copypaste.plugin.zsh
Normal file
@ -0,0 +1,42 @@
|
||||
function zle-copy-to-clipboard {
|
||||
local selected_text start_pos end_pos
|
||||
|
||||
(( $MARK < $CURSOR )) \
|
||||
&& { start_pos=$MARK; end_pos=$CURSOR; } \
|
||||
|| { start_pos=$CURSOR; end_pos=$MARK; }
|
||||
|
||||
(( start_pos < 0 || end_pos < 0 )) \
|
||||
&& zle -R && return
|
||||
|
||||
selected_text="${BUFFER[$start_pos+1, $end_pos]}"
|
||||
|
||||
command -v xclip &> /dev/null \
|
||||
&& ( echo -n "$selected_text" | xclip -selection clipboard ) \
|
||||
&& zle -R && return
|
||||
|
||||
command -v wl-copy &> /dev/null \
|
||||
&& ( echo -n "$selected_text" | wl-copy ) && zle -R && return
|
||||
|
||||
zle -R
|
||||
}
|
||||
|
||||
function zle-paste-from-clipboard {
|
||||
local clipboard_content
|
||||
|
||||
command -v xclip &> /dev/null \
|
||||
&& clipboard_content=$(xclip -selection clipboard -o 2>/dev/null)
|
||||
command -v wl-paste &> /dev/null \
|
||||
&& clipboard_content=$(wl-paste --no-newline 2>/dev/null)
|
||||
|
||||
[[ -z "$clipboard_content" ]] && return
|
||||
|
||||
LBUFFER+="$clipboard_content"
|
||||
zle -R
|
||||
}
|
||||
|
||||
zle -N zle-copy-to-clipboard
|
||||
zle -N zle-paste-from-clipboard
|
||||
|
||||
# these 2 CSI from ghostty are sent for Ctrl+Shift+C and Ctrl+Shift+V
|
||||
bindkey '^[[99;6u' zle-copy-to-clipboard
|
||||
bindkey '^[[118;6u' zle-paste-from-clipboard
|
||||
@ -265,6 +265,7 @@ __gradle_subcommand() {
|
||||
'-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]' \
|
||||
'-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
|
||||
'-Dorg.gradle.configureondemand=[Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]' \
|
||||
'-Dorg.gradle.console.unicode=[Specifies which character types are allowed in console output to generate. Values are 'auto' (default), 'disable' or 'enable'.]' \
|
||||
'-Dorg.gradle.console=[Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.]:org.gradle.console:(plain auto rich verbose)' \
|
||||
'-Dorg.gradle.continue=[Continue task execution after a task failure.]' \
|
||||
'-Dorg.gradle.continuous.quietperiod=[]' \
|
||||
@ -292,6 +293,7 @@ __gradle_subcommand() {
|
||||
'-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low']:org.gradle.priority:(normal low)' \
|
||||
'-Dorg.gradle.problems.report=[(Experimental) enables HTML problems report]' \
|
||||
'-Dorg.gradle.projectcachedir=[Specify the project-specific cache directory. Defaults to .gradle in the root project directory.]:org.gradle.projectcachedir:_directories' \
|
||||
'-Dorg.gradle.tooling.parallel=[]' \
|
||||
'-Dorg.gradle.unsafe.isolated-projects=[]' \
|
||||
'-Dorg.gradle.vfs.verbose=[]' \
|
||||
'-Dorg.gradle.vfs.watch=[Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.]:org.gradle.vfs.watch:(true false)' \
|
||||
@ -303,6 +305,7 @@ __gradle_subcommand() {
|
||||
'--configuration-cache-problems[Configures how the configuration cache handles problems (fail or warn). Defaults to fail.]:configuration cache problems:(fail warn)' \
|
||||
(--no-configure-on-demand)'--configure-on-demand[Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. (incubating)]' \
|
||||
'--console[Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.]:console:(plain auto rich verbose)' \
|
||||
'--console-unicode[Specifies which character types are allowed in console output to generate. Values are 'auto' (default), 'disable' or 'enable'.]' \
|
||||
(--no-continue)'--continue[Continue task execution after a task failure.]' \
|
||||
{-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
|
||||
(--no-daemon)'--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
|
||||
@ -344,7 +347,7 @@ __gradle_subcommand() {
|
||||
(--no-scan)'--scan[Generate a Build Scan (powered by Develocity).]' \
|
||||
{-V,--show-version}'[Print version info and continue.]' \
|
||||
(--full-stacktrace,-S){-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
|
||||
'--task-graph[(Experimental) Print task graph instead of executing tasks.]' \
|
||||
'--task-graph[Print task graph instead of executing tasks.]' \
|
||||
\*'--update-locks[Perform a partial update of the dependency lock, letting passed in module notations change version. (incubating)]' \
|
||||
(--quiet,-q,--info,-i,--debug,-d){-w,--warn}'[Set log level to warn.]' \
|
||||
'--warning-mode[Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none']:warning mode:(all summary none)' \
|
||||
@ -392,6 +395,7 @@ _gradle() {
|
||||
'-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]:->argument-expected' \
|
||||
'-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]:->argument-expected' \
|
||||
'-Dorg.gradle.configureondemand=[Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]:->argument-expected' \
|
||||
'-Dorg.gradle.console.unicode=[Specifies which character types are allowed in console output to generate. Values are 'auto' (default), 'disable' or 'enable'.]:->argument-expected' \
|
||||
'-Dorg.gradle.console=[Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.]:org.gradle.console:(plain auto rich verbose):->argument-expected' \
|
||||
'-Dorg.gradle.continue=[Continue task execution after a task failure.]:->argument-expected' \
|
||||
'-Dorg.gradle.continuous.quietperiod=[]:->argument-expected' \
|
||||
@ -419,6 +423,7 @@ _gradle() {
|
||||
'-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low']:org.gradle.priority:(normal low):->argument-expected' \
|
||||
'-Dorg.gradle.problems.report=[(Experimental) enables HTML problems report]:->argument-expected' \
|
||||
'-Dorg.gradle.projectcachedir=[Specify the project-specific cache directory. Defaults to .gradle in the root project directory.]:org.gradle.projectcachedir:_directories:->argument-expected' \
|
||||
'-Dorg.gradle.tooling.parallel=[]:->argument-expected' \
|
||||
'-Dorg.gradle.unsafe.isolated-projects=[]:->argument-expected' \
|
||||
'-Dorg.gradle.vfs.verbose=[]:->argument-expected' \
|
||||
'-Dorg.gradle.vfs.watch=[Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.]:org.gradle.vfs.watch:(true false):->argument-expected' \
|
||||
@ -430,6 +435,7 @@ _gradle() {
|
||||
'--configuration-cache-problems[Configures how the configuration cache handles problems (fail or warn). Defaults to fail.]:configuration cache problems:(fail warn):->argument-expected' \
|
||||
(--no-configure-on-demand)'--configure-on-demand[Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. (incubating)]' \
|
||||
'--console[Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.]:console:(plain auto rich verbose):->argument-expected' \
|
||||
'--console-unicode[Specifies which character types are allowed in console output to generate. Values are 'auto' (default), 'disable' or 'enable'.]:->argument-expected' \
|
||||
(--no-continue)'--continue[Continue task execution after a task failure.]' \
|
||||
{-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
|
||||
(--no-daemon)'--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
|
||||
@ -474,7 +480,7 @@ _gradle() {
|
||||
(--full-stacktrace,-S){-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
|
||||
'--status[Shows status of running and recently stopped Gradle daemon(s).]' \
|
||||
'--stop[Stops the Gradle daemon if it is running.]' \
|
||||
'--task-graph[(Experimental) Print task graph instead of executing tasks.]' \
|
||||
'--task-graph[Print task graph instead of executing tasks.]' \
|
||||
\*'--update-locks[Perform a partial update of the dependency lock, letting passed in module notations change version. (incubating)]' \
|
||||
{-v,--version}'[Print version info and exit.]' \
|
||||
(--quiet,-q,--info,-i,--debug,-d){-w,--warn}'[Set log level to warn.]' \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user