Add files via upload
This commit is contained in:
commit
1fb4d04787
6
configs/home/90-libinput.conf
Normal file
6
configs/home/90-libinput.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
Section "InputClass"
|
||||
Identifier "Default Pointer (libinput)"
|
||||
MatchDriver "libinput"
|
||||
MatchIsPointer "on"
|
||||
Option "AccelSpeed" "0"
|
||||
EndSection
|
6
scripts/Documents/Scripts/KVMStuff/w11mainkeyboard.xml
Normal file
6
scripts/Documents/Scripts/KVMStuff/w11mainkeyboard.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<hostdev mode='subsystem' type='usb' managed='no'>
|
||||
<source>
|
||||
<vendor id='0x258a'/>
|
||||
<product id='0x001a'/>
|
||||
</source>
|
||||
</hostdev>
|
6
scripts/Documents/Scripts/KVMStuff/w11mainmouse.xml
Normal file
6
scripts/Documents/Scripts/KVMStuff/w11mainmouse.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<hostdev mode='subsystem' type='usb' managed='no'>
|
||||
<source>
|
||||
<vendor id='0x1af3'/>
|
||||
<product id='0x0001'/>
|
||||
</source>
|
||||
</hostdev>
|
|
@ -0,0 +1,6 @@
|
|||
<hostdev mode='subsystem' type='usb' managed='no'>
|
||||
<source>
|
||||
<vendor id='0x413c'/>
|
||||
<product id='0x2107'/>
|
||||
</source>
|
||||
</hostdev>
|
6
scripts/Documents/Scripts/KVMStuff/w11secondarymouse.xml
Normal file
6
scripts/Documents/Scripts/KVMStuff/w11secondarymouse.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<hostdev mode='subsystem' type='usb' managed='no'>
|
||||
<source>
|
||||
<vendor id='0x04d9'/>
|
||||
<product id='0xa070'/>
|
||||
</source>
|
||||
</hostdev>
|
7
scripts/Documents/Scripts/attachmain.sh
Normal file
7
scripts/Documents/Scripts/attachmain.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
virsh attach-device Win10 /mnt/Usagichan/KVMstuff/w11mainkeyboard.xml
|
||||
virsh attach-device Win10 /mnt/Usagichan/KVMstuff/w11mainmouse.xml
|
||||
|
||||
virsh detach-device Win10 /mnt/Usagichan/KVMstuff/w11secondarykeyboard.xml
|
||||
virsh detach-device Win10 /mnt/Usagichan/KVMstuff/w11secondarymouse.xml
|
7
scripts/Documents/Scripts/attachsecondary.sh
Normal file
7
scripts/Documents/Scripts/attachsecondary.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
virsh detach-device Win10 ./KVMStuff/w11mainkeyboard.xml
|
||||
virsh detach-device Win10 ./KVMstuff/w11mainmouse.xml
|
||||
|
||||
virsh attach-device Win10 ./KVMStuff/w11secondarykeyboard.xml
|
||||
virsh attach-device Win10 ./KVMstuff/w11secondarymouse.xml
|
4
scripts/Documents/Scripts/cmusrefresh.sh
Normal file
4
scripts/Documents/Scripts/cmusrefresh.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
cmus-remote -C clear
|
||||
cmus-remote -C "add /mnt/Pyon/Music"
|
||||
cmus-remote -C "update-cache -f"
|
15
scripts/Documents/Scripts/keyboardlayout.sh
Normal file
15
scripts/Documents/Scripts/keyboardlayout.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#! /bin/bash
|
||||
|
||||
CURRENT_LAYOUT=$(setxkbmap -query|awk -F : 'NR==3{print $2}'|sed 's/ //g')
|
||||
|
||||
if [ "$CURRENT_LAYOUT" = "us" ]; then
|
||||
setxkbmap "cz(rus)"
|
||||
elif [ "$CURRENT_LAYOUT" = "cz(rus)" ]; then
|
||||
setxkbmap "fr(us)"
|
||||
elif [ "$CURRENT_LAYOUT" = "fr(us)" ]; then
|
||||
setxkbmap "fi(nodeadkeys)"
|
||||
elif [ "$CURRENT_LAYOUT" = "fi(nodeadkeys)" ]; then
|
||||
setxkbmap "us"
|
||||
fi
|
||||
|
||||
setxkbmap -option caps:swapescape
|
4
scripts/Documents/Scripts/perfgov.sh
Normal file
4
scripts/Documents/Scripts/perfgov.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done
|
||||
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
4
scripts/Documents/Scripts/schedutilgov.sh
Normal file
4
scripts/Documents/Scripts/schedutilgov.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "schedutil" > $file; done
|
||||
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
19
scripts/Documents/Scripts/screamloop.sh
Normal file
19
scripts/Documents/Scripts/screamloop.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/dash
|
||||
|
||||
killall -q scream
|
||||
trap "exit" INT TERM
|
||||
trap "kill 0" EXIT
|
||||
|
||||
theloop()
|
||||
{
|
||||
killall -q scream
|
||||
scream -i virbr0 &
|
||||
}
|
||||
|
||||
|
||||
while true
|
||||
do
|
||||
theloop
|
||||
sleep 300
|
||||
killall -q scream
|
||||
done
|
19
scripts/Documents/Scripts/zsh/zsh-autocomplete/LICENSE
Normal file
19
scripts/Documents/Scripts/zsh/zsh-autocomplete/LICENSE
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2020 Marlon Richert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
148
scripts/Documents/Scripts/zsh/zsh-autocomplete/README.md
Normal file
148
scripts/Documents/Scripts/zsh/zsh-autocomplete/README.md
Normal file
|
@ -0,0 +1,148 @@
|
|||
# `zsh-autocomplete`
|
||||
`zsh-autocomplete` adds **real-time type-ahead autocompletion** to Zsh. Find as you type, then
|
||||
press <kbd>Tab</kbd> to insert the top completion, <kbd>Shift</kbd><kbd>Tab</kbd> to insert the
|
||||
bottom one, or <kbd>↓</kbd>/<kbd>PgDn</kbd> to select another completion.
|
||||
|
||||
[![file-search](.img/file-search.gif)](https://asciinema.org/a/377611)
|
||||
|
||||
> Enjoy using this software? [Become a sponsor!](https://github.com/sponsors/marlonrichert).
|
||||
|
||||
## Other Features
|
||||
Besides live autocompletion, `zsh-autocomplete` comes with many other useful completion features.
|
||||
|
||||
### Optimized completion config
|
||||
Zsh's completion system is powerful, but hard to configure. So, `zsh-autocomplete` [does it for
|
||||
you](scripts/.autocomplete.config), while providing a manageable list of [configuration
|
||||
settings](.zshrc) for changing the defaults.
|
||||
|
||||
### Live history search
|
||||
Press <kbd>Ctrl</kbd><kbd>R</kbd> or <kbd>Ctrl</kbd><kbd>S</kbd> to do live, multi-line history
|
||||
search.
|
||||
|
||||
[![history-search](.img/history-search.gif)](https://asciinema.org/a/379844)
|
||||
|
||||
### History menu
|
||||
Press <kbd>↑</kbd> (or <kbd>Alt</kbd><kbd>↑</kbd> or <kbd>PgUp</kbd>) to open a menu with the last
|
||||
16 history items. If the command line is not empty, then the contents of the command line are used
|
||||
to perform a fuzzy history search.
|
||||
|
||||
![history menu](.img/history-menu.png)
|
||||
|
||||
### Multi-selection
|
||||
Press <kbd>Ctrl</kbd><kbd>Space</kbd> in the completion menu or the history menu to insert more
|
||||
than one item.
|
||||
|
||||
![multi-select](.img/multi-select.png)
|
||||
|
||||
### Recent dirs completion
|
||||
Works out of the box with zero configuration, but also supports `zsh-z`, `zoxide`, `z.lua`,
|
||||
`rupa/z.sh`, `autojump` and `fasd`.
|
||||
|
||||
![recent dirs](.img/recent-dirs.png)
|
||||
|
||||
## Key Bindings
|
||||
|
||||
On the command line:
|
||||
| Key(s) | Action | <sub>[Widget](.zshrc)</sub> |
|
||||
| ------ | ------ | --- |
|
||||
| <kbd>Tab</kbd> | Accept top completion | <sub>`complete-word`</sub> |
|
||||
| <kbd>Shift</kbd><kbd>Tab</kbd> | Accept bottom completion | <sub>`complete-word`</sub> |
|
||||
| <kbd>Ctrl</kbd><kbd>Space</kbd> | Show additional completions | <sub>`list-expand`</sub> |
|
||||
| <kbd>↓</kbd> | Cursor down (if able) or completion menu | <sub>`down-line-or-select`</sub> |
|
||||
| <kbd>PgDn</kbd> / <kbd>Alt</kbd><kbd>↓</kbd> | Completion menu (always) | <sub>`menu-select`</sub> |
|
||||
| <kbd>↑</kbd> | Cursor up (if able) or [history menu](#history-menu) | <sub>`up-line-or-search`</sub> |
|
||||
| <kbd>PgUp</kbd> / <kbd>Alt</kbd><kbd>↑</kbd> | [History menu](#history-menu) (always) | <sub>`history-search`</sub> |
|
||||
| <kbd>Ctrl</kbd><kbd>R</kbd> | [Live history search](#live-history-search), newest to oldest | <sub>`history-incremental-search-backward`</sub> |
|
||||
| <kbd>Ctrl</kbd><kbd>S</kbd> | [Live history search](#live-history-search), oldest to newest | <sub>`history-incremental-search-forward`</sub> |
|
||||
|
||||
In the completion menu:
|
||||
| Key(s) | Action |
|
||||
| ------ | ------ |
|
||||
| <kbd>↑</kbd> / <kbd>↓</kbd> / <kbd>←</kbd> / <kbd>→</kbd> | Change selection |
|
||||
| <kbd>Alt</kbd><kbd>↑</kbd> | Backward one group |
|
||||
| <kbd>Alt</kbd><kbd>↓</kbd> | Forward one group |
|
||||
| <kbd>PgUp</kbd> / <kbd>PgDn</kbd> | Page up/down |
|
||||
| <kbd>Ctrl</kbd><kbd>R</kbd> | Full text search or previous search match |
|
||||
| <kbd>Ctrl</kbd><kbd>S</kbd> | Full text search or next search match |
|
||||
| <kbd>Ctrl</kbd><kbd>Space</kbd> | Multi-select |
|
||||
| <kbd>Tab</kbd> | Accept selection |
|
||||
| <kbd>Shift</kbd><kbd>Tab</kbd> | Accept bottom completion |
|
||||
| <kbd>Enter</kbd> | Accept command line |
|
||||
| most other keys | Accept selection, then perform usual action |
|
||||
|
||||
In the history menu:
|
||||
| Key(s) | Action |
|
||||
| --- | --- |
|
||||
| <kbd>↑</kbd>/<kbd>↓</kbd> | Change selection |
|
||||
| <kbd>Ctrl</kbd><kbd>Space</kbd> | Multi-select |
|
||||
| <kbd>Tab</kbd> | Accept selection |
|
||||
| <kbd>Enter</kbd> | Accept command line |
|
||||
| most other keys | Accept selection, then perform usual action |
|
||||
|
||||
## Requirements
|
||||
Recommended:
|
||||
* Tested to work with [Zsh](http://zsh.sourceforge.net) 5.7 or newer.
|
||||
|
||||
Minimum:
|
||||
* Should theoretically work with Zsh 5.4 or newer, but I'm unable to test that.
|
||||
|
||||
## Installing & Updating
|
||||
If you use [Znap](https://github.com/marlonrichert/zsh-snap), simply add the following to your
|
||||
`.zshrc` file:
|
||||
```zsh
|
||||
znap source marlonrichert/zsh-autocomplete
|
||||
```
|
||||
Then restart your shell.
|
||||
|
||||
To update, do
|
||||
```zsh
|
||||
% znap pull
|
||||
```
|
||||
|
||||
For configuration options, see the included [`.zshrc` file](.zshrc).
|
||||
|
||||
To uninstall, remove `znap source marlonrichert/zsh-autocomplete` from your `.zshrc` file, then run
|
||||
```zsh
|
||||
% znap uninstall
|
||||
```
|
||||
|
||||
### Manual installation
|
||||
1. Clone the repo:
|
||||
```zsh
|
||||
% cd ~/Git # ...or wherever you keep your Git repos/Zsh plugins
|
||||
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
|
||||
```
|
||||
1. Add at or near the top of your `.zshrc` file (_before_ any calls to `compdef`):
|
||||
```zsh
|
||||
source ~/Git/zsh-autocomplete/zsh-autocomplete.plugin.zsh
|
||||
```
|
||||
1. Remove any calls to `compinit` from your `.zshrc` file.
|
||||
1. If you're using Ubuntu, add to your `.zshenv` file:
|
||||
```zsh
|
||||
skip_global_compinit=1
|
||||
```
|
||||
Then restart your shell.
|
||||
|
||||
To update, do:
|
||||
```zsh
|
||||
% git -C ~zsh-autocomplete pull
|
||||
```
|
||||
|
||||
To uninstall, simply undo the installation steps above in reverse order:
|
||||
1. Restore the lines you deleted in step 3.
|
||||
1. Delete the line you added in step 2.
|
||||
1. Delete the repo you created in step 1.
|
||||
Finally, restart your shell.
|
||||
|
||||
### Other Frameworks/Plugin Managers
|
||||
To install with another Zsh framework or plugin manager, please refer to your
|
||||
framework's/plugin manager's documentation for instructions.
|
||||
|
||||
## Troubleshooting
|
||||
Try the steps in the [bug report template](.github/ISSUE_TEMPLATE/bug-report.md).
|
||||
|
||||
## Author
|
||||
© 2020-2021 [Marlon Richert](https://github.com/marlonrichert)
|
||||
|
||||
## License
|
||||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
@ -0,0 +1,23 @@
|
|||
#autoload
|
||||
|
||||
[[ -v _autocomplete__partial_list || $curcontext == *history* ]] &&
|
||||
return 1
|
||||
|
||||
(( CURRENT > 1 && compstate[nmatches] > 1 )) ||
|
||||
return
|
||||
|
||||
if [[ $_completer == expand ]]; then
|
||||
_autocomplete.is_glob ||
|
||||
return
|
||||
else
|
||||
[[ $words[1] != cd ]] ||
|
||||
return
|
||||
[[ -n $_comp_tags ]] ||
|
||||
return
|
||||
[[ -z ${${=_comp_tags}[@]:#((local-|)directories|((all|globbed)-|)files)} ]] ||
|
||||
return
|
||||
fi
|
||||
|
||||
local -a expl=()
|
||||
_description all-matches expl 'all matches'
|
||||
builtin compadd "$expl[@]" -C
|
|
@ -0,0 +1,29 @@
|
|||
#autoload
|
||||
|
||||
(( compstate[nmatches] )) &&
|
||||
return 1
|
||||
|
||||
[[ $_comp_tags != (|* )(|local-)directories(| *) ]] &&
|
||||
return 1
|
||||
|
||||
local displ= expl=
|
||||
_description -V ancestor-directories expl 'ancestor directory'
|
||||
|
||||
local -Pa ancestors=()
|
||||
local -P parent=$PWD:h
|
||||
while (( $#parent > 1 )); do
|
||||
ancestors+=( $parent )
|
||||
parent=$parent:h
|
||||
done
|
||||
|
||||
local -Pi ret=1
|
||||
local -P a=
|
||||
for a in ${(aO)ancestors[@]}; do
|
||||
displ=( "$a" )
|
||||
[[ -z $PREFIX$SUFFIX ]] &&
|
||||
displ=( "$a:t" )
|
||||
compadd "$expl[@]" -d displ -P "${${(D)a:h}%/}/" -fW "${${a:h}%/}/" - "$a:t" &&
|
||||
ret=0
|
||||
done
|
||||
|
||||
return ret
|
|
@ -0,0 +1,7 @@
|
|||
#compdef -command-
|
||||
local -P ret=1
|
||||
_expand_alias "$@" &&
|
||||
ret=0
|
||||
_autocd "$@" &&
|
||||
ret=0
|
||||
return ret
|
|
@ -0,0 +1,10 @@
|
|||
#autoload
|
||||
|
||||
local -Pi len=$(( ${@[(i)(-|--)]} - 1 ))
|
||||
(( len < $# )) &&
|
||||
return len
|
||||
|
||||
len=${@[(I)-*]}
|
||||
[[ $@[len] == -*[PSpsiIdJVXxrRWFMOAD] ]] &&
|
||||
(( len++ ))
|
||||
return len
|
|
@ -0,0 +1,144 @@
|
|||
#autoload
|
||||
|
||||
_autocomplete.history_lines() {
|
||||
local -P tag=history-lines
|
||||
_tags $tag
|
||||
_tags ||
|
||||
return 1
|
||||
_requested $tag ||
|
||||
return 1
|
||||
|
||||
local -PA events=()
|
||||
local -Pi min_lines= max_lines=
|
||||
builtin zstyle -s ":autocomplete:${curcontext}:" list-lines min_lines ||
|
||||
min_lines=16
|
||||
(( max_lines = min( min_lines, HISTNO - 1, LINES - BUFFERLINES ) ))
|
||||
|
||||
if [[ -z $BUFFER ]]; then
|
||||
if [[ $curcontext == *-forward:* ]]; then
|
||||
local -Pi inc=1 histno=1
|
||||
else
|
||||
local -Pi inc=-1 histno=$(( HISTNO - 1 ))
|
||||
fi
|
||||
if [[ -o histfindnodups ]]; then
|
||||
while (( $#events[@] < max_lines && 0 < histno && histno < HISTNO )); do
|
||||
# -v's arg is a literal string, so we need to quote all characters.
|
||||
[[ -v history[$histno] && ! -v events[${(q)history[$histno]}] ]] &&
|
||||
events[$history[$histno]]=$histno
|
||||
(( histno += inc ))
|
||||
done
|
||||
events=( "${(@Oa)${(@kv)events}}" )
|
||||
else
|
||||
while (( $#events[@] < max_lines && 0 < histno && histno < HISTNO )); do
|
||||
[[ -v history[$histno] ]] &&
|
||||
events[$histno]="$history[$histno]"
|
||||
(( histno += inc ))
|
||||
done
|
||||
fi
|
||||
_comp_colors=( '(history-lines)=[[:space:]]#(#b)(<->) *=0=2' "$_comp_colors[@]" )
|
||||
else
|
||||
local -PaU queries=() err=( '(#ia'{0..$(( $#words[CURRENT] ))}')' )
|
||||
local -P query lbuffer= rbuffer=
|
||||
if [[ $WIDGET == (|*-)search(|-*) ]]; then
|
||||
queries=( \*$^err${(j:*:)${(0)words[CURRENT]}}\* )
|
||||
else
|
||||
lbuffer="${(j.[[:blank:]]##.)${(@b)words[1,CURRENT-1]}}"
|
||||
rbuffer="${(j.[[:blank:]]##.)${(@b)words[CURRENT+1,-1]}}"
|
||||
[[ -n $lbuffer ]] &&
|
||||
lbuffer="${lbuffer}[[:blank:]]##"
|
||||
[[ -n $rbuffer ]] &&
|
||||
rbuffer="[[:blank:]]##${rbuffer}"
|
||||
lbuffer="$lbuffer${(b)QIPREFIX}"
|
||||
rbuffer="${(b)QISUFFIX}$rbuffer"
|
||||
queries=( $lbuffer\*\($^err${words[CURRENT]}\)\*$rbuffer )
|
||||
fi
|
||||
if [[ -o histfindnodups ]]; then
|
||||
local -Pa numbers=()
|
||||
for query in $queries[@]; do
|
||||
numbers=( "${(@k)history[(R)$~query]}" )
|
||||
(( $#numbers[@] > 1 )) &&
|
||||
break
|
||||
done
|
||||
local -Pa lines=( "${(@v)history[(I)(${(~j:|:)numbers})]}" )
|
||||
if [[ $curcontext != *-forward:* ]]; then
|
||||
numbers=( "${(@Oa)numbers}" )
|
||||
lines=( "${(@Oa)lines}" )
|
||||
fi
|
||||
events=( "${(@)lines:^numbers}" )
|
||||
events=( "${(@Oa)${(@kv)events}}" )
|
||||
else
|
||||
for query in $queries[@]; do
|
||||
events=( "${(@kv)history[(R)$~query]}" )
|
||||
(( $#events[@] > 1 )) &&
|
||||
break
|
||||
done
|
||||
fi
|
||||
_comp_colors=(
|
||||
"(history-lines)=[[:space:]]#(#b)(<->) *(${${query#$lbuffer\*}%\*$rbuffer})*=0=2=30;103"
|
||||
"$_comp_colors[@]"
|
||||
)
|
||||
fi
|
||||
|
||||
(( $#events[@] )) ||
|
||||
return
|
||||
|
||||
local -a displays=()
|
||||
printf -v displays "%s:%s" "${(@kv)events}"
|
||||
displays=( "$displays[@]" )
|
||||
|
||||
local -Pi diff=$(( $#displays[@] - max_lines ))
|
||||
local -P suf=
|
||||
if [[ $WIDGET == (|*-)search(|-*) ]]; then
|
||||
displays=( ${(@n)displays} )
|
||||
(( diff > 0 )) &&
|
||||
shift "$diff" displays
|
||||
suf=';'
|
||||
else
|
||||
if [[ $curcontext == *-forward:* ]]; then
|
||||
displays=( ${(@n)displays} )
|
||||
else
|
||||
displays=( ${(@On)displays} )
|
||||
fi
|
||||
(( diff > 0 )) &&
|
||||
shift -p "$diff" displays
|
||||
suf=' '
|
||||
fi
|
||||
|
||||
local -a matches=( "${displays[@]##[[:blank:]]#<->:}" )
|
||||
[[ $WIDGET != (|*-)search(|-*) ]] &&
|
||||
matches=( "${(@)${(@)matches[@]##$~lbuffer}%%$~rbuffer}" )
|
||||
|
||||
local -Pa match=() mbegin=() mend=()
|
||||
displays=(
|
||||
"${(@r:COLUMNS-1:)displays[@]/%(#b)(<->):(*)/${(l:$#HISTNO:)match[1]} ${(V)${(Z+C+)match[2]}}}"
|
||||
)
|
||||
|
||||
local -a expl=()
|
||||
local _comp_no_ignore=1
|
||||
_description -2V "$tag" expl 'history line'
|
||||
builtin compadd "$expl[@]" -S "$suf" -R _autocomplete.history_lines.suffix \
|
||||
-QU -ld displays -a matches
|
||||
}
|
||||
# functions -T _autocomplete.history_lines
|
||||
|
||||
_autocomplete.history_lines.suffix() {
|
||||
case $WIDGET in
|
||||
( (|.|*-)(hist(|ory)|search|delete|kill)(|-*) )
|
||||
;;
|
||||
( (|.)(self-insert(|-*)|magic-space) )
|
||||
case $KEYS[-1] in
|
||||
( [$ZLE_SPACE_SUFFIX_CHARS$ZLE_REMOVE_SUFFIX_CHARS] )
|
||||
LBUFFER=$LBUFFER[1,-1-$1]
|
||||
;|
|
||||
( [$ZLE_SPACE_SUFFIX_CHARS] )
|
||||
LBUFFER+=' '
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
( * )
|
||||
LBUFFER=$LBUFFER[1,-1-$1]
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_autocomplete.history_lines "$@"
|
|
@ -0,0 +1,12 @@
|
|||
#autoload
|
||||
zmodload -F zsh/parameter p:patchars
|
||||
|
||||
local word=$PREFIX$SUFFIX
|
||||
if [[ $word == ${~${(q)word}} &&
|
||||
$word == (*(${(~j:|:)patchars[@]:#\~}})*|?*(${(~j:|:)patchars})*) ]]; then
|
||||
reply=( yes )
|
||||
true
|
||||
else
|
||||
reply=( no )
|
||||
false
|
||||
fi
|
|
@ -0,0 +1,56 @@
|
|||
#autoload
|
||||
zmodload -F zsh/parameter p:functions
|
||||
|
||||
_autocomplete.recent_paths() {
|
||||
(( compstate[nmatches] )) &&
|
||||
return 1
|
||||
|
||||
local -PaU files=()
|
||||
local -Pi ret=1
|
||||
local -P tag=
|
||||
for tag in directories files; do
|
||||
if [[ -v functions[_autocomplete.recent_$tag] &&
|
||||
$_comp_tags == (|* )(|(all|local)-)$tag(| *) ]] &&
|
||||
_autocomplete.recent_$tag "$PREFIX$SUFFIX"; then
|
||||
files=( "$reply[@]" )
|
||||
_description -V recent-$tag expl 'recent directory'
|
||||
.autocomplete.recent_paths.add $files[@] &&
|
||||
ret=0
|
||||
fi
|
||||
done
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
.autocomplete.recent_paths.add() {
|
||||
local -a displ=() matches=( "$@" )
|
||||
builtin compadd "$expl[@]" -D matches -- "$@:t"
|
||||
displ=( "${(@D)matches}" )
|
||||
zformat -a displ '' $^displ':'
|
||||
|
||||
.autocomplete.recent_paths.trim
|
||||
|
||||
local -Pi ret=1
|
||||
|
||||
# Work around `setopt autonamedirs` by not assigning absolute paths to scalars.
|
||||
while (( $#matches )); do
|
||||
(( $#displ[1] > 1 )) &&
|
||||
compadd "$expl[@]" -d displ -P "${${(D)matches[1]:h}%/}/" -fW "${${matches[1]:h}%/}/" \
|
||||
-- "$matches[1]:t" &&
|
||||
ret=0
|
||||
shift -- displ matches
|
||||
done
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# Workaround to prevent the prompt from jumping
|
||||
.autocomplete.recent_paths.trim() {
|
||||
local -P total="${(j:/ :)displ}/ "
|
||||
while (( $#total > COLUMNS )); do
|
||||
shift -p -- displ matches
|
||||
total="${(j:/ :)displ}/ "
|
||||
done
|
||||
}
|
||||
|
||||
_autocomplete.recent_paths "$@"
|
|
@ -0,0 +1,22 @@
|
|||
#autoload
|
||||
|
||||
local -P tag=requoted
|
||||
_tags $tag
|
||||
_tags && _requested $tag ||
|
||||
return 1
|
||||
|
||||
(( compstate[nmatches] > 1 )) &&
|
||||
return 1
|
||||
_autocomplete.is_glob &&
|
||||
return 1
|
||||
[[ $_completer == expand ]] ||
|
||||
return 1
|
||||
|
||||
local -P match=${(Q)compstate[unambiguous]}
|
||||
|
||||
[[ $match == ($words[CURRENT]|$compstate[unambiguous]) ]] &&
|
||||
return 1
|
||||
|
||||
local -a expl display=( "$match" )
|
||||
_description $tag expl 'human-readable'
|
||||
compadd "$expl[@]" -qS ' ' -QU -d display - ${(q+)match}
|
|
@ -0,0 +1,35 @@
|
|||
#autoload
|
||||
# setopt localoptions verbose xtrace
|
||||
|
||||
[[ -v _autocomplete__partial_list ]] &&
|
||||
return 1
|
||||
|
||||
(( compstate[nmatches] > 1 )) ||
|
||||
return 1
|
||||
[[ $curcontext == history-*:* ||
|
||||
$IPREFIX$PREFIX$SUFFIX$ISUFFIX == *${compstate[unambiguous]:#?}* ]] &&
|
||||
return 1
|
||||
|
||||
local -P tag=unambiguous
|
||||
_tags $tag
|
||||
_tags ||
|
||||
return
|
||||
_requested $tag ||
|
||||
return
|
||||
|
||||
typeset -gH _autocomplete__unambiguous="$compstate[unambiguous]"
|
||||
|
||||
if builtin zstyle -t :autocomplete:tab: insert-unambiguous; then
|
||||
local -Pi nxt= prv=1
|
||||
local -P subs= cols=
|
||||
for nxt in ${(s.:.)compstate[unambiguous_positions]}; do
|
||||
subs+='('${(b)compstate[unambiguous][prv,nxt]}')*'
|
||||
cols+='=30;103' # black foreground, bright yellow background
|
||||
(( prv = ++nxt ))
|
||||
done
|
||||
ZLS_COLORS="=(#bi)*$subs=$cols:$ZLS_COLORS"
|
||||
return 1
|
||||
fi
|
||||
|
||||
builtin compadd -J "$tag" \
|
||||
-x $'%{\e[0;2m%}common substring:%b %F{0}%K{11}'"$compstate[unambiguous]%f%k"
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/zsh -f
|
||||
print $VENDOR $OSTYPE =zsh $ZSH_VERSION $ZSH_PATCHLEVEL =clitest
|
||||
FPATH=$FPATH zsh -f =clitest --list-run --progress dot --prompt '%' -- ${0:h}/.clitest/*.md
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/zsh
|
||||
zmodload -F zsh/parameter p:funcfiletrace p:functions
|
||||
|
||||
# Workaround for https://github.com/zdharma/zinit/issues/366
|
||||
# NOTE: Needs to come before _everything_ else!
|
||||
[[ -v functions[.zinit-shade-off] ]] &&
|
||||
.zinit-shade-off "${___mode:-load}"
|
||||
[[ -v functions[.zinit-tmp-subst-off] ]] &&
|
||||
.zinit-tmp-subst-off "${___mode:-load}"
|
||||
|
||||
zmodload zsh/param/private
|
||||
setopt NO_flowcontrol NO_listbeep NO_singlelinezle
|
||||
typeset -gHa _autocomplete__funcfiletrace=( $funcfiletrace[2,-2] )
|
||||
builtin autoload +X -Uz ${${(%):-%x}:P:h}/scripts/.autocomplete.__init__
|
||||
{
|
||||
.autocomplete.__init__ "$@"
|
||||
} always {
|
||||
unfunction .autocomplete.__init__
|
||||
}
|
Loading…
Reference in a new issue