[zsh] Bump oh-my-zsh and fzf
This commit is contained in:
parent
de9c84286f
commit
f0e9815af8
50 changed files with 1219 additions and 711 deletions
|
@ -17,21 +17,19 @@ make
|
|||
# Build fzf binary and copy it to bin directory
|
||||
make install
|
||||
|
||||
# Build 32-bit and 64-bit executables and tarballs in target
|
||||
# Build fzf binaries and archives for all platforms using goreleaser
|
||||
make build
|
||||
|
||||
# Publish GitHub release
|
||||
make release
|
||||
|
||||
# Make release archives for all supported platforms in target
|
||||
make release-all
|
||||
```
|
||||
|
||||
### Using `go get`
|
||||
|
||||
Alternatively, you can build fzf directly with `go get` command without
|
||||
manually cloning the repository.
|
||||
|
||||
```sh
|
||||
go get -u github.com/junegunn/fzf
|
||||
```
|
||||
> :warning: Makefile uses git commands to determine the version and the
|
||||
> revision information for `fzf --version`. So if you're building fzf from an
|
||||
> environment where its git information is not available, you have to manually
|
||||
> set `$FZF_VERSION` and `$FZF_REVISION`.
|
||||
>
|
||||
> e.g. `FZF_VERSION=0.24.0 FZF_REVISION=tarball make`
|
||||
|
||||
Third-party libraries used
|
||||
--------------------------
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
0.24.3
|
||||
------
|
||||
- Added `--padding` option
|
||||
```sh
|
||||
fzf --margin 5% --padding 5% --border --preview 'cat {}' \
|
||||
--color bg:#222222,preview-bg:#333333
|
||||
```
|
||||
|
||||
0.24.2
|
||||
------
|
||||
- Bug fixes and improvements
|
||||
|
||||
0.24.1
|
||||
------
|
||||
- Fixed broken `--color=[bw|no]` option
|
||||
|
||||
0.24.0
|
||||
------
|
||||
- Real-time rendering of preview window
|
||||
|
@ -23,10 +39,30 @@ CHANGELOG
|
|||
# * Italic style may not be supported by some terminals
|
||||
rg --line-number --no-heading --color=always "" |
|
||||
fzf --ansi --prompt "Rg: " \
|
||||
--color fg+:italic,hl:underline:-1,hl+:underline:reverse:-1 \
|
||||
--color fg+:italic,hl:underline:-1,hl+:italic:underline:reverse:-1 \
|
||||
--color pointer:reverse,prompt:reverse,input:159 \
|
||||
--pointer ' '
|
||||
```
|
||||
- More `--border` options
|
||||
- `vertical`, `top`, `bottom`, `left`, `right`
|
||||
- Updated Vim plugin to use these new `--border` options
|
||||
```vim
|
||||
" Floating popup window in the center of the screen
|
||||
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
|
||||
|
||||
" Popup with 100% width
|
||||
let g:fzf_layout = { 'window': { 'width': 1.0, 'height': 0.5, 'border': 'horizontal' } }
|
||||
|
||||
" Popup with 100% height
|
||||
let g:fzf_layout = { 'window': { 'width': 0.5, 'height': 1.0, 'border': 'vertical' } }
|
||||
|
||||
" Similar to 'down' layout, but it uses a popup window and doesn't affect the window layout
|
||||
let g:fzf_layout = { 'window': { 'width': 1.0, 'height': 0.5, 'yoffset': 1.0, 'border': 'top' } }
|
||||
|
||||
" Opens on the right;
|
||||
" 'highlight' option is still supported but it will only take the foreground color of the group
|
||||
let g:fzf_layout = { 'window': { 'width': 0.5, 'height': 1.0, 'xoffset': 1.0, 'border': 'left', 'highlight': 'Comment' } }
|
||||
```
|
||||
- To indicate if `--multi` mode is enabled, fzf will print the number of
|
||||
selected items even when no item is selected
|
||||
```sh
|
||||
|
@ -37,6 +73,7 @@ CHANGELOG
|
|||
seq 100 | fzf --multi 5
|
||||
# 100/100 (0/5)
|
||||
```
|
||||
- Since 0.24.0, release binaries will be uploaded to https://github.com/junegunn/fzf/releases
|
||||
|
||||
0.23.1
|
||||
------
|
||||
|
|
102
dot_fzf/Makefile
102
dot_fzf/Makefile
|
@ -5,8 +5,26 @@ MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))
|
|||
ROOT_DIR := $(shell dirname $(MAKEFILE))
|
||||
SOURCES := $(wildcard *.go src/*.go src/*/*.go) $(MAKEFILE)
|
||||
|
||||
REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES))
|
||||
BUILD_FLAGS := -a -ldflags "-X main.revision=$(REVISION) -w '-extldflags=$(LDFLAGS)'" -tags "$(TAGS)"
|
||||
ifdef FZF_VERSION
|
||||
VERSION := $(FZF_VERSION)
|
||||
else
|
||||
VERSION := $(shell git describe --abbrev=0 2> /dev/null)
|
||||
endif
|
||||
ifeq ($(VERSION),)
|
||||
$(error Not on git repository; cannot determine $$FZF_VERSION)
|
||||
endif
|
||||
VERSION_TRIM := $(shell sed "s/-.*//" <<< $(VERSION))
|
||||
VERSION_REGEX := $(subst .,\.,$(VERSION_TRIM))
|
||||
|
||||
ifdef FZF_REVISION
|
||||
REVISION := $(FZF_REVISION)
|
||||
else
|
||||
REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES) 2> /dev/null)
|
||||
endif
|
||||
ifeq ($(REVISION),)
|
||||
$(error Not on git repository; cannot determine $$FZF_REVISION)
|
||||
endif
|
||||
BUILD_FLAGS := -a -ldflags "-s -w -X main.version=$(VERSION) -X main.revision=$(REVISION)" -tags "$(TAGS)"
|
||||
|
||||
BINARY64 := fzf-$(GOOS)_amd64
|
||||
BINARYARM5 := fzf-$(GOOS)_arm5
|
||||
|
@ -14,13 +32,6 @@ BINARYARM6 := fzf-$(GOOS)_arm6
|
|||
BINARYARM7 := fzf-$(GOOS)_arm7
|
||||
BINARYARM8 := fzf-$(GOOS)_arm8
|
||||
BINARYPPC64LE := fzf-$(GOOS)_ppc64le
|
||||
VERSION := $(shell awk -F= '/version =/ {print $$2}' src/constants.go | tr -d "\" ")
|
||||
RELEASE64 := fzf-$(VERSION)-$(GOOS)_amd64
|
||||
RELEASEARM5 := fzf-$(VERSION)-$(GOOS)_arm5
|
||||
RELEASEARM6 := fzf-$(VERSION)-$(GOOS)_arm6
|
||||
RELEASEARM7 := fzf-$(VERSION)-$(GOOS)_arm7
|
||||
RELEASEARM8 := fzf-$(VERSION)-$(GOOS)_arm8
|
||||
RELEASEPPC64LE := fzf-$(VERSION)-$(GOOS)_ppc64le
|
||||
|
||||
# https://en.wikipedia.org/wiki/Uname
|
||||
UNAME_M := $(shell uname -m)
|
||||
|
@ -41,40 +52,11 @@ else ifeq ($(UNAME_M),aarch64)
|
|||
else ifeq ($(UNAME_M),ppc64le)
|
||||
BINARY := $(BINARYPPC64LE)
|
||||
else
|
||||
$(error "Build on $(UNAME_M) is not supported, yet.")
|
||||
$(error Build on $(UNAME_M) is not supported, yet.)
|
||||
endif
|
||||
|
||||
all: target/$(BINARY)
|
||||
|
||||
target:
|
||||
mkdir -p $@
|
||||
|
||||
ifeq ($(GOOS),windows)
|
||||
release: target/$(BINARY64)
|
||||
cd target && cp -f $(BINARY64) fzf.exe && zip $(RELEASE64).zip fzf.exe
|
||||
cd target && rm -f fzf.exe
|
||||
else ifeq ($(GOOS),linux)
|
||||
release: target/$(BINARY64) target/$(BINARYARM5) target/$(BINARYARM6) target/$(BINARYARM7) target/$(BINARYARM8) target/$(BINARYPPC64LE)
|
||||
cd target && cp -f $(BINARY64) fzf && tar -czf $(RELEASE64).tgz fzf
|
||||
cd target && cp -f $(BINARYARM5) fzf && tar -czf $(RELEASEARM5).tgz fzf
|
||||
cd target && cp -f $(BINARYARM6) fzf && tar -czf $(RELEASEARM6).tgz fzf
|
||||
cd target && cp -f $(BINARYARM7) fzf && tar -czf $(RELEASEARM7).tgz fzf
|
||||
cd target && cp -f $(BINARYARM8) fzf && tar -czf $(RELEASEARM8).tgz fzf
|
||||
cd target && cp -f $(BINARYPPC64LE) fzf && tar -czf $(RELEASEPPC64LE).tgz fzf
|
||||
cd target && rm -f fzf
|
||||
else
|
||||
release: target/$(BINARY64)
|
||||
cd target && cp -f $(BINARY64) fzf && tar -czf $(RELEASE64).tgz fzf
|
||||
cd target && rm -f fzf
|
||||
endif
|
||||
|
||||
release-all: clean test
|
||||
GOOS=darwin make release
|
||||
GOOS=linux make release
|
||||
GOOS=freebsd make release
|
||||
GOOS=openbsd make release
|
||||
GOOS=windows make release
|
||||
|
||||
test: $(SOURCES)
|
||||
SHELL=/bin/sh GOOS= $(GO) test -v -tags "$(TAGS)" \
|
||||
github.com/junegunn/fzf/src \
|
||||
|
@ -84,8 +66,46 @@ test: $(SOURCES)
|
|||
|
||||
install: bin/fzf
|
||||
|
||||
build:
|
||||
goreleaser --rm-dist --snapshot
|
||||
|
||||
release:
|
||||
ifndef GITHUB_TOKEN
|
||||
$(error GITHUB_TOKEN is not defined)
|
||||
endif
|
||||
|
||||
# Check if we are on master branch
|
||||
ifneq ($(shell git symbolic-ref --short HEAD),master)
|
||||
$(error Not on master branch)
|
||||
endif
|
||||
|
||||
# Check if version numbers are properly updated
|
||||
grep -q ^$(VERSION_REGEX)$$ CHANGELOG.md
|
||||
grep -qF '"fzf $(VERSION_TRIM)"' man/man1/fzf.1
|
||||
grep -qF '"fzf $(VERSION_TRIM)"' man/man1/fzf-tmux.1
|
||||
grep -qF $(VERSION) install
|
||||
grep -qF $(VERSION) install.ps1
|
||||
|
||||
# Make release note out of CHANGELOG.md
|
||||
sed -n '/^$(VERSION_REGEX)$$/,/^[0-9]/p' CHANGELOG.md | tail -r | \
|
||||
sed '1,/^ *$$/d' | tail -r | sed 1,2d | tee tmp/release-note
|
||||
|
||||
# Push to temp branch first so that install scripts always works on master branch
|
||||
git checkout -B temp master
|
||||
git push origin temp --follow-tags --force
|
||||
|
||||
# Make a GitHub release
|
||||
goreleaser --rm-dist --release-notes tmp/release-note
|
||||
|
||||
# Push to master
|
||||
git checkout master
|
||||
git push origin master
|
||||
|
||||
# Delete temp branch
|
||||
git push origin --delete temp
|
||||
|
||||
clean:
|
||||
$(RM) -r target
|
||||
$(RM) -r dist target
|
||||
|
||||
target/$(BINARY64): $(SOURCES)
|
||||
GOARCH=amd64 $(GO) build $(BUILD_FLAGS) -o $@
|
||||
|
@ -121,4 +141,4 @@ update:
|
|||
$(GO) get -u
|
||||
$(GO) mod tidy
|
||||
|
||||
.PHONY: all release release-all test install clean docker docker-test update
|
||||
.PHONY: all build release test install clean docker docker-test update
|
||||
|
|
|
@ -298,9 +298,8 @@ following options are allowed:
|
|||
- Optional:
|
||||
- `yoffset` [float default 0.5 range [0 ~ 1]]
|
||||
- `xoffset` [float default 0.5 range [0 ~ 1]]
|
||||
- `highlight` [string default `'Comment'`]: Highlight group for border
|
||||
- `border` [string default `rounded`]: Border style
|
||||
- `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right`
|
||||
- `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]`
|
||||
|
||||
`fzf#wrap`
|
||||
----------
|
||||
|
|
|
@ -82,7 +82,7 @@ fzf project consists of the following components:
|
|||
You can [download fzf executable][bin] alone if you don't need the extra
|
||||
stuff.
|
||||
|
||||
[bin]: https://github.com/junegunn/fzf-bin/releases
|
||||
[bin]: https://github.com/junegunn/fzf/releases
|
||||
|
||||
### Using Homebrew or Linuxbrew
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
bin/fzf
|
||||
bin/fzf.exe
|
||||
dist
|
||||
target
|
||||
pkg
|
||||
Gemfile.lock
|
||||
|
@ -9,3 +10,5 @@ vendor
|
|||
gopath
|
||||
*.zwc
|
||||
fzf
|
||||
tmp
|
||||
*.patch
|
||||
|
|
11
dot_fzf/dot_gon.hcl
Normal file
11
dot_fzf/dot_gon.hcl
Normal file
|
@ -0,0 +1,11 @@
|
|||
source = ["./dist/fzf-macos_darwin_amd64/fzf"]
|
||||
bundle_id = "kr.junegunn.fzf"
|
||||
|
||||
apple_id {
|
||||
username = "junegunn.c@gmail.com"
|
||||
password = "@env:AC_PASSWORD"
|
||||
}
|
||||
|
||||
sign {
|
||||
application_identity = "Apple Development: junegunn.c@gmail.com"
|
||||
}
|
69
dot_fzf/dot_goreleaser.yml
Normal file
69
dot_fzf/dot_goreleaser.yml
Normal file
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
project_name: fzf
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod download
|
||||
|
||||
builds:
|
||||
- id: fzf-macos
|
||||
binary: fzf
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
ldflags:
|
||||
- "-s -w -X main.version={{ .Version }} -X main.revision={{ .ShortCommit }}"
|
||||
hooks:
|
||||
post: gon .gon.hcl
|
||||
|
||||
- goos:
|
||||
- linux
|
||||
- windows
|
||||
- freebsd
|
||||
- openbsd
|
||||
goarch:
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
goarm:
|
||||
- 5
|
||||
- 6
|
||||
- 7
|
||||
ldflags:
|
||||
- "-s -w -X main.version={{ .Version }} -X main.revision={{ .ShortCommit }}"
|
||||
ignore:
|
||||
- goos: freebsd
|
||||
goarch: arm
|
||||
- goos: openbsd
|
||||
goarch: arm
|
||||
- goos: freebsd
|
||||
goarch: arm64
|
||||
- goos: openbsd
|
||||
goarch: arm64
|
||||
|
||||
archives:
|
||||
- name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
|
||||
format: tar.gz
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
files:
|
||||
- non-existent*
|
||||
|
||||
release:
|
||||
github:
|
||||
owner: junegunn
|
||||
name: fzf
|
||||
prerelease: auto
|
||||
name_template: '{{ .Tag }}'
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-devel"
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- README
|
||||
- test
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
set -u
|
||||
|
||||
version=0.23.1
|
||||
version=0.24.3
|
||||
auto_completion=
|
||||
key_bindings=
|
||||
update_config=2
|
||||
binary_arch=
|
||||
shells="bash zsh fish"
|
||||
prefix='~/.fzf'
|
||||
prefix_expand=~/.fzf
|
||||
|
@ -115,7 +114,7 @@ link_fzf_in_path() {
|
|||
|
||||
try_curl() {
|
||||
command -v curl > /dev/null &&
|
||||
if [[ $1 =~ tgz$ ]]; then
|
||||
if [[ $1 =~ tar.gz$ ]]; then
|
||||
curl -fL $1 | tar -xzf -
|
||||
else
|
||||
local temp=${TMPDIR:-/tmp}/fzf.zip
|
||||
|
@ -125,7 +124,7 @@ try_curl() {
|
|||
|
||||
try_wget() {
|
||||
command -v wget > /dev/null &&
|
||||
if [[ $1 =~ tgz$ ]]; then
|
||||
if [[ $1 =~ tar.gz$ ]]; then
|
||||
wget -O - $1 | tar -xzf -
|
||||
else
|
||||
local temp=${TMPDIR:-/tmp}/fzf.zip
|
||||
|
@ -135,13 +134,11 @@ try_wget() {
|
|||
|
||||
download() {
|
||||
echo "Downloading bin/fzf ..."
|
||||
if [[ ! "$version" =~ alpha ]]; then
|
||||
if [ -x "$fzf_base"/bin/fzf ]; then
|
||||
echo " - Already exists"
|
||||
check_binary && return
|
||||
fi
|
||||
link_fzf_in_path && return
|
||||
if [ -x "$fzf_base"/bin/fzf ]; then
|
||||
echo " - Already exists"
|
||||
check_binary && return
|
||||
fi
|
||||
link_fzf_in_path && return
|
||||
mkdir -p "$fzf_base"/bin && cd "$fzf_base"/bin
|
||||
if [ $? -ne 0 ]; then
|
||||
binary_error="Failed to create bin directory"
|
||||
|
@ -149,9 +146,7 @@ download() {
|
|||
fi
|
||||
|
||||
local url
|
||||
[[ "$version" =~ alpha ]] &&
|
||||
url=https://github.com/junegunn/fzf-bin/releases/download/alpha/${1} ||
|
||||
url=https://github.com/junegunn/fzf-bin/releases/download/$version/${1}
|
||||
url=https://github.com/junegunn/fzf/releases/download/$version/${1}
|
||||
set -o pipefail
|
||||
if ! (try_curl $url || try_wget $url); then
|
||||
set +o pipefail
|
||||
|
@ -173,20 +168,20 @@ archi=$(uname -sm)
|
|||
binary_available=1
|
||||
binary_error=""
|
||||
case "$archi" in
|
||||
Darwin\ *64) download fzf-$version-darwin_${binary_arch:-amd64}.tgz ;;
|
||||
Linux\ armv5*) download fzf-$version-linux_${binary_arch:-arm5}.tgz ;;
|
||||
Linux\ armv6*) download fzf-$version-linux_${binary_arch:-arm6}.tgz ;;
|
||||
Linux\ armv7*) download fzf-$version-linux_${binary_arch:-arm7}.tgz ;;
|
||||
Linux\ armv8*) download fzf-$version-linux_${binary_arch:-arm8}.tgz ;;
|
||||
Linux\ aarch64*) download fzf-$version-linux_${binary_arch:-arm8}.tgz ;;
|
||||
Linux\ *64) download fzf-$version-linux_${binary_arch:-amd64}.tgz ;;
|
||||
FreeBSD\ *64) download fzf-$version-freebsd_${binary_arch:-amd64}.tgz ;;
|
||||
OpenBSD\ *64) download fzf-$version-openbsd_${binary_arch:-amd64}.tgz ;;
|
||||
CYGWIN*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;
|
||||
MINGW*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;
|
||||
MSYS*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;
|
||||
Windows*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;
|
||||
*) binary_available=0 binary_error=1 ;;
|
||||
Darwin\ *64) download fzf-$version-darwin_amd64.tar.gz ;;
|
||||
Linux\ armv5*) download fzf-$version-linux_armv5.tar.gz ;;
|
||||
Linux\ armv6*) download fzf-$version-linux_armv6.tar.gz ;;
|
||||
Linux\ armv7*) download fzf-$version-linux_armv7.tar.gz ;;
|
||||
Linux\ armv8*) download fzf-$version-linux_arm64.tar.gz ;;
|
||||
Linux\ aarch64*) download fzf-$version-linux_arm64.tar.gz ;;
|
||||
Linux\ *64) download fzf-$version-linux_amd64.tar.gz ;;
|
||||
FreeBSD\ *64) download fzf-$version-freebsd_amd64.tar.gz ;;
|
||||
OpenBSD\ *64) download fzf-$version-openbsd_amd64.tar.gz ;;
|
||||
CYGWIN*\ *64) download fzf-$version-windows_amd64.zip ;;
|
||||
MINGW*\ *64) download fzf-$version-windows_amd64.zip ;;
|
||||
MSYS*\ *64) download fzf-$version-windows_amd64.zip ;;
|
||||
Windows*\ *64) download fzf-$version-windows_amd64.zip ;;
|
||||
*) binary_available=0 binary_error=1 ;;
|
||||
esac
|
||||
|
||||
cd "$fzf_base"
|
||||
|
@ -202,7 +197,7 @@ if [ -n "$binary_error" ]; then
|
|||
export GOPATH="${TMPDIR:-/tmp}/fzf-gopath"
|
||||
mkdir -p "$GOPATH"
|
||||
fi
|
||||
if go get -u github.com/junegunn/fzf; then
|
||||
if go get -ldflags "-s -w -X main.version=$version -X main.revision=go-get" github.com/junegunn/fzf; then
|
||||
echo "OK"
|
||||
cp "$GOPATH/bin/fzf" "$fzf_base/bin/"
|
||||
else
|
||||
|
|
|
@ -2,14 +2,14 @@ module github.com/junegunn/fzf
|
|||
|
||||
require (
|
||||
github.com/gdamore/tcell v1.4.0
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
github.com/mattn/go-runewidth v0.0.9
|
||||
github.com/mattn/go-shellwords v1.0.9
|
||||
github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e
|
||||
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
|
||||
golang.org/x/text v0.3.2 // indirect
|
||||
github.com/mattn/go-shellwords v1.0.10
|
||||
github.com/saracen/walker v0.1.1
|
||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 // indirect
|
||||
golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1
|
||||
golang.org/x/text v0.3.3 // indirect
|
||||
)
|
||||
|
||||
go 1.13
|
||||
|
|
|
@ -1,47 +1,35 @@
|
|||
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU=
|
||||
github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
|
||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
|
||||
github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-shellwords v1.0.9 h1:eaB5JspOwiKKcHdqcjbfe5lA9cNn/4NRRtddXJCimqk=
|
||||
github.com/mattn/go-shellwords v1.0.9/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
||||
github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e h1:NO86zOn5ScSKW8wRbMaSIcjDZUFpWdCQQnexRqZ9h9A=
|
||||
github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e/go.mod h1:G0Z6yVPru183i2MuRJx1DcR4dgIZtLcTdaaE/pC1BJU=
|
||||
github.com/mattn/go-shellwords v1.0.10 h1:Y7Xqm8piKOO3v10Thp7Z36h4FYFjt5xB//6XvOrs2Gw=
|
||||
github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
||||
github.com/saracen/walker v0.1.1 h1:Ou2QIKTWqo0QxhtuHVmtObbmhjMCEUyJ82xp0uV+MGI=
|
||||
github.com/saracen/walker v0.1.1/go.mod h1:0oKYMsKVhSJ+ful4p/XbjvXbMgLEkLITZaxozsl4CGE=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d h1:9FCpayM9Egr1baVnV1SX0H87m+XB0B8S0hAMi99X/3U=
|
||||
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
|
||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1 h1:/DtoiOYKoQCcIFXQjz07RnWNPRCbqmSXSpgEzhC9ZHM=
|
||||
golang.org/x/sys v0.0.0-20201026173827-119d4633e4d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191011211836-4c025a95b26e h1:1o2bDs9pCd2xFhdwqJTrCIswAeEsn4h/PCNelWpfcsI=
|
||||
golang.org/x/tools v0.0.0-20191011211836-4c025a95b26e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
$version="0.23.1"
|
||||
|
||||
if ([Environment]::Is64BitProcess) {
|
||||
$binary_arch="amd64"
|
||||
} else {
|
||||
$binary_arch="386"
|
||||
}
|
||||
$version="0.24.3"
|
||||
|
||||
$fzf_base=Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
|
||||
|
@ -32,12 +26,10 @@ function check_binary () {
|
|||
function download {
|
||||
param($file)
|
||||
Write-Host "Downloading bin/fzf ..."
|
||||
if ("$version" -ne "alpha") {
|
||||
if (Test-Path "$fzf_base\bin\fzf.exe") {
|
||||
Write-Host " - Already exists"
|
||||
if (check_binary) {
|
||||
return
|
||||
}
|
||||
if (Test-Path "$fzf_base\bin\fzf.exe") {
|
||||
Write-Host " - Already exists"
|
||||
if (check_binary) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (-not (Test-Path "$fzf_base\bin")) {
|
||||
|
@ -48,11 +40,7 @@ function download {
|
|||
return
|
||||
}
|
||||
cd "$fzf_base\bin"
|
||||
if ("$version" -eq "alpha") {
|
||||
$url="https://github.com/junegunn/fzf-bin/releases/download/alpha/$file"
|
||||
} else {
|
||||
$url="https://github.com/junegunn/fzf-bin/releases/download/$version/$file"
|
||||
}
|
||||
$url="https://github.com/junegunn/fzf/releases/download/$version/$file"
|
||||
$temp=$env:TMP + "\fzf.zip"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
(New-Object Net.WebClient).DownloadFile($url, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$temp"))
|
||||
|
@ -68,6 +56,6 @@ function download {
|
|||
check_binary >$null
|
||||
}
|
||||
|
||||
download "fzf-$version-windows_$binary_arch.zip"
|
||||
download "fzf-$version-windows_amd64.zip"
|
||||
|
||||
Write-Host 'For more information, see: https://github.com/junegunn/fzf'
|
||||
|
|
|
@ -5,9 +5,10 @@ import (
|
|||
"github.com/junegunn/fzf/src/protector"
|
||||
)
|
||||
|
||||
var revision string
|
||||
var version string = "0.24"
|
||||
var revision string = "devel"
|
||||
|
||||
func main() {
|
||||
protector.Protect()
|
||||
fzf.Run(fzf.ParseOptions(), revision)
|
||||
fzf.Run(fzf.ParseOptions(), version, revision)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ 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.
|
||||
..
|
||||
.TH fzf-tmux 1 "Oct 2020" "fzf 0.23.1" "fzf-tmux - open fzf in tmux split pane"
|
||||
.TH fzf-tmux 1 "Nov 2020" "fzf 0.24.3" "fzf-tmux - open fzf in tmux split pane"
|
||||
|
||||
.SH NAME
|
||||
fzf-tmux - open fzf in tmux split pane
|
||||
|
|
|
@ -21,7 +21,7 @@ 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.
|
||||
..
|
||||
.TH fzf 1 "Oct 2020" "fzf 0.23.1" "fzf - a command-line fuzzy finder"
|
||||
.TH fzf 1 "Nov 2020" "fzf 0.24.3" "fzf - a command-line fuzzy finder"
|
||||
|
||||
.SH NAME
|
||||
fzf - a command-line fuzzy finder
|
||||
|
@ -192,6 +192,16 @@ Draw border around the finder
|
|||
.br
|
||||
.BR horizontal " Horizontal lines above and below the finder"
|
||||
.br
|
||||
.BR vertical " Vertical lines on each side of the finder"
|
||||
.br
|
||||
.BR top
|
||||
.br
|
||||
.BR bottom
|
||||
.br
|
||||
.BR left
|
||||
.br
|
||||
.BR right
|
||||
.br
|
||||
|
||||
.TP
|
||||
.B "--no-unicode"
|
||||
|
@ -223,6 +233,29 @@ e.g.
|
|||
\fBfzf --margin 10%
|
||||
fzf --margin 1,5%\fR
|
||||
.RE
|
||||
.TP
|
||||
.BI "--padding=" PADDING
|
||||
Comma-separated expression for padding inside the border. Padding is
|
||||
distinguishable from margin only when \fB--border\fR option is used.
|
||||
.br
|
||||
|
||||
.br
|
||||
e.g.
|
||||
\fBfzf --margin 5% --padding 5% --border --preview 'cat {}' \\
|
||||
--color bg:#222222,preview-bg:#333333\fR
|
||||
|
||||
.br
|
||||
.RS
|
||||
.BR TRBL " Same padding for top, right, bottom, and left"
|
||||
.br
|
||||
.BR TB,RL " Vertical, horizontal padding"
|
||||
.br
|
||||
.BR T,RL,B " Top, horizontal, bottom padding"
|
||||
.br
|
||||
.BR T,R,B,L " Top, right, bottom, left padding"
|
||||
.br
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.BI "--info=" "STYLE"
|
||||
Determines the display style of finder info.
|
||||
|
|
|
@ -128,7 +128,7 @@ endfunction
|
|||
|
||||
function! s:default_layout()
|
||||
return s:popup_support()
|
||||
\ ? { 'window' : { 'width': 0.9, 'height': 0.6, 'highlight': 'Normal' } }
|
||||
\ ? { 'window' : { 'width': 0.9, 'height': 0.6 } }
|
||||
\ : { 'down': '~40%' }
|
||||
endfunction
|
||||
|
||||
|
@ -154,7 +154,20 @@ function! fzf#install()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! fzf#exec()
|
||||
function! s:version_requirement(val, min)
|
||||
let val = split(a:val, '\.')
|
||||
let min = split(a:min, '\.')
|
||||
for idx in range(0, len(min) - 1)
|
||||
let v = get(val, idx, 0)
|
||||
if v < min[idx] | return 0
|
||||
elseif v > min[idx] | return 1
|
||||
endif
|
||||
endfor
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
let s:checked = {}
|
||||
function! fzf#exec(...)
|
||||
if !exists('s:exec')
|
||||
if executable(s:fzf_go)
|
||||
let s:exec = s:fzf_go
|
||||
|
@ -169,6 +182,26 @@ function! fzf#exec()
|
|||
throw 'fzf executable not found'
|
||||
endif
|
||||
endif
|
||||
|
||||
if a:0 && !has_key(s:checked, a:1)
|
||||
let command = s:exec . ' --version'
|
||||
let output = systemlist(command)
|
||||
if v:shell_error || empty(output)
|
||||
throw printf('Failed to run "%s": %s', command, output)
|
||||
endif
|
||||
let fzf_version = matchstr(output[-1], '[0-9.]\+')
|
||||
if s:version_requirement(fzf_version, a:1)
|
||||
let s:checked[a:1] = 1
|
||||
return s:exec
|
||||
elseif a:0 < 2 && input(printf('You need fzf %s or above. Found: %s. Download binary? (y/n) ', a:1, fzf_version)) =~? '^y'
|
||||
redraw
|
||||
call fzf#install()
|
||||
return fzf#exec(a:1, 1)
|
||||
else
|
||||
throw printf('You need to upgrade fzf (required: %s or above)', a:1)
|
||||
endif
|
||||
endif
|
||||
|
||||
return s:exec
|
||||
endfunction
|
||||
|
||||
|
@ -250,7 +283,8 @@ function! s:common_sink(action, lines) abort
|
|||
let cwd = exists('w:fzf_pushd') ? w:fzf_pushd.dir : expand('%:p:h')
|
||||
for item in a:lines
|
||||
if item[0] != '~' && item !~ (s:is_win ? '^[A-Z]:\' : '^/')
|
||||
let item = join([cwd, item], (s:is_win ? '\' : '/'))
|
||||
let sep = s:is_win ? '\' : '/'
|
||||
let item = join([cwd, item], cwd[len(cwd)-1] == sep ? '' : sep)
|
||||
endif
|
||||
if empty
|
||||
execute 'e' s:escape(item)
|
||||
|
@ -404,7 +438,7 @@ try
|
|||
let prefix = '( '.source.' )|'
|
||||
elseif type == 3
|
||||
let temps.input = s:fzf_tempname()
|
||||
call writefile(map(source, '<SID>enc_to_cp(v:val)'), temps.input)
|
||||
call writefile(source, temps.input)
|
||||
let prefix = (s:is_win ? 'type ' : 'cat ').fzf#shellescape(temps.input).'|'
|
||||
else
|
||||
throw 'Invalid source type'
|
||||
|
@ -432,6 +466,7 @@ try
|
|||
elseif use_term
|
||||
let optstr .= ' --no-height'
|
||||
endif
|
||||
let optstr .= s:border_opt(get(dict, 'window', 0))
|
||||
let command = prefix.(use_tmux ? s:fzf_tmux(dict) : fzf_exec).' '.optstr.' > '.temps.result
|
||||
|
||||
if use_term
|
||||
|
@ -610,7 +645,8 @@ function! s:execute(dict, command, use_height, temps) abort
|
|||
endif
|
||||
let exit_status = v:shell_error
|
||||
redraw!
|
||||
return s:exit_handler(exit_status, command) ? s:collect(a:temps) : []
|
||||
let lines = s:collect(a:temps)
|
||||
return s:exit_handler(exit_status, command) ? lines : []
|
||||
endfunction
|
||||
|
||||
function! s:execute_tmux(dict, command, temps) abort
|
||||
|
@ -624,7 +660,8 @@ function! s:execute_tmux(dict, command, temps) abort
|
|||
call system(command)
|
||||
let exit_status = v:shell_error
|
||||
redraw!
|
||||
return s:exit_handler(exit_status, command) ? s:collect(a:temps) : []
|
||||
let lines = s:collect(a:temps)
|
||||
return s:exit_handler(exit_status, command) ? lines : []
|
||||
endfunction
|
||||
|
||||
function! s:calc_size(max, val, dict)
|
||||
|
@ -656,6 +693,32 @@ function! s:getpos()
|
|||
return {'tab': tabpagenr(), 'win': winnr(), 'winid': win_getid(), 'cnt': winnr('$'), 'tcnt': tabpagenr('$')}
|
||||
endfunction
|
||||
|
||||
function! s:border_opt(window)
|
||||
if type(a:window) != type({})
|
||||
return ''
|
||||
endif
|
||||
|
||||
" Border style
|
||||
let style = tolower(get(a:window, 'border', 'rounded'))
|
||||
if !has_key(a:window, 'border') && !get(a:window, 'rounded', 1)
|
||||
let style = 'sharp'
|
||||
endif
|
||||
if style == 'none' || style == 'no'
|
||||
return ''
|
||||
endif
|
||||
|
||||
" For --border styles, we need fzf 0.24.0 or above
|
||||
call fzf#exec('0.24.0')
|
||||
let opt = ' --border=' . style
|
||||
if has_key(a:window, 'highlight')
|
||||
let color = s:get_color('fg', a:window.highlight)
|
||||
if len(color)
|
||||
let opt .= ' --color=border:' . color
|
||||
endif
|
||||
endif
|
||||
return opt
|
||||
endfunction
|
||||
|
||||
function! s:split(dict)
|
||||
let directions = {
|
||||
\ 'up': ['topleft', 'resize', &lines],
|
||||
|
@ -745,12 +808,12 @@ function! s:execute_term(dict, command, temps) abort
|
|||
execute self.winrest
|
||||
endif
|
||||
|
||||
let lines = s:collect(self.temps)
|
||||
if !s:exit_handler(a:code, self.command, 1)
|
||||
return
|
||||
endif
|
||||
|
||||
call s:pushd(self.dict)
|
||||
let lines = s:collect(self.temps)
|
||||
call s:callback(self.dict, lines)
|
||||
call self.switch_back(s:getpos() == self.ppos)
|
||||
endfunction
|
||||
|
@ -775,6 +838,7 @@ function! s:execute_term(dict, command, temps) abort
|
|||
let term_opts.curwin = 1
|
||||
endif
|
||||
let fzf.buf = term_start([&shell, &shellcmdflag, command], term_opts)
|
||||
call setbufvar(fzf.buf, '&termwinkey', '<c-z>')
|
||||
if is_popup && exists('#TerminalWinOpen')
|
||||
doautocmd <nomodeline> TerminalWinOpen
|
||||
endif
|
||||
|
@ -782,6 +846,7 @@ function! s:execute_term(dict, command, temps) abort
|
|||
call term_wait(fzf.buf, 20)
|
||||
endif
|
||||
endif
|
||||
tnoremap <buffer> <c-z> <nop>
|
||||
finally
|
||||
call s:dopopd()
|
||||
endtry
|
||||
|
@ -848,33 +913,22 @@ if has('nvim')
|
|||
endfunction
|
||||
else
|
||||
function! s:create_popup(hl, opts) abort
|
||||
let is_frame = has_key(a:opts, 'border')
|
||||
let s:popup_create = {buf -> popup_create(buf, #{
|
||||
\ line: a:opts.row,
|
||||
\ col: a:opts.col,
|
||||
\ minwidth: a:opts.width,
|
||||
\ maxwidth: a:opts.width,
|
||||
\ minheight: a:opts.height,
|
||||
\ zindex: 50 - is_frame,
|
||||
\ maxheight: a:opts.height,
|
||||
\ zindex: 1000,
|
||||
\ })}
|
||||
if is_frame
|
||||
let id = s:popup_create('')
|
||||
call setwinvar(id, '&wincolor', a:hl)
|
||||
call setbufline(winbufnr(id), 1, a:opts.border)
|
||||
execute 'autocmd BufWipeout * ++once call popup_close('..id..')'
|
||||
return winbufnr(id)
|
||||
else
|
||||
autocmd TerminalOpen * ++once call s:popup_create(str2nr(expand('<abuf>')))
|
||||
endif
|
||||
autocmd TerminalOpen * ++once call s:popup_create(str2nr(expand('<abuf>')))
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! s:popup(opts) abort
|
||||
" Support ambiwidth == 'double'
|
||||
let ambidouble = &ambiwidth == 'double' ? 2 : 1
|
||||
|
||||
" Size and position
|
||||
let width = min([max([8, a:opts.width > 1 ? a:opts.width : float2nr(&columns * a:opts.width)]), &columns])
|
||||
let width += width % ambidouble
|
||||
let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(&lines * a:opts.height)]), &lines - has('nvim')])
|
||||
let row = float2nr(get(a:opts, 'yoffset', 0.5) * (&lines - height))
|
||||
let col = float2nr(get(a:opts, 'xoffset', 0.5) * (&columns - width))
|
||||
|
@ -885,45 +939,9 @@ function! s:popup(opts) abort
|
|||
let row += !has('nvim')
|
||||
let col += !has('nvim')
|
||||
|
||||
" Border style
|
||||
let style = tolower(get(a:opts, 'border', 'rounded'))
|
||||
if !has_key(a:opts, 'border') && !get(a:opts, 'rounded', 1)
|
||||
let style = 'sharp'
|
||||
endif
|
||||
|
||||
if style =~ 'vertical\|left\|right'
|
||||
let mid = style == 'vertical' ? '│' .. repeat(' ', width - 2 * ambidouble) .. '│' :
|
||||
\ style == 'left' ? '│' .. repeat(' ', width - 1 * ambidouble)
|
||||
\ : repeat(' ', width - 1 * ambidouble) .. '│'
|
||||
let border = repeat([mid], height)
|
||||
let shift = { 'row': 0, 'col': style == 'right' ? 0 : 2, 'width': style == 'vertical' ? -4 : -2, 'height': 0 }
|
||||
elseif style =~ 'horizontal\|top\|bottom'
|
||||
let hor = repeat('─', width / ambidouble)
|
||||
let mid = repeat(' ', width)
|
||||
let border = style == 'horizontal' ? [hor] + repeat([mid], height - 2) + [hor] :
|
||||
\ style == 'top' ? [hor] + repeat([mid], height - 1)
|
||||
\ : repeat([mid], height - 1) + [hor]
|
||||
let shift = { 'row': style == 'bottom' ? 0 : 1, 'col': 0, 'width': 0, 'height': style == 'horizontal' ? -2 : -1 }
|
||||
else
|
||||
let edges = style == 'sharp' ? ['┌', '┐', '└', '┘'] : ['╭', '╮', '╰', '╯']
|
||||
let bar = repeat('─', width / ambidouble - 2)
|
||||
let top = edges[0] .. bar .. edges[1]
|
||||
let mid = '│' .. repeat(' ', width - 2 * ambidouble) .. '│'
|
||||
let bot = edges[2] .. bar .. edges[3]
|
||||
let border = [top] + repeat([mid], height - 2) + [bot]
|
||||
let shift = { 'row': 1, 'col': 2, 'width': -4, 'height': -2 }
|
||||
endif
|
||||
|
||||
let highlight = get(a:opts, 'highlight', 'Comment')
|
||||
let frame = s:create_popup(highlight, {
|
||||
\ 'row': row, 'col': col, 'width': width, 'height': height, 'border': border
|
||||
\ })
|
||||
call s:create_popup('Normal', {
|
||||
\ 'row': row + shift.row, 'col': col + shift.col, 'width': width + shift.width, 'height': height + shift.height
|
||||
\ 'row': row, 'col': col, 'width': width, 'height': height
|
||||
\ })
|
||||
if has('nvim')
|
||||
execute 'autocmd BufWipeout <buffer> bwipeout '..frame
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:default_action = {
|
||||
|
|
|
@ -46,9 +46,20 @@ __fzf_comprun() {
|
|||
fi
|
||||
}
|
||||
|
||||
__fzf_orig_completion_filter() {
|
||||
sed 's/^\(.*-F\) *\([^ ]*\).* \([^ ]*\)$/export _fzf_orig_completion_\3="\1 %s \3 #\2"; [[ "\1" = *" -o nospace "* ]] \&\& [[ ! "$__fzf_nospace_commands" = *" \3 "* ]] \&\& __fzf_nospace_commands="$__fzf_nospace_commands \3 ";/' |
|
||||
awk -F= '{OFS = FS} {gsub(/[^A-Za-z0-9_= ;]/, "_", $1);}1'
|
||||
__fzf_orig_completion() {
|
||||
local l comp f cmd
|
||||
while read -r l; do
|
||||
if [[ "$l" =~ ^(.*\ -F)\ *([^ ]*).*\ ([^ ]*)$ ]]; then
|
||||
comp="${BASH_REMATCH[1]}"
|
||||
f="${BASH_REMATCH[2]}"
|
||||
cmd="${BASH_REMATCH[3]}"
|
||||
[[ "$f" = _fzf_* ]] && continue
|
||||
printf -v "_fzf_orig_completion_${cmd//[^A-Za-z0-9_]/_}" "%s" "${comp} %s ${cmd} #${f}"
|
||||
if [[ "$l" = *" -o nospace "* ]] && [[ ! "$__fzf_nospace_commands" = *" $cmd "* ]]; then
|
||||
__fzf_nospace_commands="$__fzf_nospace_commands $cmd "
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_fzf_opts_completion() {
|
||||
|
@ -137,7 +148,7 @@ _fzf_handle_dynamic_completion() {
|
|||
ret=$?
|
||||
# _completion_loader may not have updated completion for the command
|
||||
if [ "$(complete -p "$orig_cmd" 2> /dev/null)" != "$orig_complete" ]; then
|
||||
eval "$(complete | command grep " -F.* $orig_cmd$" | __fzf_orig_completion_filter)"
|
||||
__fzf_orig_completion < <(complete -p "$orig_cmd" 2> /dev/null)
|
||||
if [[ "$__fzf_nospace_commands" = *" $orig_cmd "* ]]; then
|
||||
eval "${orig_complete/ -F / -o nospace -F }"
|
||||
else
|
||||
|
@ -306,9 +317,7 @@ a_cmds="
|
|||
svn tar unzip zip"
|
||||
|
||||
# Preserve existing completion
|
||||
eval "$(complete |
|
||||
sed -E '/-F/!d; / _fzf/d; '"/ ($(echo $d_cmds $a_cmds | sed 's/ /|/g; s/+/\\+/g'))$/"'!d' |
|
||||
__fzf_orig_completion_filter)"
|
||||
__fzf_orig_completion < <(complete -p $d_cmds $a_cmds 2> /dev/null)
|
||||
|
||||
if type _completion_loader > /dev/null 2>&1; then
|
||||
_fzf_completion_loader=1
|
||||
|
@ -353,7 +362,7 @@ _fzf_setup_completion() {
|
|||
return 1
|
||||
fi
|
||||
shift
|
||||
eval "$(complete -p "$@" 2> /dev/null | grep -v "$fn" | __fzf_orig_completion_filter)"
|
||||
__fzf_orig_completion < <(complete -p "$@" 2> /dev/null)
|
||||
for cmd in "$@"; do
|
||||
case "$kind" in
|
||||
dir) __fzf_defc "$cmd" "$fn" "-o nospace -o dirnames" ;;
|
||||
|
|
|
@ -9,9 +9,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// Current version
|
||||
version = "0.23.1"
|
||||
|
||||
// Core
|
||||
coordinatorDelayMax time.Duration = 100 * time.Millisecond
|
||||
coordinatorDelayStep time.Duration = 10 * time.Millisecond
|
||||
|
|
|
@ -43,7 +43,7 @@ Matcher -> EvtHeader -> Terminal (update header)
|
|||
*/
|
||||
|
||||
// Run starts fzf
|
||||
func Run(opts *Options, revision string) {
|
||||
func Run(opts *Options, version string, revision string) {
|
||||
sort := opts.Sort > 0
|
||||
sortCriteria = opts.Criteria
|
||||
|
||||
|
|
|
@ -58,8 +58,10 @@ const usage = `usage: fzf [options]
|
|||
(default: 10)
|
||||
--layout=LAYOUT Choose layout: [default|reverse|reverse-list]
|
||||
--border[=STYLE] Draw border around the finder
|
||||
[rounded|sharp|horizontal] (default: rounded)
|
||||
--margin=MARGIN Screen margin (TRBL / TB,RL / T,RL,B / T,R,B,L)
|
||||
[rounded|sharp|horizontal|vertical|
|
||||
top|bottom|left|right] (default: rounded)
|
||||
--margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
||||
--padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
||||
--info=STYLE Finder info style [default|inline|hidden]
|
||||
--prompt=STR Input prompt (default: '> ')
|
||||
--pointer=STR Pointer to the current line (default: '>')
|
||||
|
@ -220,6 +222,7 @@ type Options struct {
|
|||
Header []string
|
||||
HeaderLines int
|
||||
Margin [4]sizeSpec
|
||||
Padding [4]sizeSpec
|
||||
BorderShape tui.BorderShape
|
||||
Unicode bool
|
||||
Tabstop int
|
||||
|
@ -280,6 +283,7 @@ func defaultOptions() *Options {
|
|||
Header: make([]string, 0),
|
||||
HeaderLines: 0,
|
||||
Margin: defaultMargin(),
|
||||
Padding: defaultMargin(),
|
||||
Unicode: true,
|
||||
Tabstop: 8,
|
||||
ClearOnExit: true,
|
||||
|
@ -421,11 +425,21 @@ func parseBorder(str string, optional bool) tui.BorderShape {
|
|||
return tui.BorderSharp
|
||||
case "horizontal":
|
||||
return tui.BorderHorizontal
|
||||
case "vertical":
|
||||
return tui.BorderVertical
|
||||
case "top":
|
||||
return tui.BorderTop
|
||||
case "bottom":
|
||||
return tui.BorderBottom
|
||||
case "left":
|
||||
return tui.BorderLeft
|
||||
case "right":
|
||||
return tui.BorderRight
|
||||
default:
|
||||
if optional && str == "" {
|
||||
return tui.BorderRounded
|
||||
}
|
||||
errorExit("invalid border style (expected: rounded|sharp|horizontal)")
|
||||
errorExit("invalid border style (expected: rounded|sharp|horizontal|vertical|top|bottom|left|right)")
|
||||
}
|
||||
return tui.BorderNone
|
||||
}
|
||||
|
@ -606,7 +620,7 @@ func parseTheme(defaultTheme *tui.ColorTheme, str string) *tui.ColorTheme {
|
|||
case "16":
|
||||
theme = dupeTheme(tui.Default16)
|
||||
case "bw", "no":
|
||||
theme = nil
|
||||
theme = tui.NoColorTheme()
|
||||
default:
|
||||
fail := func() {
|
||||
errorExit("invalid color specification: " + str)
|
||||
|
@ -1065,10 +1079,10 @@ func parsePreviewWindow(opts *previewOpts, input string) {
|
|||
}
|
||||
}
|
||||
|
||||
func parseMargin(margin string) [4]sizeSpec {
|
||||
func parseMargin(opt string, margin string) [4]sizeSpec {
|
||||
margins := strings.Split(margin, ",")
|
||||
checked := func(str string) sizeSpec {
|
||||
return parseSize(str, 49, "margin")
|
||||
return parseSize(str, 49, opt)
|
||||
}
|
||||
switch len(margins) {
|
||||
case 1:
|
||||
|
@ -1088,7 +1102,7 @@ func parseMargin(margin string) [4]sizeSpec {
|
|||
checked(margins[0]), checked(margins[1]),
|
||||
checked(margins[2]), checked(margins[3])}
|
||||
default:
|
||||
errorExit("invalid margin: " + margin)
|
||||
errorExit("invalid " + opt + ": " + margin)
|
||||
}
|
||||
return defaultMargin()
|
||||
}
|
||||
|
@ -1313,6 +1327,8 @@ func parseOptions(opts *Options, allArgs []string) {
|
|||
opts.Height = sizeSpec{}
|
||||
case "--no-margin":
|
||||
opts.Margin = defaultMargin()
|
||||
case "--no-padding":
|
||||
opts.Padding = defaultMargin()
|
||||
case "--no-border":
|
||||
opts.BorderShape = tui.BorderNone
|
||||
case "--border":
|
||||
|
@ -1324,7 +1340,12 @@ func parseOptions(opts *Options, allArgs []string) {
|
|||
opts.Unicode = true
|
||||
case "--margin":
|
||||
opts.Margin = parseMargin(
|
||||
"margin",
|
||||
nextString(allArgs, &i, "margin required (TRBL / TB,RL / T,RL,B / T,R,B,L)"))
|
||||
case "--padding":
|
||||
opts.Padding = parseMargin(
|
||||
"padding",
|
||||
nextString(allArgs, &i, "padding required (TRBL / TB,RL / T,RL,B / T,R,B,L)"))
|
||||
case "--tabstop":
|
||||
opts.Tabstop = nextInt(allArgs, &i, "tab stop required")
|
||||
case "--clear":
|
||||
|
@ -1393,7 +1414,9 @@ func parseOptions(opts *Options, allArgs []string) {
|
|||
} else if match, value := optString(arg, "--preview-window="); match {
|
||||
parsePreviewWindow(&opts.Preview, value)
|
||||
} else if match, value := optString(arg, "--margin="); match {
|
||||
opts.Margin = parseMargin(value)
|
||||
opts.Margin = parseMargin("margin", value)
|
||||
} else if match, value := optString(arg, "--padding="); match {
|
||||
opts.Padding = parseMargin("padding", value)
|
||||
} else if match, value := optString(arg, "--tabstop="); match {
|
||||
opts.Tabstop = atoi(value)
|
||||
} else if match, value := optString(arg, "--hscroll-off="); match {
|
||||
|
|
|
@ -119,6 +119,7 @@ type Terminal struct {
|
|||
ansi bool
|
||||
tabstop int
|
||||
margin [4]sizeSpec
|
||||
padding [4]sizeSpec
|
||||
strong tui.Attr
|
||||
unicode bool
|
||||
borderShape tui.BorderShape
|
||||
|
@ -472,6 +473,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
|||
printQuery: opts.PrintQuery,
|
||||
history: opts.History,
|
||||
margin: opts.Margin,
|
||||
padding: opts.Padding,
|
||||
unicode: opts.Unicode,
|
||||
borderShape: opts.BorderShape,
|
||||
cleanExit: opts.ClearOnExit,
|
||||
|
@ -526,7 +528,6 @@ func (t *Terminal) parsePrompt(prompt string) (func(), int) {
|
|||
blankState := ansiOffset{[2]int32{int32(loc[0]), int32(loc[1])}, ansiState{-1, -1, tui.AttrClear}}
|
||||
if item.colors != nil {
|
||||
lastColor := (*item.colors)[len(*item.colors)-1]
|
||||
fmt.Println(lastColor.offset[1], int32(loc[1]))
|
||||
if lastColor.offset[1] < int32(loc[1]) {
|
||||
blankState.offset[0] = lastColor.offset[1]
|
||||
colors := append(*item.colors, blankState)
|
||||
|
@ -653,7 +654,7 @@ func (t *Terminal) displayWidth(runes []rune) int {
|
|||
}
|
||||
|
||||
const (
|
||||
minWidth = 16
|
||||
minWidth = 4
|
||||
minHeight = 4
|
||||
|
||||
maxDisplayWidthCalc = 1024
|
||||
|
@ -670,34 +671,64 @@ func calculateSize(base int, size sizeSpec, occupied int, minSize int, pad int)
|
|||
func (t *Terminal) resizeWindows() {
|
||||
screenWidth := t.tui.MaxX()
|
||||
screenHeight := t.tui.MaxY()
|
||||
marginInt := [4]int{}
|
||||
t.prevLines = make([]itemLine, screenHeight)
|
||||
for idx, sizeSpec := range t.margin {
|
||||
if sizeSpec.percent {
|
||||
|
||||
marginInt := [4]int{} // TRBL
|
||||
paddingInt := [4]int{} // TRBL
|
||||
sizeSpecToInt := func(index int, spec sizeSpec) int {
|
||||
if spec.percent {
|
||||
var max float64
|
||||
if idx%2 == 0 {
|
||||
if index%2 == 0 {
|
||||
max = float64(screenHeight)
|
||||
} else {
|
||||
max = float64(screenWidth)
|
||||
}
|
||||
marginInt[idx] = int(max * sizeSpec.size * 0.01)
|
||||
} else {
|
||||
marginInt[idx] = int(sizeSpec.size)
|
||||
return int(max * spec.size * 0.01)
|
||||
}
|
||||
return int(spec.size)
|
||||
}
|
||||
for idx, sizeSpec := range t.padding {
|
||||
paddingInt[idx] = sizeSpecToInt(idx, sizeSpec)
|
||||
}
|
||||
|
||||
extraMargin := [4]int{} // TRBL
|
||||
for idx, sizeSpec := range t.margin {
|
||||
switch t.borderShape {
|
||||
case tui.BorderHorizontal:
|
||||
marginInt[idx] += 1 - idx%2
|
||||
extraMargin[idx] += 1 - idx%2
|
||||
case tui.BorderVertical:
|
||||
extraMargin[idx] += 2 * (idx % 2)
|
||||
case tui.BorderTop:
|
||||
if idx == 0 {
|
||||
extraMargin[idx]++
|
||||
}
|
||||
case tui.BorderRight:
|
||||
if idx == 1 {
|
||||
extraMargin[idx] += 2
|
||||
}
|
||||
case tui.BorderBottom:
|
||||
if idx == 2 {
|
||||
extraMargin[idx]++
|
||||
}
|
||||
case tui.BorderLeft:
|
||||
if idx == 3 {
|
||||
extraMargin[idx] += 2
|
||||
}
|
||||
case tui.BorderRounded, tui.BorderSharp:
|
||||
marginInt[idx] += 1 + idx%2
|
||||
extraMargin[idx] += 1 + idx%2
|
||||
}
|
||||
marginInt[idx] = sizeSpecToInt(idx, sizeSpec) + extraMargin[idx]
|
||||
}
|
||||
|
||||
adjust := func(idx1 int, idx2 int, max int, min int) {
|
||||
if max >= min {
|
||||
margin := marginInt[idx1] + marginInt[idx2]
|
||||
margin := marginInt[idx1] + marginInt[idx2] + paddingInt[idx1] + paddingInt[idx2]
|
||||
if max-margin < min {
|
||||
desired := max - min
|
||||
marginInt[idx1] = desired * marginInt[idx1] / margin
|
||||
marginInt[idx2] = desired * marginInt[idx2] / margin
|
||||
paddingInt[idx1] = desired * paddingInt[idx1] / margin
|
||||
paddingInt[idx2] = desired * paddingInt[idx2] / margin
|
||||
marginInt[idx1] = util.Max(extraMargin[idx1], desired*marginInt[idx1]/margin)
|
||||
marginInt[idx2] = util.Max(extraMargin[idx2], desired*marginInt[idx2]/margin)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -735,19 +766,41 @@ func (t *Terminal) resizeWindows() {
|
|||
switch t.borderShape {
|
||||
case tui.BorderHorizontal:
|
||||
t.border = t.tui.NewWindow(
|
||||
marginInt[0]-1,
|
||||
marginInt[3],
|
||||
width,
|
||||
height+2,
|
||||
marginInt[0]-1, marginInt[3], width, height+2,
|
||||
false, tui.MakeBorderStyle(tui.BorderHorizontal, t.unicode))
|
||||
case tui.BorderVertical:
|
||||
t.border = t.tui.NewWindow(
|
||||
marginInt[0], marginInt[3]-2, width+4, height,
|
||||
false, tui.MakeBorderStyle(tui.BorderVertical, t.unicode))
|
||||
case tui.BorderTop:
|
||||
t.border = t.tui.NewWindow(
|
||||
marginInt[0]-1, marginInt[3], width, height+1,
|
||||
false, tui.MakeBorderStyle(tui.BorderTop, t.unicode))
|
||||
case tui.BorderBottom:
|
||||
t.border = t.tui.NewWindow(
|
||||
marginInt[0], marginInt[3], width, height+1,
|
||||
false, tui.MakeBorderStyle(tui.BorderBottom, t.unicode))
|
||||
case tui.BorderLeft:
|
||||
t.border = t.tui.NewWindow(
|
||||
marginInt[0], marginInt[3]-2, width+2, height,
|
||||
false, tui.MakeBorderStyle(tui.BorderLeft, t.unicode))
|
||||
case tui.BorderRight:
|
||||
t.border = t.tui.NewWindow(
|
||||
marginInt[0], marginInt[3], width+2, height,
|
||||
false, tui.MakeBorderStyle(tui.BorderRight, t.unicode))
|
||||
case tui.BorderRounded, tui.BorderSharp:
|
||||
t.border = t.tui.NewWindow(
|
||||
marginInt[0]-1,
|
||||
marginInt[3]-2,
|
||||
width+4,
|
||||
height+2,
|
||||
marginInt[0]-1, marginInt[3]-2, width+4, height+2,
|
||||
false, tui.MakeBorderStyle(t.borderShape, t.unicode))
|
||||
}
|
||||
|
||||
// Add padding
|
||||
for idx, val := range paddingInt {
|
||||
marginInt[idx] += val
|
||||
}
|
||||
width = screenWidth - marginInt[1] - marginInt[3]
|
||||
height = screenHeight - marginInt[0] - marginInt[2]
|
||||
|
||||
noBorder := tui.MakeBorderStyle(tui.BorderNone, t.unicode)
|
||||
if previewVisible {
|
||||
createPreviewWindow := func(y int, x int, w int, h int) {
|
||||
|
@ -769,17 +822,19 @@ func (t *Terminal) resizeWindows() {
|
|||
t.pwindow = t.tui.NewWindow(y, x, pwidth, pheight, true, noBorder)
|
||||
}
|
||||
verticalPad := 2
|
||||
minPreviewHeight := 3
|
||||
if t.preview.border == tui.BorderNone {
|
||||
verticalPad = 0
|
||||
minPreviewHeight = 1
|
||||
}
|
||||
switch t.preview.position {
|
||||
case posUp:
|
||||
pheight := calculateSize(height, t.preview.size, minHeight, 3, verticalPad)
|
||||
pheight := calculateSize(height, t.preview.size, minHeight, minPreviewHeight, verticalPad)
|
||||
t.window = t.tui.NewWindow(
|
||||
marginInt[0]+pheight, marginInt[3], width, height-pheight, false, noBorder)
|
||||
createPreviewWindow(marginInt[0], marginInt[3], width, pheight)
|
||||
case posDown:
|
||||
pheight := calculateSize(height, t.preview.size, minHeight, 3, verticalPad)
|
||||
pheight := calculateSize(height, t.preview.size, minHeight, minPreviewHeight, verticalPad)
|
||||
t.window = t.tui.NewWindow(
|
||||
marginInt[0], marginInt[3], width, height-pheight, false, noBorder)
|
||||
createPreviewWindow(marginInt[0]+height-pheight, marginInt[3], width, pheight)
|
||||
|
@ -1222,6 +1277,7 @@ func (t *Terminal) renderPreviewText(unchanged bool) {
|
|||
}
|
||||
var ansi *ansiState
|
||||
for _, line := range t.previewer.lines {
|
||||
line = strings.TrimSuffix(line, "\n")
|
||||
if lineNo >= height || t.pwindow.Y() == height-1 && t.pwindow.X() > 0 {
|
||||
t.previewed.filled = true
|
||||
break
|
||||
|
@ -1252,6 +1308,7 @@ func (t *Terminal) renderPreviewText(unchanged bool) {
|
|||
if unchanged && lineNo == 0 {
|
||||
break
|
||||
}
|
||||
t.pwindow.Fill("\n")
|
||||
}
|
||||
lineNo++
|
||||
}
|
||||
|
@ -1823,13 +1880,9 @@ func (t *Terminal) Loop() {
|
|||
reader := bufio.NewReader(out)
|
||||
eofChan := make(chan bool)
|
||||
finishChan := make(chan bool, 1)
|
||||
reapChan := make(chan bool)
|
||||
err := cmd.Start()
|
||||
reaps := 0
|
||||
if err != nil {
|
||||
t.reqBox.Set(reqPreviewDisplay, previewResult{version, []string{err.Error()}, 0, ""})
|
||||
} else {
|
||||
reaps = 2
|
||||
if err == nil {
|
||||
reapChan := make(chan bool)
|
||||
lineChan := make(chan eachLine)
|
||||
// Goroutine 1 reads process output
|
||||
go func() {
|
||||
|
@ -1842,6 +1895,7 @@ func (t *Terminal) Loop() {
|
|||
}
|
||||
eofChan <- true
|
||||
}()
|
||||
|
||||
// Goroutine 2 periodically requests rendering
|
||||
go func(version int64) {
|
||||
lines := []string{}
|
||||
|
@ -1883,42 +1937,47 @@ func (t *Terminal) Loop() {
|
|||
ticker.Stop()
|
||||
reapChan <- true
|
||||
}(version)
|
||||
}
|
||||
// Goroutine 3 is responsible for cancelling running preview command
|
||||
go func(version int64) {
|
||||
timer := time.NewTimer(previewDelayed)
|
||||
Loop:
|
||||
for {
|
||||
select {
|
||||
case <-timer.C:
|
||||
t.reqBox.Set(reqPreviewDelayed, version)
|
||||
case code := <-t.killChan:
|
||||
if code != exitCancel {
|
||||
util.KillCommand(cmd)
|
||||
os.Exit(code)
|
||||
} else {
|
||||
timer := time.NewTimer(previewCancelWait)
|
||||
select {
|
||||
case <-timer.C:
|
||||
|
||||
// Goroutine 3 is responsible for cancelling running preview command
|
||||
go func(version int64) {
|
||||
timer := time.NewTimer(previewDelayed)
|
||||
Loop:
|
||||
for {
|
||||
select {
|
||||
case <-timer.C:
|
||||
t.reqBox.Set(reqPreviewDelayed, version)
|
||||
case code := <-t.killChan:
|
||||
if code != exitCancel {
|
||||
util.KillCommand(cmd)
|
||||
case <-finishChan:
|
||||
os.Exit(code)
|
||||
} else {
|
||||
timer := time.NewTimer(previewCancelWait)
|
||||
select {
|
||||
case <-timer.C:
|
||||
util.KillCommand(cmd)
|
||||
case <-finishChan:
|
||||
}
|
||||
timer.Stop()
|
||||
}
|
||||
timer.Stop()
|
||||
break Loop
|
||||
case <-finishChan:
|
||||
break Loop
|
||||
}
|
||||
break Loop
|
||||
case <-finishChan:
|
||||
break Loop
|
||||
}
|
||||
}
|
||||
timer.Stop()
|
||||
reapChan <- true
|
||||
}(version)
|
||||
<-eofChan
|
||||
cmd.Wait() // NOTE: We should not call Wait before EOF
|
||||
finishChan <- true
|
||||
for i := 0; i < reaps; i++ {
|
||||
timer.Stop()
|
||||
reapChan <- true
|
||||
}(version)
|
||||
|
||||
<-eofChan // Goroutine 1 finished
|
||||
cmd.Wait() // NOTE: We should not call Wait before EOF
|
||||
finishChan <- true // Tell Goroutine 3 to stop
|
||||
<-reapChan // Goroutine 2 and 3 finished
|
||||
<-reapChan
|
||||
} else {
|
||||
// Failed to start the command. Report the error immediately.
|
||||
t.reqBox.Set(reqPreviewDisplay, previewResult{version, []string{err.Error()}, 0, ""})
|
||||
}
|
||||
|
||||
cleanTemporaryFiles()
|
||||
} else {
|
||||
t.reqBox.Set(reqPreviewDisplay, previewResult{version, nil, 0, ""})
|
||||
|
|
|
@ -653,15 +653,46 @@ func (w *LightWindow) drawBorder() {
|
|||
case BorderRounded, BorderSharp:
|
||||
w.drawBorderAround()
|
||||
case BorderHorizontal:
|
||||
w.drawBorderHorizontal()
|
||||
w.drawBorderHorizontal(true, true)
|
||||
case BorderVertical:
|
||||
w.drawBorderVertical(true, true)
|
||||
case BorderTop:
|
||||
w.drawBorderHorizontal(true, false)
|
||||
case BorderBottom:
|
||||
w.drawBorderHorizontal(false, true)
|
||||
case BorderLeft:
|
||||
w.drawBorderVertical(true, false)
|
||||
case BorderRight:
|
||||
w.drawBorderVertical(false, true)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *LightWindow) drawBorderHorizontal() {
|
||||
w.Move(0, 0)
|
||||
w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))
|
||||
w.Move(w.height-1, 0)
|
||||
w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))
|
||||
func (w *LightWindow) drawBorderHorizontal(top, bottom bool) {
|
||||
if top {
|
||||
w.Move(0, 0)
|
||||
w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))
|
||||
}
|
||||
if bottom {
|
||||
w.Move(w.height-1, 0)
|
||||
w.CPrint(ColBorder, repeat(w.border.horizontal, w.width))
|
||||
}
|
||||
}
|
||||
|
||||
func (w *LightWindow) drawBorderVertical(left, right bool) {
|
||||
width := w.width - 2
|
||||
if !left || !right {
|
||||
width++
|
||||
}
|
||||
for y := 0; y < w.height; y++ {
|
||||
w.Move(y, 0)
|
||||
if left {
|
||||
w.CPrint(ColBorder, string(w.border.vertical))
|
||||
}
|
||||
w.CPrint(ColBorder, repeat(' ', width))
|
||||
if right {
|
||||
w.CPrint(ColBorder, string(w.border.vertical))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (w *LightWindow) drawBorderAround() {
|
||||
|
|
|
@ -583,7 +583,8 @@ func (w *TcellWindow) CFill(fg Color, bg Color, a Attr, str string) FillReturn {
|
|||
}
|
||||
|
||||
func (w *TcellWindow) drawBorder() {
|
||||
if w.borderStyle.shape == BorderNone {
|
||||
shape := w.borderStyle.shape
|
||||
if shape == BorderNone {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -603,17 +604,32 @@ func (w *TcellWindow) drawBorder() {
|
|||
style = w.normal.style()
|
||||
}
|
||||
|
||||
for x := left; x < right; x++ {
|
||||
_screen.SetContent(x, top, w.borderStyle.horizontal, nil, style)
|
||||
_screen.SetContent(x, bot-1, w.borderStyle.horizontal, nil, style)
|
||||
switch shape {
|
||||
case BorderRounded, BorderSharp, BorderHorizontal, BorderTop:
|
||||
for x := left; x < right; x++ {
|
||||
_screen.SetContent(x, top, w.borderStyle.horizontal, nil, style)
|
||||
}
|
||||
}
|
||||
|
||||
if w.borderStyle.shape != BorderHorizontal {
|
||||
switch shape {
|
||||
case BorderRounded, BorderSharp, BorderHorizontal, BorderBottom:
|
||||
for x := left; x < right; x++ {
|
||||
_screen.SetContent(x, bot-1, w.borderStyle.horizontal, nil, style)
|
||||
}
|
||||
}
|
||||
switch shape {
|
||||
case BorderRounded, BorderSharp, BorderVertical, BorderLeft:
|
||||
for y := top; y < bot; y++ {
|
||||
_screen.SetContent(left, y, w.borderStyle.vertical, nil, style)
|
||||
}
|
||||
}
|
||||
switch shape {
|
||||
case BorderRounded, BorderSharp, BorderVertical, BorderRight:
|
||||
for y := top; y < bot; y++ {
|
||||
_screen.SetContent(right-1, y, w.borderStyle.vertical, nil, style)
|
||||
}
|
||||
|
||||
}
|
||||
switch shape {
|
||||
case BorderRounded, BorderSharp:
|
||||
_screen.SetContent(left, top, w.borderStyle.topLeft, nil, style)
|
||||
_screen.SetContent(right-1, top, w.borderStyle.topRight, nil, style)
|
||||
_screen.SetContent(left, bot-1, w.borderStyle.bottomLeft, nil, style)
|
||||
|
|
|
@ -259,6 +259,11 @@ const (
|
|||
BorderRounded
|
||||
BorderSharp
|
||||
BorderHorizontal
|
||||
BorderVertical
|
||||
BorderTop
|
||||
BorderBottom
|
||||
BorderLeft
|
||||
BorderRight
|
||||
)
|
||||
|
||||
type BorderStyle struct {
|
||||
|
@ -549,6 +554,9 @@ func initTheme(theme *ColorTheme, baseTheme *ColorTheme, forceBlack bool) {
|
|||
|
||||
func initPalette(theme *ColorTheme) {
|
||||
pair := func(fg, bg ColorAttr) ColorPair {
|
||||
if fg.Color == colDefault && (fg.Attr&Reverse) > 0 {
|
||||
bg.Color = colDefault
|
||||
}
|
||||
return ColorPair{fg.Color, bg.Color, fg.Attr}
|
||||
}
|
||||
blank := theme.Fg
|
||||
|
|
|
@ -4,7 +4,5 @@ root = true
|
|||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
|
||||
[*.sh]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Plugin owners
|
||||
plugins/gitfast/ @felipec
|
||||
plugins/sdk/ @rgoldberg
|
||||
plugins/git-lfs/ @vietduc01100001
|
||||
plugins/aws/ @maksyms
|
||||
plugins/git-lfs/ @vietduc01100001
|
||||
plugins/gitfast/ @felipec
|
||||
plugins/sdk/ @rgoldberg
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest a feature for Oh My Zsh
|
||||
labels: 'feature'
|
||||
labels: 'Feature'
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: Support
|
||||
about: Request support for any problem you're having with Oh My Zsh
|
||||
labels: 'support'
|
||||
labels: 'Support'
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ zmodload zsh/langinfo
|
|||
# -P causes spaces to be encoded as '%20' instead of '+'
|
||||
function omz_urlencode() {
|
||||
emulate -L zsh
|
||||
local -a opts
|
||||
zparseopts -D -E -a opts r m P
|
||||
|
||||
local in_str=$1
|
||||
|
|
|
@ -6,7 +6,8 @@ function omz_history {
|
|||
if [[ -n "$clear" ]]; then
|
||||
# if -c provided, clobber the history file
|
||||
echo -n >| "$HISTFILE"
|
||||
echo >&2 History file deleted. Reload the session to see its effects.
|
||||
fc -p "$HISTFILE"
|
||||
echo >&2 History file deleted.
|
||||
elif [[ -n "$list" ]]; then
|
||||
# if -l provided, run as if calling `fc' directly
|
||||
builtin fc "$@"
|
||||
|
@ -36,3 +37,4 @@ setopt hist_expire_dups_first # delete duplicates first when HISTFILE size excee
|
|||
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||
setopt hist_ignore_space # ignore commands that start with space
|
||||
setopt hist_verify # show command with history expansion to user before running it
|
||||
setopt share_history # share command history data
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html)
|
||||
and a few utilities to manage AWS profiles and display them in the prompt.
|
||||
|
||||
To use it, make sure [jq](https://stedolan.github.io/jq/download/) is installed, and add `aws` to the plugins array in your zshrc file.
|
||||
To use it, add `aws` to the plugins array in your zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... aws)
|
||||
|
@ -15,6 +15,13 @@ plugins=(... aws)
|
|||
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
|
||||
Run `asp` without arguments to clear the profile.
|
||||
|
||||
* `acp [<profile>]`: in addition to `asp` functionality, it actually changes the profile by
|
||||
assuming the role specified in the `<profile>` configuration. It supports MFA and sets
|
||||
`$AWS_ACCESS_KEY_ID`, `$AWS_SECRET_ACCESS_KEY` and `$AWS_SESSION_TOKEN`, if obtained. It
|
||||
requires the roles to be configured as per the
|
||||
[official guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html).
|
||||
Run `acp` without arguments to clear the profile.
|
||||
|
||||
* `agp`: gets the current value of `$AWS_PROFILE`.
|
||||
|
||||
* `aws_change_access_key`: changes the AWS access key of a profile.
|
||||
|
@ -33,6 +40,36 @@ plugins=(... aws)
|
|||
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
||||
the current `$AWS_PROFILE`. It uses two variables to control how that is shown:
|
||||
|
||||
- ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
|
||||
* ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
|
||||
|
||||
- ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
|
||||
* ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
|
||||
|
||||
## Configuration
|
||||
|
||||
[Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) by AWS
|
||||
|
||||
### Scenario: IAM roles with a source profile and MFA authentication
|
||||
|
||||
Source profile credentials in `~/.aws/credentials`:
|
||||
|
||||
```
|
||||
[source-profile-name]
|
||||
aws_access_key_id = ...
|
||||
aws_secret_access_key = ...
|
||||
```
|
||||
|
||||
Role configuration in `~/.aws/config`:
|
||||
|
||||
```
|
||||
[profile source-profile-name]
|
||||
mfa_serial = arn:aws:iam::111111111111:mfa/myuser
|
||||
region = us-east-1
|
||||
output = json
|
||||
|
||||
[profile profile-with-role]
|
||||
role_arn = arn:aws:iam::9999999999999:role/myrole
|
||||
mfa_serial = arn:aws:iam::111111111111:mfa/myuser
|
||||
source_profile = source-profile-name
|
||||
region = us-east-1
|
||||
output = json
|
||||
```
|
||||
|
|
|
@ -5,7 +5,7 @@ function agp() {
|
|||
# AWS profile selection
|
||||
function asp() {
|
||||
if [[ -z "$1" ]]; then
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
|
||||
echo AWS profile cleared.
|
||||
return
|
||||
fi
|
||||
|
@ -18,60 +18,101 @@ function asp() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
local exists="$(aws configure get aws_access_key_id --profile $1)"
|
||||
local role_arn="$(aws configure get role_arn --profile $1)"
|
||||
local aws_access_key_id=""
|
||||
local aws_secret_access_key=""
|
||||
local aws_session_token=""
|
||||
if [[ -n $exists || -n $role_arn ]]; then
|
||||
if [[ -n $role_arn ]]; then
|
||||
local mfa_serial="$(aws configure get mfa_serial --profile $1)"
|
||||
local mfa_token=""
|
||||
local mfa_opt=""
|
||||
if [[ -n $mfa_serial ]]; then
|
||||
echo "Please enter your MFA token for $mfa_serial:"
|
||||
read mfa_token
|
||||
echo "Please enter the session duration in seconds (900-43200; default: 3600, which is the default maximum for a role):"
|
||||
read sess_duration
|
||||
if [[ -z $sess_duration ]]; then
|
||||
sess_duration = 3600
|
||||
fi
|
||||
mfa_opt="--serial-number $mfa_serial --token-code $mfa_token --duration-seconds $sess_duration"
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export AWS_PROFILE=$1
|
||||
export AWS_EB_PROFILE=$1
|
||||
}
|
||||
|
||||
# AWS profile switch
|
||||
function acp() {
|
||||
if [[ -z "$1" ]]; then
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
|
||||
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
|
||||
echo AWS profile cleared.
|
||||
return
|
||||
fi
|
||||
|
||||
local -a available_profiles
|
||||
available_profiles=($(aws_profiles))
|
||||
if [[ -z "${available_profiles[(r)$1]}" ]]; then
|
||||
echo "${fg[red]}Profile '$1' not found in '${AWS_CONFIG_FILE:-$HOME/.aws/config}'" >&2
|
||||
echo "Available profiles: ${(j:, :)available_profiles:-no profiles found}${reset_color}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local profile="$1"
|
||||
|
||||
# Get fallback credentials for if the aws command fails or no command is run
|
||||
local aws_access_key_id="$(aws configure get aws_access_key_id --profile $profile)"
|
||||
local aws_secret_access_key="$(aws configure get aws_secret_access_key --profile $profile)"
|
||||
local aws_session_token="$(aws configure get aws_session_token --profile $profile)"
|
||||
|
||||
|
||||
# First, if the profile has MFA configured, lets get the token and session duration
|
||||
local mfa_serial="$(aws configure get mfa_serial --profile $profile)"
|
||||
|
||||
if [[ -n "$mfa_serial" ]]; then
|
||||
local -a mfa_opt
|
||||
local mfa_token sess_duration
|
||||
echo -n "Please enter your MFA token for $mfa_serial: "
|
||||
read -r mfa_token
|
||||
echo -n "Please enter the session duration in seconds (900-43200; default: 3600, which is the default maximum for a role): "
|
||||
read -r sess_duration
|
||||
mfa_opt=(--serial-number "$mfa_serial" --token-code "$mfa_token" --duration-seconds "${sess_duration:-3600}")
|
||||
|
||||
# Now see whether we need to just MFA for the current role, or assume a different one
|
||||
local role_arn="$(aws configure get role_arn --profile $profile)"
|
||||
|
||||
if [[ -n "$role_arn" ]]; then
|
||||
# Means we need to assume a specified role
|
||||
aws_command=(aws sts assume-role --role-arn "$role_arn" "${mfa_opt[@]}")
|
||||
|
||||
# Check whether external_id is configured to use while assuming the role
|
||||
local external_id="$(aws configure get external_id --profile "$profile")"
|
||||
if [[ -n "$external_id" ]]; then
|
||||
aws_command+=(--external-id "$external_id")
|
||||
fi
|
||||
|
||||
local ext_id="$(aws configure get external_id --profile $1)"
|
||||
local extid_opt=""
|
||||
if [[ -n $ext_id ]]; then
|
||||
extid_opt="--external-id $ext_id"
|
||||
fi
|
||||
# Get source profile to use to assume role
|
||||
local source_profile="$(aws configure get source_profile --profile "$profile")"
|
||||
aws_command+=(--profile="${source_profile:-profile}" --role-session-name "${source_profile:-profile}")
|
||||
|
||||
local profile=$1
|
||||
local source_profile="$(aws configure get source_profile --profile $1)"
|
||||
if [[ -n $source_profile ]]; then
|
||||
profile=$source_profile
|
||||
fi
|
||||
|
||||
echo "Assuming role $role_arn using profile $profile"
|
||||
local assume_cmd=(aws sts assume-role "--profile=$profile" "--role-arn $role_arn" "--role-session-name "$profile"" "$mfa_opt" "$extid_opt")
|
||||
local JSON="$(eval ${assume_cmd[@]})"
|
||||
|
||||
aws_access_key_id="$(echo $JSON | jq -r '.Credentials.AccessKeyId')"
|
||||
aws_secret_access_key="$(echo $JSON | jq -r '.Credentials.SecretAccessKey')"
|
||||
aws_session_token="$(echo $JSON | jq -r '.Credentials.SessionToken')"
|
||||
echo "Assuming role $role_arn using profile ${source_profile:-profile}"
|
||||
else
|
||||
aws_access_key_id="$(aws configure get aws_access_key_id --profile $1)"
|
||||
aws_secret_access_key="$(aws configure get aws_secret_access_key --profile $1)"
|
||||
aws_session_token=""
|
||||
# Means we only need to do MFA
|
||||
aws_command=(aws sts get-session-token --profile="$profile" "${mfa_opt[@]}")
|
||||
echo "Obtaining session token for profile $profile"
|
||||
fi
|
||||
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export AWS_PROFILE=$1
|
||||
export AWS_EB_PROFILE=$1
|
||||
export AWS_ACCESS_KEY_ID=$aws_access_key_id
|
||||
export AWS_SECRET_ACCESS_KEY=$aws_secret_access_key
|
||||
[[ -z "$aws_session_token" ]] && unset AWS_SESSION_TOKEN || export AWS_SESSION_TOKEN=$aws_session_token
|
||||
# Format output of aws command for easier processing
|
||||
aws_command+=(--query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text)
|
||||
|
||||
echo "Switched to AWS Profile: $1";
|
||||
# Run the aws command to obtain credentials
|
||||
local -a credentials
|
||||
credentials=(${(ps:\t:)"$(${aws_command[@]})"})
|
||||
|
||||
if [[ -n "$credentials" ]]; then
|
||||
aws_access_key_id="${credentials[1]}"
|
||||
aws_secret_access_key="${credentials[2]}"
|
||||
aws_session_token="${credentials[3]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Switch to AWS profile
|
||||
if [[ -n "${aws_access_key_id}" && -n "$aws_secret_access_key" ]]; then
|
||||
export AWS_DEFAULT_PROFILE="$profile"
|
||||
export AWS_PROFILE="$profile"
|
||||
export AWS_EB_PROFILE="$profile"
|
||||
export AWS_ACCESS_KEY_ID="$aws_access_key_id"
|
||||
export AWS_SECRET_ACCESS_KEY="$aws_secret_access_key"
|
||||
|
||||
if [[ -n "$aws_session_token" ]]; then
|
||||
export AWS_SESSION_TOKEN="$aws_session_token"
|
||||
else
|
||||
unset AWS_SESSION_TOKEN
|
||||
fi
|
||||
|
||||
echo "Switched to AWS Profile: $profile"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -99,7 +140,7 @@ function aws_profiles() {
|
|||
function _aws_profiles() {
|
||||
reply=($(aws_profiles))
|
||||
}
|
||||
compctl -K _aws_profiles asp aws_change_access_key
|
||||
compctl -K _aws_profiles asp acp aws_change_access_key
|
||||
|
||||
# AWS prompt
|
||||
function aws_prompt_info() {
|
||||
|
@ -107,7 +148,7 @@ function aws_prompt_info() {
|
|||
echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}"
|
||||
}
|
||||
|
||||
if [ "$SHOW_AWS_PROMPT" != false ]; then
|
||||
if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then
|
||||
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
||||
fi
|
||||
|
||||
|
|
|
@ -18,10 +18,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
|||
}
|
||||
|
||||
function battery_pct() {
|
||||
local battery_status="$(ioreg -rc AppleSmartBattery)"
|
||||
local -i capacity=$(sed -n -e '/MaxCapacity/s/^.*"MaxCapacity"\ =\ //p' <<< $battery_status)
|
||||
local -i current=$(sed -n -e '/CurrentCapacity/s/^.*"CurrentCapacity"\ =\ //p' <<< $battery_status)
|
||||
echo $(( current * 100 / capacity ))
|
||||
pmset -g batt | grep -Eo "\d+%" | cut -d% -f1
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
|
|
|
@ -16,3 +16,17 @@ You can also try to color other pages by prefixing the respective command with `
|
|||
```zsh
|
||||
colored git help clone
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
The plugin declares global associative array `less_termcap`, which maps termcap capabilities to escape
|
||||
sequences for the `less` pager. This mapping can be further customized by the user after the plugin is
|
||||
loaded. Check out sources for more.
|
||||
|
||||
For example: `less_termcap[md]` maps to `LESS_TERMCAP_md` which is the escape sequence that tells `less`
|
||||
how to print something in bold. It's currently shown in bold red, but if you want to change it, you
|
||||
can redefine `less_termcap[md]` in your zshrc file, after OMZ is sourced:
|
||||
|
||||
```zsh
|
||||
less_termcap[md]="${fg_bold[blue]}" # this tells less to print bold text in bold blue
|
||||
```
|
||||
|
|
|
@ -1,39 +1,48 @@
|
|||
if [[ "$OSTYPE" = solaris* ]]
|
||||
then
|
||||
if [[ ! -x "$HOME/bin/nroff" ]]
|
||||
then
|
||||
mkdir -p "$HOME/bin"
|
||||
cat > "$HOME/bin/nroff" <<EOF
|
||||
#!/bin/sh
|
||||
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u\$_NROFF_U "\$@"
|
||||
fi
|
||||
#-- Some other invocation of nroff
|
||||
exec /usr/bin/nroff "\$@"
|
||||
EOF
|
||||
chmod +x "$HOME/bin/nroff"
|
||||
fi
|
||||
fi
|
||||
# Requires colors autoload.
|
||||
# See termcap(5).
|
||||
|
||||
# Set up once, and then reuse. This way it supports user overrides after the
|
||||
# plugin is loaded.
|
||||
typeset -AHg less_termcap
|
||||
|
||||
# bold & blinking mode
|
||||
less_termcap[mb]="${fg_bold[red]}"
|
||||
less_termcap[md]="${fg_bold[red]}"
|
||||
less_termcap[me]="${reset_color}"
|
||||
# standout mode
|
||||
less_termcap[so]="${fg_bold[yellow]}${bg[blue]}"
|
||||
less_termcap[se]="${reset_color}"
|
||||
# underlining
|
||||
less_termcap[us]="${fg_bold[green]}"
|
||||
less_termcap[ue]="${reset_color}"
|
||||
|
||||
# Absolute path to this file's directory.
|
||||
typeset __colored_man_pages_dir="${0:A:h}"
|
||||
|
||||
function colored() {
|
||||
command env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER="${commands[less]:-$PAGER}" \
|
||||
_NROFF_U=1 \
|
||||
PATH="$HOME/bin:$PATH" \
|
||||
"$@"
|
||||
local -a environment
|
||||
|
||||
# Convert associative array to plain array of NAME=VALUE items.
|
||||
local k v
|
||||
for k v in "${(@kv)less_termcap}"; do
|
||||
environment+=( "LESS_TERMCAP_${k}=${v}" )
|
||||
done
|
||||
|
||||
# Prefer `less` whenever available, since we specifically configured
|
||||
# environment for it.
|
||||
environment+=( PAGER="${commands[less]:-$PAGER}" )
|
||||
|
||||
# See ./nroff script.
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
environment+=( PATH="${__colored_man_pages_dir}:$PATH" )
|
||||
fi
|
||||
|
||||
command env $environment "$@"
|
||||
}
|
||||
|
||||
# Colorize man and dman/debman (from debian-goodies)
|
||||
function man \
|
||||
dman \
|
||||
debman {
|
||||
colored $0 "$@"
|
||||
dman \
|
||||
debman {
|
||||
colored $0 "$@"
|
||||
}
|
||||
|
|
12
dot_oh-my-zsh/plugins/colored-man-pages/executable_nroff
Normal file
12
dot_oh-my-zsh/plugins/colored-man-pages/executable_nroff
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
# The whole point of this wrapper is to replace emboldening factor -u0 with
|
||||
# -u1 under certain circumstances on Solaris.
|
||||
|
||||
if [ "$1,$2,$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u1 "$@"
|
||||
else
|
||||
# Some other invocation of nroff
|
||||
exec /usr/bin/nroff "$@"
|
||||
fi
|
|
@ -6,7 +6,8 @@ alias cless="colorize_less"
|
|||
ZSH_COLORIZE_PLUGIN_PATH=$0:A
|
||||
|
||||
colorize_check_requirements() {
|
||||
local available_tools=("chroma" "pygmentize")
|
||||
local -a available_tools
|
||||
available_tools=("chroma" "pygmentize")
|
||||
|
||||
if [ -z "$ZSH_COLORIZE_TOOL" ]; then
|
||||
if (( $+commands[pygmentize] )); then
|
||||
|
|
|
@ -154,10 +154,10 @@ unset -f setup_using_opensuse_package setup_using_debian_package setup_using_bas
|
|||
|
||||
if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
|
||||
if (( $+commands[rg] )); then
|
||||
export FZF_DEFAULT_COMMAND='rg --files --hidden'
|
||||
export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"'
|
||||
elif (( $+commands[fd] )); then
|
||||
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
|
||||
elif (( $+commands[ag] )); then
|
||||
export FZF_DEFAULT_COMMAND='ag -l --hidden -g ""'
|
||||
export FZF_DEFAULT_COMMAND='ag -l --hidden -g "" --ignore .git'
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -31,11 +31,14 @@ function work_in_progress() {
|
|||
|
||||
# Check if main exists and use instead of master
|
||||
function git_main_branch() {
|
||||
if [[ -n "$(git branch --list main)" ]]; then
|
||||
echo main
|
||||
else
|
||||
echo master
|
||||
fi
|
||||
local branch
|
||||
for branch in main trunk; do
|
||||
if command git show-ref -q --verify refs/heads/$branch; then
|
||||
echo $branch
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo master
|
||||
}
|
||||
|
||||
#
|
||||
|
|
|
@ -27,19 +27,26 @@ zstyle -T ':completion:*:*:git:*' tag-order && \
|
|||
zstyle -s ":completion:*:*:git:*" script script
|
||||
if [ -z "$script" ]; then
|
||||
local -a locations
|
||||
local e
|
||||
local e bash_completion
|
||||
|
||||
bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) ||
|
||||
bash_completion='/usr/share/bash-completion/completions/'
|
||||
|
||||
locations=(
|
||||
"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
|
||||
"$HOME/.local/share/bash-completion/completions/git"
|
||||
"$(pkg-config --variable=completionsdir bash-completion)"/git
|
||||
'/usr/share/bash-completion/completions/git'
|
||||
"$bash_completion/git"
|
||||
'/etc/bash_completion.d/git' # old debian
|
||||
)
|
||||
for e in $locations; do
|
||||
test -f $e && script="$e" && break
|
||||
done
|
||||
fi
|
||||
|
||||
local old_complete="$functions[complete]"
|
||||
functions[complete]=:
|
||||
GIT_SOURCING_ZSH_COMPLETION=y . "$script"
|
||||
functions[complete]="$old_complete"
|
||||
|
||||
__gitcomp ()
|
||||
{
|
||||
|
@ -105,21 +112,6 @@ __gitcomp_nl ()
|
|||
compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp_nl_append ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
compset -P '*[=:]'
|
||||
compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp_file_direct ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
compadd -f -- ${(f)1} && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp_file ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
@ -127,6 +119,21 @@ __gitcomp_file ()
|
|||
compadd -f -p "${2-}" -- ${(f)1} && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp_direct_append ()
|
||||
{
|
||||
__gitcomp_direct "$@"
|
||||
}
|
||||
|
||||
__gitcomp_nl_append ()
|
||||
{
|
||||
__gitcomp_nl "$@"
|
||||
}
|
||||
|
||||
__gitcomp_file_direct ()
|
||||
{
|
||||
__gitcomp_file "$1" ""
|
||||
}
|
||||
|
||||
_git_zsh ()
|
||||
{
|
||||
__gitcomp "v1.0"
|
||||
|
|
|
@ -3585,7 +3585,6 @@ __git_func_wrap ()
|
|||
# This is NOT a public function; use at your own risk.
|
||||
__git_complete ()
|
||||
{
|
||||
test -n "$ZSH_VERSION" && return
|
||||
local wrapper="__git_wrap${2}"
|
||||
eval "$wrapper () { __git_func_wrap $2 ; }"
|
||||
complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \
|
||||
|
@ -3607,8 +3606,7 @@ if ! git --list-cmds=main >/dev/null 2>&1; then
|
|||
{
|
||||
case "$1" in
|
||||
--list-cmds=*)
|
||||
IFS=, read -r -a cmds <<< "${1##--list-cmds=}"
|
||||
for x in ${cmds[@]}; do
|
||||
while read -r -d ',' x; do
|
||||
case "$x" in
|
||||
nohelpers)
|
||||
;;
|
||||
|
@ -3620,7 +3618,7 @@ if ! git --list-cmds=main >/dev/null 2>&1; then
|
|||
echo ${__git_cmds[$x]}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done <<< "${1##--list-cmds=},"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -9,40 +9,48 @@
|
|||
# -------
|
||||
#
|
||||
# * Dongweiming <ciici123@gmail.com>
|
||||
# * Subhaditya Nath <github.com/subnut>
|
||||
# * Marc Cornellà <github.com/mcornella>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sudo-replace-buffer() {
|
||||
local old=$1 new=$2 space=${2:+ }
|
||||
if [[ ${#LBUFFER} -le ${#old} ]]; then
|
||||
RBUFFER="${space}${BUFFER#$old }"
|
||||
LBUFFER="${new}"
|
||||
else
|
||||
LBUFFER="${new}${space}${LBUFFER#$old }"
|
||||
fi
|
||||
}
|
||||
|
||||
sudo-command-line() {
|
||||
[[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)"
|
||||
|
||||
# Save beginning space
|
||||
local WHITESPACE=""
|
||||
if [[ ${LBUFFER:0:1} == " " ]] ; then
|
||||
if [[ ${LBUFFER:0:1} = " " ]]; then
|
||||
WHITESPACE=" "
|
||||
LBUFFER="${LBUFFER:1}"
|
||||
fi
|
||||
|
||||
if [[ -n $EDITOR && $BUFFER == $EDITOR\ * ]]; then
|
||||
if [[ ${#LBUFFER} -le ${#EDITOR} ]]; then
|
||||
RBUFFER=" ${BUFFER#$EDITOR }"
|
||||
LBUFFER="sudoedit"
|
||||
else
|
||||
LBUFFER="sudoedit ${LBUFFER#$EDITOR }"
|
||||
fi
|
||||
elif [[ $BUFFER == sudoedit\ * ]]; then
|
||||
if [[ ${#LBUFFER} -le 8 ]]; then
|
||||
RBUFFER=" ${BUFFER#sudoedit }"
|
||||
LBUFFER="$EDITOR"
|
||||
else
|
||||
LBUFFER="$EDITOR ${LBUFFER#sudoedit }"
|
||||
fi
|
||||
elif [[ $BUFFER == sudo\ * ]]; then
|
||||
if [[ ${#LBUFFER} -le 4 ]]; then
|
||||
RBUFFER="${BUFFER#sudo }"
|
||||
LBUFFER=""
|
||||
else
|
||||
LBUFFER="${LBUFFER#sudo }"
|
||||
# Get the first part of the typed command and check if it's an alias to $EDITOR
|
||||
# If so, locally change $EDITOR to the alias so that it matches below
|
||||
if [[ -n "$EDITOR" ]]; then
|
||||
local cmd="${${(Az)BUFFER}[1]}"
|
||||
if [[ "${aliases[$cmd]} " = (\$EDITOR|$EDITOR)\ * ]]; then
|
||||
local EDITOR="$cmd"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n $EDITOR && $BUFFER = $EDITOR\ * ]]; then
|
||||
__sudo-replace-buffer "$EDITOR" "sudoedit"
|
||||
elif [[ -n $EDITOR && $BUFFER = \$EDITOR\ * ]]; then
|
||||
__sudo-replace-buffer "\$EDITOR" "sudoedit"
|
||||
elif [[ $BUFFER = sudoedit\ * ]]; then
|
||||
__sudo-replace-buffer "sudoedit" "$EDITOR"
|
||||
elif [[ $BUFFER = sudo\ * ]]; then
|
||||
__sudo-replace-buffer "sudo" ""
|
||||
else
|
||||
LBUFFER="sudo $LBUFFER"
|
||||
fi
|
||||
|
@ -50,7 +58,9 @@ sudo-command-line() {
|
|||
# Preserve beginning space
|
||||
LBUFFER="${WHITESPACE}${LBUFFER}"
|
||||
}
|
||||
|
||||
zle -N sudo-command-line
|
||||
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey -M emacs '\e\e' sudo-command-line
|
||||
bindkey -M vicmd '\e\e' sudo-command-line
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
[The Fuck](https://github.com/nvbn/thefuck) plugin — magnificent app which corrects your previous console command.
|
||||
|
||||
To use it, add thefuck to the plugins array of your zshrc file:
|
||||
|
||||
plugins=(... thefuck)
|
||||
|
||||
## Usage
|
||||
Press `ESC` twice to correct previous console command.
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
#
|
||||
set -e
|
||||
|
||||
# Track if $ZSH was provided
|
||||
custom_zsh=${ZSH:+yes}
|
||||
|
||||
# Default settings
|
||||
ZSH=${ZSH:-~/.oh-my-zsh}
|
||||
REPO=${REPO:-ohmyzsh/ohmyzsh}
|
||||
|
@ -53,12 +56,16 @@ command_exists() {
|
|||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
error() {
|
||||
echo ${RED}"Error: $@"${RESET} >&2
|
||||
fmt_error() {
|
||||
echo ${RED}"Error: $@"${RESET} >&2
|
||||
}
|
||||
|
||||
underline() {
|
||||
echo "$(printf '\033[4m')$@$(printf '\033[24m')"
|
||||
fmt_underline() {
|
||||
echo "$(printf '\033[4m')$@$(printf '\033[24m')"
|
||||
}
|
||||
|
||||
fmt_code() {
|
||||
echo "\`$(printf '\033[38;5;247m')$@${RESET}\`"
|
||||
}
|
||||
|
||||
setup_color() {
|
||||
|
@ -81,71 +88,71 @@ setup_color() {
|
|||
}
|
||||
|
||||
setup_ohmyzsh() {
|
||||
# Prevent the cloned repository from having insecure permissions. Failing to do
|
||||
# so causes compinit() calls to fail with "command not found: compdef" errors
|
||||
# for users with insecure umasks (e.g., "002", allowing group writability). Note
|
||||
# that this will be ignored under Cygwin by default, as Windows ACLs take
|
||||
# precedence over umasks except for filesystems mounted with option "noacl".
|
||||
umask g-w,o-w
|
||||
# Prevent the cloned repository from having insecure permissions. Failing to do
|
||||
# so causes compinit() calls to fail with "command not found: compdef" errors
|
||||
# for users with insecure umasks (e.g., "002", allowing group writability). Note
|
||||
# that this will be ignored under Cygwin by default, as Windows ACLs take
|
||||
# precedence over umasks except for filesystems mounted with option "noacl".
|
||||
umask g-w,o-w
|
||||
|
||||
echo "${BLUE}Cloning Oh My Zsh...${RESET}"
|
||||
echo "${BLUE}Cloning Oh My Zsh...${RESET}"
|
||||
|
||||
command_exists git || {
|
||||
error "git is not installed"
|
||||
exit 1
|
||||
}
|
||||
command_exists git || {
|
||||
fmt_error "git is not installed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$OSTYPE" = cygwin ] && git --version | grep -q msysgit; then
|
||||
error "Windows/MSYS Git is not supported on Cygwin"
|
||||
error "Make sure the Cygwin git package is installed and is first on the \$PATH"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$OSTYPE" = cygwin ] && git --version | grep -q msysgit; then
|
||||
fmt_error "Windows/MSYS Git is not supported on Cygwin"
|
||||
fmt_error "Make sure the Cygwin git package is installed and is first on the \$PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git clone -c core.eol=lf -c core.autocrlf=false \
|
||||
-c fsck.zeroPaddedFilemode=ignore \
|
||||
-c fetch.fsck.zeroPaddedFilemode=ignore \
|
||||
-c receive.fsck.zeroPaddedFilemode=ignore \
|
||||
--depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
|
||||
error "git clone of oh-my-zsh repo failed"
|
||||
exit 1
|
||||
}
|
||||
git clone -c core.eol=lf -c core.autocrlf=false \
|
||||
-c fsck.zeroPaddedFilemode=ignore \
|
||||
-c fetch.fsck.zeroPaddedFilemode=ignore \
|
||||
-c receive.fsck.zeroPaddedFilemode=ignore \
|
||||
--depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
|
||||
fmt_error "git clone of oh-my-zsh repo failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo
|
||||
echo
|
||||
}
|
||||
|
||||
setup_zshrc() {
|
||||
# Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones
|
||||
# with datestamp of installation that moved them aside, so we never actually
|
||||
# destroy a user's original zshrc
|
||||
echo "${BLUE}Looking for an existing zsh config...${RESET}"
|
||||
# Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones
|
||||
# with datestamp of installation that moved them aside, so we never actually
|
||||
# destroy a user's original zshrc
|
||||
echo "${BLUE}Looking for an existing zsh config...${RESET}"
|
||||
|
||||
# Must use this exact name so uninstall.sh can find it
|
||||
OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh
|
||||
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
|
||||
# Skip this if the user doesn't want to replace an existing .zshrc
|
||||
if [ $KEEP_ZSHRC = yes ]; then
|
||||
echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Keeping...${RESET}"
|
||||
return
|
||||
fi
|
||||
if [ -e "$OLD_ZSHRC" ]; then
|
||||
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
|
||||
if [ -e "$OLD_OLD_ZSHRC" ]; then
|
||||
error "$OLD_OLD_ZSHRC exists. Can't back up ${OLD_ZSHRC}"
|
||||
error "re-run the installer again in a couple of seconds"
|
||||
exit 1
|
||||
fi
|
||||
mv "$OLD_ZSHRC" "${OLD_OLD_ZSHRC}"
|
||||
# Must use this exact name so uninstall.sh can find it
|
||||
OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh
|
||||
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
|
||||
# Skip this if the user doesn't want to replace an existing .zshrc
|
||||
if [ $KEEP_ZSHRC = yes ]; then
|
||||
echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Keeping...${RESET}"
|
||||
return
|
||||
fi
|
||||
if [ -e "$OLD_ZSHRC" ]; then
|
||||
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
|
||||
if [ -e "$OLD_OLD_ZSHRC" ]; then
|
||||
fmt_error "$OLD_OLD_ZSHRC exists. Can't back up ${OLD_ZSHRC}"
|
||||
fmt_error "re-run the installer again in a couple of seconds"
|
||||
exit 1
|
||||
fi
|
||||
mv "$OLD_ZSHRC" "${OLD_OLD_ZSHRC}"
|
||||
|
||||
echo "${YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \
|
||||
"${GREEN}Backing up to ${OLD_OLD_ZSHRC}${RESET}"
|
||||
fi
|
||||
echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Backing up to ${OLD_ZSHRC}${RESET}"
|
||||
mv ~/.zshrc "$OLD_ZSHRC"
|
||||
fi
|
||||
echo "${YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \
|
||||
"${GREEN}Backing up to ${OLD_OLD_ZSHRC}${RESET}"
|
||||
fi
|
||||
echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Backing up to ${OLD_ZSHRC}${RESET}"
|
||||
mv ~/.zshrc "$OLD_ZSHRC"
|
||||
fi
|
||||
|
||||
echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
|
||||
echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
|
||||
|
||||
sed "/^export ZSH=/ c\\
|
||||
sed "/^export ZSH=/ c\\
|
||||
export ZSH=\"$ZSH\"
|
||||
" "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztemp
|
||||
mv -f ~/.zshrc-omztemp ~/.zshrc
|
||||
|
@ -154,146 +161,160 @@ export ZSH=\"$ZSH\"
|
|||
}
|
||||
|
||||
setup_shell() {
|
||||
# Skip setup if the user wants or stdin is closed (not running interactively).
|
||||
if [ $CHSH = no ]; then
|
||||
return
|
||||
fi
|
||||
# Skip setup if the user wants or stdin is closed (not running interactively).
|
||||
if [ $CHSH = no ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# If this user's login shell is already "zsh", do not attempt to switch.
|
||||
if [ "$(basename "$SHELL")" = "zsh" ]; then
|
||||
return
|
||||
fi
|
||||
# If this user's login shell is already "zsh", do not attempt to switch.
|
||||
if [ "$(basename -- "$SHELL")" = "zsh" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# If this platform doesn't provide a "chsh" command, bail out.
|
||||
if ! command_exists chsh; then
|
||||
cat <<-EOF
|
||||
I can't change your shell automatically because this system does not have chsh.
|
||||
${BLUE}Please manually change your default shell to zsh${RESET}
|
||||
EOF
|
||||
return
|
||||
fi
|
||||
# If this platform doesn't provide a "chsh" command, bail out.
|
||||
if ! command_exists chsh; then
|
||||
cat <<EOF
|
||||
I can't change your shell automatically because this system does not have chsh.
|
||||
${BLUE}Please manually change your default shell to zsh${RESET}
|
||||
EOF
|
||||
return
|
||||
fi
|
||||
|
||||
echo "${BLUE}Time to change your default shell to zsh:${RESET}"
|
||||
echo "${BLUE}Time to change your default shell to zsh:${RESET}"
|
||||
|
||||
# Prompt for user choice on changing the default login shell
|
||||
printf "${YELLOW}Do you want to change your default shell to zsh? [Y/n]${RESET} "
|
||||
read opt
|
||||
case $opt in
|
||||
y*|Y*|"") echo "Changing the shell..." ;;
|
||||
n*|N*) echo "Shell change skipped."; return ;;
|
||||
*) echo "Invalid choice. Shell change skipped."; return ;;
|
||||
esac
|
||||
# Prompt for user choice on changing the default login shell
|
||||
printf "${YELLOW}Do you want to change your default shell to zsh? [Y/n]${RESET} "
|
||||
read opt
|
||||
case $opt in
|
||||
y*|Y*|"") echo "Changing the shell..." ;;
|
||||
n*|N*) echo "Shell change skipped."; return ;;
|
||||
*) echo "Invalid choice. Shell change skipped."; return ;;
|
||||
esac
|
||||
|
||||
# Check if we're running on Termux
|
||||
case "$PREFIX" in
|
||||
*com.termux*) termux=true; zsh=zsh ;;
|
||||
*) termux=false ;;
|
||||
esac
|
||||
# Check if we're running on Termux
|
||||
case "$PREFIX" in
|
||||
*com.termux*) termux=true; zsh=zsh ;;
|
||||
*) termux=false ;;
|
||||
esac
|
||||
|
||||
if [ "$termux" != true ]; then
|
||||
# Test for the right location of the "shells" file
|
||||
if [ -f /etc/shells ]; then
|
||||
shells_file=/etc/shells
|
||||
elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS
|
||||
shells_file=/usr/share/defaults/etc/shells
|
||||
else
|
||||
error "could not find /etc/shells file. Change your default shell manually."
|
||||
return
|
||||
fi
|
||||
if [ "$termux" != true ]; then
|
||||
# Test for the right location of the "shells" file
|
||||
if [ -f /etc/shells ]; then
|
||||
shells_file=/etc/shells
|
||||
elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS
|
||||
shells_file=/usr/share/defaults/etc/shells
|
||||
else
|
||||
fmt_error "could not find /etc/shells file. Change your default shell manually."
|
||||
return
|
||||
fi
|
||||
|
||||
# Get the path to the right zsh binary
|
||||
# 1. Use the most preceding one based on $PATH, then check that it's in the shells file
|
||||
# 2. If that fails, get a zsh path from the shells file, then check it actually exists
|
||||
if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; then
|
||||
if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then
|
||||
error "no zsh binary found or not present in '$shells_file'"
|
||||
error "change your default shell manually."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# Get the path to the right zsh binary
|
||||
# 1. Use the most preceding one based on $PATH, then check that it's in the shells file
|
||||
# 2. If that fails, get a zsh path from the shells file, then check it actually exists
|
||||
if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; then
|
||||
if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then
|
||||
fmt_error "no zsh binary found or not present in '$shells_file'"
|
||||
fmt_error "change your default shell manually."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# We're going to change the default shell, so back up the current one
|
||||
if [ -n "$SHELL" ]; then
|
||||
echo $SHELL > ~/.shell.pre-oh-my-zsh
|
||||
else
|
||||
grep "^$USER:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zsh
|
||||
fi
|
||||
# We're going to change the default shell, so back up the current one
|
||||
if [ -n "$SHELL" ]; then
|
||||
echo $SHELL > ~/.shell.pre-oh-my-zsh
|
||||
else
|
||||
grep "^$USER:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zsh
|
||||
fi
|
||||
|
||||
# Actually change the default shell to zsh
|
||||
if ! chsh -s "$zsh"; then
|
||||
error "chsh command unsuccessful. Change your default shell manually."
|
||||
else
|
||||
export SHELL="$zsh"
|
||||
echo "${GREEN}Shell successfully changed to '$zsh'.${RESET}"
|
||||
fi
|
||||
# Actually change the default shell to zsh
|
||||
if ! chsh -s "$zsh"; then
|
||||
fmt_error "chsh command unsuccessful. Change your default shell manually."
|
||||
else
|
||||
export SHELL="$zsh"
|
||||
echo "${GREEN}Shell successfully changed to '$zsh'.${RESET}"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
}
|
||||
|
||||
main() {
|
||||
# Run as unattended if stdin is closed
|
||||
if [ ! -t 0 ]; then
|
||||
RUNZSH=no
|
||||
CHSH=no
|
||||
fi
|
||||
# Run as unattended if stdin is not a tty
|
||||
if [ ! -t 0 ]; then
|
||||
RUNZSH=no
|
||||
CHSH=no
|
||||
fi
|
||||
|
||||
# Parse arguments
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--unattended) RUNZSH=no; CHSH=no ;;
|
||||
--skip-chsh) CHSH=no ;;
|
||||
--keep-zshrc) KEEP_ZSHRC=yes ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
# Parse arguments
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--unattended) RUNZSH=no; CHSH=no ;;
|
||||
--skip-chsh) CHSH=no ;;
|
||||
--keep-zshrc) KEEP_ZSHRC=yes ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
setup_color
|
||||
setup_color
|
||||
|
||||
if ! command_exists zsh; then
|
||||
echo "${YELLOW}Zsh is not installed.${RESET} Please install zsh first."
|
||||
exit 1
|
||||
fi
|
||||
if ! command_exists zsh; then
|
||||
echo "${YELLOW}Zsh is not installed.${RESET} Please install zsh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$ZSH" ]; then
|
||||
cat <<-EOF
|
||||
${YELLOW}You already have Oh My Zsh installed.${RESET}
|
||||
You'll need to remove '$ZSH' if you want to reinstall.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
if [ -d "$ZSH" ]; then
|
||||
echo "${YELLOW}The \$ZSH folder already exists ($ZSH).${RESET}"
|
||||
if [ "$custom_zsh" = yes ]; then
|
||||
cat <<EOF
|
||||
|
||||
setup_ohmyzsh
|
||||
setup_zshrc
|
||||
setup_shell
|
||||
You ran the installer with the \$ZSH setting or the \$ZSH variable is
|
||||
exported. You have 3 options:
|
||||
|
||||
printf "$GREEN"
|
||||
cat <<-'EOF'
|
||||
__ __
|
||||
____ / /_ ____ ___ __ __ ____ _____/ /_
|
||||
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
|
||||
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
|
||||
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
|
||||
/____/ ....is now installed!
|
||||
1. Unset the ZSH variable when calling the installer:
|
||||
$(fmt_code "ZSH= sh install.sh")
|
||||
2. Install Oh My Zsh to a directory that doesn't exist yet:
|
||||
$(fmt_code "ZSH=path/to/new/ohmyzsh/folder sh install.sh")
|
||||
3. (Caution) If the folder doesn't contain important information,
|
||||
you can just remove it with $(fmt_code "rm -r $ZSH")
|
||||
|
||||
EOF
|
||||
else
|
||||
echo "You'll need to remove it if you want to reinstall."
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
setup_ohmyzsh
|
||||
setup_zshrc
|
||||
setup_shell
|
||||
|
||||
printf "$GREEN"
|
||||
cat <<'EOF'
|
||||
__ __
|
||||
____ / /_ ____ ___ __ __ ____ _____/ /_
|
||||
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
|
||||
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
|
||||
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
|
||||
/____/ ....is now installed!
|
||||
|
||||
|
||||
EOF
|
||||
cat <<-EOF
|
||||
Before you scream Oh My Zsh! please look over the ~/.zshrc file to select plugins, themes, and options.
|
||||
EOF
|
||||
cat <<EOF
|
||||
Before you scream Oh My Zsh! please look over the ~/.zshrc file to select plugins, themes, and options.
|
||||
|
||||
• Follow us on Twitter: $(underline https://twitter.com/ohmyzsh)
|
||||
• Join our Discord server: $(underline https://discord.gg/ohmyzsh)
|
||||
• Get stickers, shirts, coffee mugs and other swag: $(underline https://shop.planetargon.com/collections/oh-my-zsh)
|
||||
• Follow us on Twitter: $(fmt_underline https://twitter.com/ohmyzsh)
|
||||
• Join our Discord server: $(fmt_underline https://discord.gg/ohmyzsh)
|
||||
• Get stickers, shirts, coffee mugs and other swag: $(fmt_underline https://shop.planetargon.com/collections/oh-my-zsh)
|
||||
|
||||
EOF
|
||||
printf "$RESET"
|
||||
EOF
|
||||
printf "$RESET"
|
||||
|
||||
if [ $RUNZSH = no ]; then
|
||||
echo "${YELLOW}Run zsh to try it out.${RESET}"
|
||||
exit
|
||||
fi
|
||||
if [ $RUNZSH = no ]; then
|
||||
echo "${YELLOW}Run zsh to try it out.${RESET}"
|
||||
exit
|
||||
fi
|
||||
|
||||
exec zsh -l
|
||||
exec zsh -l
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -348,7 +348,7 @@ Powerlevel10k.
|
|||
|
||||
```zsh
|
||||
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
|
||||
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
|
||||
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
|
||||
```
|
||||
|
||||
Users in mainland China can use the official mirror on gitee.com for faster download.<br>
|
||||
|
@ -356,7 +356,7 @@ Users in mainland China can use the official mirror on gitee.com for faster down
|
|||
|
||||
```zsh
|
||||
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/powerlevel10k
|
||||
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
|
||||
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
|
||||
```
|
||||
|
||||
This is the simplest kind of installation and it works even if you are using a plugin manager. Just
|
||||
|
@ -421,14 +421,14 @@ supported by Powerlevel10k.
|
|||
|
||||
```zsh
|
||||
brew install romkatv/powerlevel10k/powerlevel10k
|
||||
echo 'source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
|
||||
echo 'source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
|
||||
```
|
||||
|
||||
### Arch Linux
|
||||
|
||||
```zsh
|
||||
yay -S --noconfirm zsh-theme-powerlevel10k-git
|
||||
echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
|
||||
echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
|
||||
```
|
||||
|
||||
[zsh-theme-powerlevel10k-git](https://aur.archlinux.org/packages/zsh-theme-powerlevel10k-git/)
|
||||
|
@ -564,7 +564,7 @@ applications on your system. Configure your terminal to use this font:
|
|||
- **Guake**: Right Click on an open terminal and open *Preferences*. Under *Appearance*
|
||||
tab, uncheck *Use the system fixed width font* (if not already) and select `MesloLGS NF Regular`.
|
||||
Exit the Preferences dialog by clicking *Close*.
|
||||
- **Alacritty**: Create or open `~/.config/alacritty/alacritty.yml` and and the following section
|
||||
- **Alacritty**: Create or open `~/.config/alacritty/alacritty.yml` and add the following section
|
||||
to it:
|
||||
```yaml
|
||||
font:
|
||||
|
@ -694,10 +694,14 @@ The command to update Powerlevel10k depends on how it was installed.
|
|||
```
|
||||
3. Copy `~/powerlevel10k` from the machine connected to the Internet to the one without Internet
|
||||
access.
|
||||
4. Append the following lines to the bottom of `~/.zshrc` on the machine without Internet access:
|
||||
4. Add `source ~/powerlevel10k/powerlevel10k.zsh-theme` to `~/.zshrc` on the machine without
|
||||
Internet access:
|
||||
```zsh
|
||||
source ~/powerlevel10k/powerlevel10k.zsh-theme
|
||||
unset ZSH_THEME
|
||||
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
|
||||
```
|
||||
5. If `~/.zshrc` on the machine without Internet access sets `ZSH_THEME`, remove that line.
|
||||
```zsh
|
||||
sed -i.bak '/^ZSH_THEME=/d' ~/.zshrc
|
||||
```
|
||||
|
||||
To update, remove `~/powerlevel10k` on both machines and repeat steps 1-3.
|
||||
|
@ -725,15 +729,17 @@ Powerlevel10k defines prompt and nothing else. It sets [prompt-related options](
|
|||
https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/prompt-highlight.png)
|
||||
|
||||
Everything within the highlighted areas on the screenshot is produced by Powerlevel10k.
|
||||
Powerlevel10k has no control over the terminal content or color outside these areas.
|
||||
Powerlevel10k has no control over the terminal content or colors outside these areas.
|
||||
|
||||
Powerlevel10k does not affect:
|
||||
|
||||
- Terminal window title.
|
||||
- Terminal window/tab title.
|
||||
- Colors used by `ls`.
|
||||
- Content and style of command completions.
|
||||
- The behavior of `git` command.
|
||||
- The content and style of <kbd>Tab</kbd> completions.
|
||||
- Command line colors (syntax highlighting, autosuggestions, etc.).
|
||||
- Key bindings.
|
||||
- Aliases.
|
||||
- Prompt parameters other than `PS1` and `RPS1`.
|
||||
- Zsh options other than those [related to prompt](
|
||||
http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting).
|
||||
|
@ -1513,7 +1519,7 @@ theme (so that you end up with no theme) and then installing Powerlevel10k manua
|
|||
|
||||
```zsh
|
||||
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
|
||||
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
|
||||
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
|
||||
```
|
||||
|
||||
This method of installation won't make anything slower or otherwise sub-par.
|
||||
|
|
|
@ -62,7 +62,7 @@ applications on your system. Configure your terminal to use this font:
|
|||
- **Guake**: Right Click on an open terminal and open *Preferences*. Under *Appearance*
|
||||
tab, uncheck *Use the system fixed width font* (if not already) and select `MesloLGS NF Regular`.
|
||||
Exit the Preferences dialog by clicking *Close*.
|
||||
- **Alacritty**: Create or open `~/.config/alacritty/alacritty.yml` and and the following section
|
||||
- **Alacritty**: Create or open `~/.config/alacritty/alacritty.yml` and add the following section
|
||||
to it:
|
||||
```yaml
|
||||
font:
|
||||
|
|
|
@ -11,6 +11,12 @@ fi
|
|||
|
||||
export LC_ALL=C
|
||||
|
||||
if [ -z "${ZSH_VERSION-}" ] && command -v zsh >/dev/null 2>&1; then
|
||||
case "${BASH_VERSION-}" in
|
||||
[0-3].*) exec zsh "$0" "$@";;
|
||||
esac
|
||||
fi
|
||||
|
||||
usage="$(command cat <<\END
|
||||
Usage: build [-m ARCH] [-c CPU] [-d CMD] [-i IMAGE] [-s] [-w]
|
||||
|
||||
|
@ -29,7 +35,7 @@ Options:
|
|||
succeed; on some operating systems this option is not
|
||||
supported; on others it can have partial effect
|
||||
-w automatically download tarballs for dependencies if they
|
||||
don't already exist in ./deps; dependencies are described
|
||||
do not already exist in ./deps; dependencies are described
|
||||
in ./build.info
|
||||
END
|
||||
)"
|
||||
|
@ -159,10 +165,11 @@ case "$gitstatus_kernel" in
|
|||
;;
|
||||
darwin)
|
||||
command mkdir -- "$workdir"/lib
|
||||
command ln -s -- /usr/local/opt/libiconv/lib/libiconv.a "$workdir"/lib
|
||||
brew_prefix="$(command brew --prefix)"
|
||||
command ln -s -- "$brew_prefix"/opt/libiconv/lib/libiconv.a "$workdir"/lib
|
||||
libgit2_cmake_flags="$libgit2_cmake_flags -DUSE_ICONV=ON"
|
||||
libgit2_cflags="$libgit2_cflags -I/usr/local/opt/libiconv/include"
|
||||
gitstatus_cxxflags="$gitstatus_cxxflags -I/usr/local/opt/libiconv/include"
|
||||
libgit2_cflags="$libgit2_cflags -I"$brew_prefix"/opt/libiconv/include"
|
||||
gitstatus_cxxflags="$gitstatus_cxxflags -I"$brew_prefix"/opt/libiconv/include"
|
||||
gitstatus_ldlibs="$gitstatus_ldlibs -liconv"
|
||||
gitstatus_ldflags="$gitstatus_ldflags -L${workdir}/lib"
|
||||
libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=OFF"
|
||||
|
|
|
@ -181,9 +181,10 @@ local build='
|
|||
function build-unix() {
|
||||
local intro flags=(-sw)
|
||||
case $2 in
|
||||
linux-ppc64le);;
|
||||
linux-*) flags+=(-d docker);;
|
||||
darwin-*) intro='PATH="/usr/local/bin:$PATH"';;
|
||||
linux-ppc64le) ;;
|
||||
linux-*) flags+=(-d docker);;
|
||||
darwin-arm64) intro='PATH="/opt/homebrew/bin:$PATH"';;
|
||||
darwin-*) intro='PATH="/usr/local/bin:$PATH"';;
|
||||
esac
|
||||
ssh $1 -- /bin/sh -uex <<<"
|
||||
$intro
|
||||
|
|
|
@ -25,6 +25,7 @@ uname_s_glob="msys_nt-10.0"; uname_m_glob="x86_64"; file="gitstatusd-${uname_
|
|||
# Fallbacks to official gitstatusd binaries.
|
||||
uname_s_glob="cygwin_nt-*"; uname_m_glob="i686"; file="gitstatusd-cygwin_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="c96baef70b81b5a1d46adcc9e93721eaf4bdc295562bdd2baf210a6b416b9911";
|
||||
uname_s_glob="cygwin_nt-*"; uname_m_glob="x86_64"; file="gitstatusd-cygwin_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="18b5be49f6eb9ff1cf25e76d6f2333c7402e686e05ce5b88ca107c80504210d8";
|
||||
uname_s_glob="darwin"; uname_m_glob="arm64"; file="gitstatusd-${uname_s}-x86_64"; version="v1.3.1"; sha256="26d582fe9a0b2090c28e84e5e32a6d42d6988cedff51e41ec5f789512c53b0fc";
|
||||
uname_s_glob="mingw32_nt-*"; uname_m_glob="i686"; file="gitstatusd-msys_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="618d2425c6a22fa3762fe6fe252f9ddb4ed9138df1377e48b2f119cd4875f400";
|
||||
uname_s_glob="mingw32_nt-*"; uname_m_glob="x86_64"; file="gitstatusd-msys_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="bdfae7a7c0fd83d0214a7eabde3b7d8709336bd08697a74d48bea4a04c352676";
|
||||
uname_s_glob="mingw64_nt-*"; uname_m_glob="i686"; file="gitstatusd-msys_nt-10.0-${uname_m}"; version="v1.3.1"; sha256="618d2425c6a22fa3762fe6fe252f9ddb4ed9138df1377e48b2f119cd4875f400";
|
||||
|
|
|
@ -3934,7 +3934,8 @@ function _p9k_vcs_resume() {
|
|||
}
|
||||
|
||||
function _p9k_vcs_gitstatus() {
|
||||
if [[ $_p9k__refresh_reason == precmd ]]; then
|
||||
if [[ $_p9k__refresh_reason == precmd ]] && (( !_p9k__vcs_called )); then
|
||||
typeset -gi _p9k__vcs_called=1
|
||||
if (( $+_p9k__gitstatus_next_dir )); then
|
||||
_p9k__gitstatus_next_dir=$_p9k__cwd_a
|
||||
else
|
||||
|
@ -5597,6 +5598,8 @@ _p9k_prompt_net_iface_sync() {
|
|||
}
|
||||
|
||||
function _p9k_set_prompt() {
|
||||
local -i _p9k__vcs_called
|
||||
|
||||
PROMPT=
|
||||
RPROMPT=
|
||||
[[ $1 == instant_ ]] || PROMPT+='${$((_p9k_on_expand()))+}'
|
||||
|
@ -5755,7 +5758,7 @@ _p9k_set_instant_prompt() {
|
|||
[[ -n $RPROMPT ]] || unset RPROMPT
|
||||
}
|
||||
|
||||
typeset -gri __p9k_instant_prompt_version=30
|
||||
typeset -gri __p9k_instant_prompt_version=38
|
||||
|
||||
_p9k_dump_instant_prompt() {
|
||||
local user=${(%):-%n}
|
||||
|
@ -5771,7 +5774,7 @@ _p9k_dump_instant_prompt() {
|
|||
local -i fd
|
||||
sysopen -a -m 600 -o creat,trunc -u fd -- $tmp || return
|
||||
{
|
||||
[[ $TERM_PROGRAM == Hyper ]] && local hyper='==' || local hyper='!='
|
||||
[[ $TERM == (screen*|tmux*) ]] && local screen='-n' || local screen='-z'
|
||||
local -a display_v=("${_p9k__display_v[@]}")
|
||||
local -i i
|
||||
for ((i = 6; i <= $#display_v; i+=2)); do display_v[i]=show; done
|
||||
|
@ -5782,14 +5785,16 @@ _p9k_dump_instant_prompt() {
|
|||
if [[ -r $gitstatus_dir/install.info ]]; then
|
||||
IFS= read -r gitstatus_header <$gitstatus_dir/install.info || return
|
||||
fi
|
||||
>&$fd print -r -- '[[ -t 0 && -t 1 && -t 2 && -o interactive && -o zle && -o no_xtrace ]] &&
|
||||
! (( ${+__p9k_instant_prompt_disabled} || ZSH_SUBSHELL || ${+ZSH_SCRIPT} || ${+ZSH_EXECUTION_STRING} )) || return 0'
|
||||
>&$fd print -r -- "() {
|
||||
$__p9k_intro_no_locale
|
||||
(( ! \$+__p9k_instant_prompt_disabled )) || return
|
||||
typeset -gi __p9k_instant_prompt_disabled=1 __p9k_instant_prompt_sourced=$__p9k_instant_prompt_version
|
||||
typeset -gi __p9k_instant_prompt_disabled=1
|
||||
[[ \$ZSH_VERSION == ${(q)ZSH_VERSION} && \$ZSH_PATCHLEVEL == ${(q)ZSH_PATCHLEVEL} &&
|
||||
\$TERM_PROGRAM $hyper 'Hyper' && \$+VTE_VERSION == $+VTE_VERSION &&
|
||||
$screen \${(M)TERM:#(screen*|tmux*)} &&
|
||||
\${#\${(M)VTE_VERSION:#(<1-4602>|4801)}} == ${#${(M)VTE_VERSION:#(<1-4602>|4801)}} &&
|
||||
\$POWERLEVEL9K_DISABLE_INSTANT_PROMPT != 'true' &&
|
||||
\$POWERLEVEL9K_INSTANT_PROMPT != 'off' ]] || { __p9k_instant_prompt_sourced=0; return 1; }
|
||||
\$POWERLEVEL9K_INSTANT_PROMPT != 'off' ]] || return
|
||||
typeset -g __p9k_instant_prompt_param_sig=${(q+)_p9k__param_sig}
|
||||
local gitstatus_dir=${(q)gitstatus_dir}
|
||||
local gitstatus_header=${(q)gitstatus_header}
|
||||
|
@ -5800,16 +5805,12 @@ _p9k_dump_instant_prompt() {
|
|||
local -i height=$_POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES
|
||||
local prompt_dir=${(q)prompt_dir}"
|
||||
>&$fd print -r -- '
|
||||
(( _z4h_can_save_restore_screen == 1 )) && height=0
|
||||
local real_gitstatus_header
|
||||
if [[ -r $gitstatus_dir/install.info ]]; then
|
||||
IFS= read -r real_gitstatus_header <$gitstatus_dir/install.info || real_gitstatus_header=borked
|
||||
fi
|
||||
if [[ $real_gitstatus_header != $gitstatus_header ]]; then
|
||||
__p9k_instant_prompt_sourced=0
|
||||
return 1
|
||||
fi
|
||||
[[ $ZSH_SUBSHELL == 0 && -z $ZSH_SCRIPT && -z $ZSH_EXECUTION_STRING &&
|
||||
-t 0 && -t 1 && -t 2 && -o interactive && -o zle && -o no_xtrace ]] || return
|
||||
[[ $real_gitstatus_header == $gitstatus_header ]] || return
|
||||
zmodload zsh/langinfo zsh/terminfo zsh/system || return
|
||||
if [[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]]; then
|
||||
local loc_cmd=$commands[locale]
|
||||
|
@ -5829,11 +5830,18 @@ _p9k_dump_instant_prompt() {
|
|||
local prompt_file=$prompt_dir/prompt-${#pwd}
|
||||
local key=$pwd:$ssh:${(%):-%#}
|
||||
local content
|
||||
if [[ ! -e $prompt_file ]]; then
|
||||
typeset -gi __p9k_instant_prompt_sourced='$__p9k_instant_prompt_version'
|
||||
return 1
|
||||
fi
|
||||
{ content="$(<$prompt_file)" } 2>/dev/null || return
|
||||
local tail=${content##*$rs$key$us}
|
||||
[[ ${#tail} != ${#content} ]] || return
|
||||
if (( ${#tail} == ${#content} )); then
|
||||
typeset -gi __p9k_instant_prompt_sourced='$__p9k_instant_prompt_version'
|
||||
return 1
|
||||
fi
|
||||
local P9K_PROMPT=instant
|
||||
if [[ $P9K_TTY != old ]]; then'
|
||||
if [[ -z $P9K_TTY || $P9K_TTY == old && -n ${_P9K_TTY:#$TTY} ]]; then'
|
||||
if (( _POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS < 0 )); then
|
||||
>&$fd print -r -- ' typeset -gx P9K_TTY=new'
|
||||
else
|
||||
|
@ -5848,6 +5856,7 @@ _p9k_dump_instant_prompt() {
|
|||
fi'
|
||||
fi
|
||||
>&$fd print -r -- ' fi
|
||||
typeset -gx _P9K_TTY=$TTY
|
||||
local -i _p9k__empty_line_i=3 _p9k__ruler_i=3
|
||||
local -A _p9k_display_k=('${(j: :)${(@q)${(kv)_p9k_display_k}}}')
|
||||
local -a _p9k__display_v=('${(j: :)${(@q)display_v}}')
|
||||
|
@ -5957,37 +5966,36 @@ _p9k_dump_instant_prompt() {
|
|||
fi
|
||||
>&$fd print -r -- '
|
||||
trap "unset -m _p9k__\*; unfunction p10k" EXIT
|
||||
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")'
|
||||
if [[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]]; then
|
||||
if [[ $TERM_PROGRAM == Hyper ]]; then
|
||||
local bad_lines=40 bad_columns=100
|
||||
else
|
||||
local bad_lines=24 bad_columns=80
|
||||
fi
|
||||
>&$fd print -r -- '
|
||||
if (( LINES == '$bad_lines' && COLUMNS == '$bad_columns' )); then
|
||||
zmodload -F zsh/stat b:zstat || return
|
||||
zmodload zsh/datetime || return
|
||||
local -a tty_ctime
|
||||
if ! zstat -A tty_ctime +ctime -- $TTY 2>/dev/null || (( tty_ctime[1] + 2 > EPOCHREALTIME )); then
|
||||
local -F deadline=$((EPOCHREALTIME+0.025))
|
||||
local tty_size
|
||||
while true; do
|
||||
if (( EPOCHREALTIME > deadline )) || ! tty_size="$(/bin/stty size 2>/dev/null)" || [[ $tty_size != <->" "<-> ]]; then
|
||||
(( $+_p9k__ruler_i )) || local -i _p9k__ruler_i=1
|
||||
local _p9k__g= _p9k__'$#_p9k_line_segments_right'r= _p9k__'$#_p9k_line_segments_right'r_frame=
|
||||
break
|
||||
fi
|
||||
if [[ $tty_size != "'$bad_lines' '$bad_columns'" ]]; then
|
||||
local lines_columns=(${=tty_size})
|
||||
local LINES=$lines_columns[1]
|
||||
local COLUMNS=$lines_columns[2]
|
||||
break
|
||||
fi
|
||||
done
|
||||
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")
|
||||
if [[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]] && (( $+commands[stty] )); then
|
||||
if [[ $TERM_PROGRAM == Hyper ]]; then
|
||||
local bad_lines=40 bad_columns=100
|
||||
else
|
||||
local bad_lines=24 bad_columns=80
|
||||
fi
|
||||
if (( LINES == bad_lines && COLUMNS == bad_columns )); then
|
||||
zmodload -F zsh/stat b:zstat || return
|
||||
zmodload zsh/datetime || return
|
||||
local -a tty_ctime
|
||||
if ! zstat -A tty_ctime +ctime -- $TTY 2>/dev/null || (( tty_ctime[1] + 2 > EPOCHREALTIME )); then
|
||||
local -F deadline=$((EPOCHREALTIME+0.025))
|
||||
local tty_size
|
||||
while true; do
|
||||
if (( EPOCHREALTIME > deadline )) || ! tty_size="$(command stty size 2>/dev/null)" || [[ $tty_size != <->" "<-> ]]; then
|
||||
(( $+_p9k__ruler_i )) || local -i _p9k__ruler_i=1
|
||||
local _p9k__g= _p9k__'$#_p9k_line_segments_right'r= _p9k__'$#_p9k_line_segments_right'r_frame=
|
||||
break
|
||||
fi
|
||||
if [[ $tty_size != "$bad_lines $bad_columns" ]]; then
|
||||
local lines_columns=(${=tty_size})
|
||||
local LINES=$lines_columns[1]
|
||||
local COLUMNS=$lines_columns[2]
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi'
|
||||
fi
|
||||
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' setopt ksh_arrays'
|
||||
(( __p9k_sh_glob )) && >&$fd print -r -- ' setopt sh_glob'
|
||||
>&$fd print -r -- ' typeset -ga __p9k_used_instant_prompt=("${(@e)_p9k_t[-3,-1]}")'
|
||||
|
@ -6012,15 +6020,13 @@ _p9k_dump_instant_prompt() {
|
|||
fi
|
||||
_p9k__ret=$x
|
||||
}
|
||||
local out'
|
||||
[[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]] && >&$fd print -r -- ' if (( ! $+_p9k__g )); then'
|
||||
>&$fd print -r -- '
|
||||
local mark=${(e)PROMPT_EOL_MARK}
|
||||
[[ $mark == "%B%S%#%s%b" ]] && _p9k__ret=1 || _p9k_prompt_length $mark
|
||||
local -i fill=$((COLUMNS > _p9k__ret ? COLUMNS - _p9k__ret : 0))
|
||||
out+="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}"'
|
||||
[[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]] && >&$fd print -r -- ' fi'
|
||||
>&$fd print -r -- '
|
||||
local out
|
||||
if [[ $+VTE_VERSION == 0 && $TERM_PROGRAM != Hyper ]] || (( ! $+_p9k__g )); then
|
||||
local mark=${(e)PROMPT_EOL_MARK}
|
||||
[[ $mark == "%B%S%#%s%b" ]] && _p9k__ret=1 || _p9k_prompt_length $mark
|
||||
local -i fill=$((COLUMNS > _p9k__ret ? COLUMNS - _p9k__ret : 0))
|
||||
out+="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}"
|
||||
fi
|
||||
out+="${(pl.$height..$lf.)}$esc${height}A$terminfo[sc]"
|
||||
out+=${(%):-"$__p9k_used_instant_prompt[1]$__p9k_used_instant_prompt[2]"}
|
||||
if [[ -n $__p9k_used_instant_prompt[3] ]]; then
|
||||
|
@ -6040,6 +6046,10 @@ _p9k_dump_instant_prompt() {
|
|||
exec {__p9k_fd_0}<&0 {__p9k_fd_1}>&1 {__p9k_fd_2}>&2 0<&$fd_null 1>$__p9k_instant_prompt_output
|
||||
exec 2>&1 {fd_null}>&-
|
||||
typeset -gi __p9k_instant_prompt_active=1
|
||||
if (( _z4h_can_save_restore_screen == 1 )); then
|
||||
typeset -g _z4h_saved_screen
|
||||
-z4h-save-screen
|
||||
fi
|
||||
typeset -g __p9k_instant_prompt_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
|
||||
if builtin source $__p9k_instant_prompt_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
|
||||
_p9k_preinit
|
||||
|
@ -6051,6 +6061,10 @@ _p9k_dump_instant_prompt() {
|
|||
exec 0<&$__p9k_fd_0 1>&$__p9k_fd_1 2>&$__p9k_fd_2 {__p9k_fd_0}>&- {__p9k_fd_1}>&- {__p9k_fd_2}>&-
|
||||
unset __p9k_fd_0 __p9k_fd_1 __p9k_fd_2
|
||||
typeset -gi __p9k_instant_prompt_erased=1
|
||||
if (( _z4h_can_save_restore_screen == 1 && __p9k_instant_prompt_sourced >= 35 )); then
|
||||
-z4h-restore-screen
|
||||
unset _z4h_saved_screen
|
||||
fi
|
||||
print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
|
||||
if [[ -s $__p9k_instant_prompt_output ]]; then
|
||||
command cat $__p9k_instant_prompt_output 2>/dev/null
|
||||
|
@ -6081,7 +6095,8 @@ _p9k_dump_instant_prompt() {
|
|||
zshexit_functions=(_p9k_instant_prompt_cleanup $zshexit_functions)
|
||||
precmd_functions=(_p9k_instant_prompt_precmd_first $precmd_functions)
|
||||
DISABLE_UPDATE_PROMPT=true
|
||||
} && unsetopt prompt_cr prompt_sp || true'
|
||||
} && unsetopt prompt_cr prompt_sp && typeset -gi __p9k_instant_prompt_sourced='$__p9k_instant_prompt_version' ||
|
||||
typeset -gi __p9k_instant_prompt_sourced=${__p9k_instant_prompt_sourced:-0}'
|
||||
} always {
|
||||
exec {fd}>&-
|
||||
}
|
||||
|
@ -6245,6 +6260,10 @@ function _p9k_clear_instant_prompt() {
|
|||
local -i fill=$((COLUMNS > _p9k__ret ? COLUMNS - _p9k__ret : 0))
|
||||
local cr=$'\r'
|
||||
local sp="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}"
|
||||
if (( _z4h_can_save_restore_screen == 1 && __p9k_instant_prompt_sourced >= 35 )); then
|
||||
-z4h-restore-screen
|
||||
unset _z4h_saved_screen
|
||||
fi
|
||||
print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
|
||||
local unexpected=${${${(S)content//$'\e[?'<->'c'}//$'\e['<->' q'}//$'\e'[^$'\a\e']#($'\a'|$'\e\\')}
|
||||
if [[ -n $unexpected ]]; then
|
||||
|
@ -6305,6 +6324,10 @@ function _p9k_clear_instant_prompt() {
|
|||
} 2>/dev/null
|
||||
else
|
||||
zf_rm -f -- $__p9k_instant_prompt_output 2>/dev/null
|
||||
if (( _z4h_can_save_restore_screen == 1 && __p9k_instant_prompt_sourced >= 35 )); then
|
||||
-z4h-restore-screen
|
||||
unset _z4h_saved_screen
|
||||
fi
|
||||
print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
|
||||
fi
|
||||
prompt_opts=(percent subst sp cr)
|
||||
|
@ -6412,7 +6435,7 @@ function _p9k_on_expand() {
|
|||
zle -F $_p9k__state_dump_fd _p9k_do_dump
|
||||
fi
|
||||
|
||||
if (( ! $+P9K_TTY )); then
|
||||
if [[ -z $P9K_TTY || $P9K_TTY == old && -n ${_P9K_TTY:#$TTY} ]]; then
|
||||
typeset -gx P9K_TTY=old
|
||||
if (( _POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS < 0 )); then
|
||||
P9K_TTY=new
|
||||
|
@ -6425,6 +6448,8 @@ function _p9k_on_expand() {
|
|||
fi
|
||||
fi
|
||||
|
||||
typeset -gx _P9K_TTY=$TTY
|
||||
|
||||
__p9k_reset_state=1
|
||||
|
||||
if (( _POWERLEVEL9K_PROMPT_ADD_NEWLINE )); then
|
||||
|
@ -6611,6 +6636,7 @@ _p9k_precmd_impl() {
|
|||
local -F start_time=EPOCHREALTIME
|
||||
unset _p9k__vcs
|
||||
unset _p9k__vcs_timeout
|
||||
local -i _p9k__vcs_called
|
||||
_p9k_vcs_gitstatus
|
||||
local -i fast_vcs=1
|
||||
fi
|
||||
|
@ -6682,6 +6708,8 @@ _p9k_precmd() {
|
|||
# See https://www.zsh.org/mla/workers/2020/msg00612.html for the reason behind __p9k_trapint.
|
||||
typeset -g __p9k_trapint='_p9k_trapint; return 130'
|
||||
trap "$__p9k_trapint" INT
|
||||
|
||||
: ${(%):-%b%k%s%u}
|
||||
}
|
||||
|
||||
function _p9k_reset_prompt() {
|
||||
|
@ -7346,33 +7374,37 @@ function _p9k_on_widget_zle-line-init() {
|
|||
function _p9k_on_widget_zle-line-finish() {
|
||||
(( $+_p9k__line_finished )) && return
|
||||
|
||||
local P9K_PROMPT=transient
|
||||
|
||||
_p9k__line_finished=
|
||||
(( _p9k_reset_on_line_finish )) && __p9k_reset_state=2
|
||||
(( $+functions[p10k-on-post-prompt] )) && p10k-on-post-prompt
|
||||
|
||||
local -i optimized
|
||||
|
||||
if [[ -n $_p9k_transient_prompt ]]; then
|
||||
if [[ $_POWERLEVEL9K_TRANSIENT_PROMPT == always || $_p9k__cwd == $_p9k__last_prompt_pwd ]]; then
|
||||
RPROMPT=
|
||||
PROMPT=$_p9k_transient_prompt
|
||||
optimized=1
|
||||
__p9k_reset_state=2
|
||||
else
|
||||
_p9k__last_prompt_pwd=$_p9k__cwd
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $1 == int ]]; then
|
||||
_p9k__must_restore_prompt=1
|
||||
if (( !_p9k__restore_prompt_fd )); then
|
||||
sysopen -o cloexec -ru _p9k__restore_prompt_fd /dev/null
|
||||
zle -F $_p9k__restore_prompt_fd _p9k_restore_prompt
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( __p9k_reset_state == 2 )); then
|
||||
if [[ $1 == int ]]; then
|
||||
_p9k__must_restore_prompt=1
|
||||
if (( !_p9k__restore_prompt_fd )); then
|
||||
sysopen -o cloexec -ru _p9k__restore_prompt_fd /dev/null
|
||||
zle -F $_p9k__restore_prompt_fd _p9k_restore_prompt
|
||||
fi
|
||||
if (( optimized )); then
|
||||
RPROMPT= PROMPT=$_p9k_transient_prompt _p9k_reset_prompt
|
||||
else
|
||||
_p9k_reset_prompt
|
||||
fi
|
||||
if (( $+termcap[up] )); then
|
||||
(( _p9k__can_hide_cursor )) && local hide=$terminfo[civis] || local hide=
|
||||
echo -nE - $hide$'\n'$termcap[up]
|
||||
fi
|
||||
_p9k_reset_prompt
|
||||
fi
|
||||
|
||||
_p9k__line_finished='%{%}'
|
||||
|
@ -7427,7 +7459,7 @@ function _p9k_widget_hook() {
|
|||
|
||||
eval "$__p9k_intro"
|
||||
(( _p9k__restore_prompt_fd )) && _p9k_restore_prompt $_p9k__restore_prompt_fd
|
||||
if [[ $1 == clear-screen ]]; then
|
||||
if [[ $1 == (clear-screen|z4h-clear-screen-*-top) ]]; then
|
||||
P9K_TTY=new
|
||||
_p9k__expanded=0
|
||||
_p9k_reset_prompt
|
||||
|
@ -7499,6 +7531,8 @@ function _p9k_wrap_widgets() {
|
|||
visual-line-mode
|
||||
deactivate-region
|
||||
clear-screen
|
||||
z4h-clear-screen-soft-top
|
||||
z4h-clear-screen-hard-top
|
||||
send-break
|
||||
$_POWERLEVEL9K_HOOK_WIDGETS
|
||||
)
|
||||
|
@ -7899,13 +7933,13 @@ _p9k_must_init() {
|
|||
[[ $sig == $_p9k__param_sig ]] && return 1
|
||||
_p9k_deinit
|
||||
fi
|
||||
_p9k__param_pat=$'v108\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
|
||||
_p9k__param_pat=$'v109\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
|
||||
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
|
||||
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
|
||||
_p9k__param_pat+=$'$GITSTATUS_CACHE_DIR\1$GITSTATUS_AUTO_INSTALL\1${ZLE_RPROMPT_INDENT:-1}\1'
|
||||
_p9k__param_pat+=$'$__p9k_sh_glob\1$__p9k_ksh_arrays\1$ITERM_SHELL_INTEGRATION_INSTALLED\1'
|
||||
_p9k__param_pat+=$'${PROMPT_EOL_MARK-%B%S%#%s%b}\1$commands[locale]\1$langinfo[CODESET]\1'
|
||||
_p9k__param_pat+=$'$VTE_VERSION\1$TERM_PROGRAM\1$DEFAULT_USER\1$P9K_SSH\1$commands[uname]\1'
|
||||
_p9k__param_pat+=$'${PROMPT_EOL_MARK-%B%S%#%s%b}\1$+commands[locale]\1$langinfo[CODESET]\1'
|
||||
_p9k__param_pat+=$'${(M)VTE_VERSION:#(<1-4602>|4801)}\1$DEFAULT_USER\1$P9K_SSH\1$+commands[uname]\1'
|
||||
_p9k__param_pat+=$'$__p9k_root_dir\1$functions[p10k-on-init]\1$functions[p10k-on-pre-prompt]\1'
|
||||
_p9k__param_pat+=$'$functions[p10k-on-post-widget]\1$functions[p10k-on-post-prompt]\1'
|
||||
_p9k__param_pat+=$'$+commands[git]\1$terminfo[colors]'
|
||||
|
@ -8325,6 +8359,11 @@ _p9k_init() {
|
|||
_p9k_dumped_instant_prompt_sigs=()
|
||||
fi
|
||||
|
||||
if (( $+__p9k_instant_prompt_sourced && __p9k_instant_prompt_sourced != __p9k_instant_prompt_version )); then
|
||||
_p9k_delete_instant_prompt
|
||||
_p9k_dumped_instant_prompt_sigs=()
|
||||
fi
|
||||
|
||||
if (( $+__p9k_instant_prompt_erased )); then
|
||||
unset __p9k_instant_prompt_erased
|
||||
{
|
||||
|
@ -8388,7 +8427,7 @@ _p9k_deinit() {
|
|||
fi
|
||||
(( $+_p9k__iterm2_precmd )) && functions[iterm2_precmd]=$_p9k__iterm2_precmd
|
||||
(( $+_p9k__iterm2_decorate_prompt )) && functions[iterm2_decorate_prompt]=$_p9k__iterm2_decorate_prompt
|
||||
unset -m '(_POWERLEVEL9K_|P9K_|_p9k_)*~(P9K_SSH|P9K_TTY)'
|
||||
unset -m '(_POWERLEVEL9K_|P9K_|_p9k_)*~(P9K_SSH|P9K_TTY|_P9K_TTY)'
|
||||
[[ -n $__p9k_locale ]] || unset __p9k_locale
|
||||
}
|
||||
|
||||
|
@ -8800,10 +8839,5 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p
|
|||
zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null
|
||||
fi
|
||||
|
||||
if [[ $+__p9k_instant_prompt_sourced == 1 && $__p9k_instant_prompt_sourced != $__p9k_instant_prompt_version ]]; then
|
||||
_p9k_delete_instant_prompt
|
||||
zf_rm -f -- $__p9k_dump_file{,.zwc} 2>/dev/null
|
||||
fi
|
||||
|
||||
_p9k_init_ssh
|
||||
prompt_powerlevel9k_setup
|
||||
|
|
Loading…
Reference in a new issue