Try to improve completion loading
parent
ee2dd3f088
commit
5af918e8a4
|
@ -345,7 +345,7 @@ bindsym $mod+F5 \
|
||||||
#
|
#
|
||||||
# Firefox
|
# Firefox
|
||||||
#
|
#
|
||||||
for_window [title="Firefox — Sharing Indicator"] floating enable
|
for_window [title="Firefox — Sharing Indicator"] floating enable, move position 50 ppt 0 px
|
||||||
for_window [title="About Mozilla Firefox"] floating enable
|
for_window [title="About Mozilla Firefox"] floating enable
|
||||||
for_window [title="Picture-in-Picture"] floating enable, sticky enable
|
for_window [title="Picture-in-Picture"] floating enable, sticky enable
|
||||||
for_window [title="Picture-in-picture"] floating enable, sticky enable
|
for_window [title="Picture-in-picture"] floating enable, sticky enable
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from typing import Optional, Iterable
|
from typing import Optional, Iterable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -29,6 +29,7 @@ def write_line(path: Path, line: str):
|
||||||
def resolve(parent: Path, line: str) -> Iterable[str]:
|
def resolve(parent: Path, line: str) -> Iterable[str]:
|
||||||
if line.startswith("#") or len(line.strip()) == 0:
|
if line.startswith("#") or len(line.strip()) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
negate = line.startswith("!")
|
negate = line.startswith("!")
|
||||||
path = line.removeprefix("!").strip()
|
path = line.removeprefix("!").strip()
|
||||||
absolute = "/" in line.removesuffix("/")
|
absolute = "/" in line.removesuffix("/")
|
||||||
|
@ -37,6 +38,7 @@ def resolve(parent: Path, line: str) -> Iterable[str]:
|
||||||
if negate:
|
if negate:
|
||||||
prefix += "!"
|
prefix += "!"
|
||||||
else:
|
else:
|
||||||
|
# gitignore lines to recursively delete
|
||||||
if (
|
if (
|
||||||
"target" in path
|
"target" in path
|
||||||
or "generated" in path
|
or "generated" in path
|
||||||
|
@ -46,6 +48,9 @@ def resolve(parent: Path, line: str) -> Iterable[str]:
|
||||||
or "node_modules" in path
|
or "node_modules" in path
|
||||||
):
|
):
|
||||||
prefix += "(?d)"
|
prefix += "(?d)"
|
||||||
|
# gitignore lines to exclude
|
||||||
|
if "[._]" in path:
|
||||||
|
return
|
||||||
|
|
||||||
yield "// " + str(parent) + ": " + line.strip()
|
yield "// " + str(parent) + ": " + line.strip()
|
||||||
if absolute:
|
if absolute:
|
||||||
|
@ -74,14 +79,18 @@ if __name__ == "__main__":
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-w", "--write", action="store_const", const=True, default=False
|
"-w", "--write", action="store_const", const=True, default=False
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"path", type=Path, nargs="*", default=[Path(".")]
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.write:
|
if args.write:
|
||||||
ignore = Path(".stignore")
|
ignore = Path(".stignore")
|
||||||
ignore_gen = Path(".stignore.gen")
|
ignore_gen = Path(".stignore.gen")
|
||||||
with open(ignore_gen, "w") as f:
|
with open(ignore_gen, "w") as f:
|
||||||
for line in scan(Path(".")):
|
for path in args.path:
|
||||||
f.write(line + "\n")
|
for line in scan(Path(path)):
|
||||||
|
f.write(line + "\n")
|
||||||
ignore_line = "#include " + str(ignore_gen)
|
ignore_line = "#include " + str(ignore_gen)
|
||||||
if not check_line(ignore, ignore_line):
|
if not check_line(ignore, ignore_line):
|
||||||
print("WARNING: .stignore does not exist or is missing the include line")
|
print("WARNING: .stignore does not exist or is missing the include line")
|
||||||
|
@ -89,7 +98,8 @@ if __name__ == "__main__":
|
||||||
if response.lower() == "y":
|
if response.lower() == "y":
|
||||||
write_line(ignore, ignore_line)
|
write_line(ignore, ignore_line)
|
||||||
else:
|
else:
|
||||||
for line in scan(Path(".")):
|
for path in args.path:
|
||||||
print(line)
|
for line in scan(Path(path)):
|
||||||
|
print(line)
|
||||||
|
|
||||||
# vim: set et ts=4 sw=4:
|
# vim: set et ts=4 sw=4:
|
||||||
|
|
52
.zshrc
52
.zshrc
|
@ -216,33 +216,31 @@ fi
|
||||||
|
|
||||||
# completion
|
# completion
|
||||||
|
|
||||||
|
# Add default completions
|
||||||
|
fpath+="$HOME/.config/zsh-completions"
|
||||||
|
# Style completions
|
||||||
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||||
|
zstyle ':completion:*' auto-description 'specify: %d'
|
||||||
|
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||||
|
zstyle ':completion:*' format '%F{blue}-- %d --%f'
|
||||||
|
zstyle ':completion:*' group-name ''
|
||||||
|
zstyle ':completion:*' menu select=2
|
||||||
|
zstyle ':completion:*' list-colors ''
|
||||||
|
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||||
|
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
||||||
|
zstyle ':completion:*' menu select=long
|
||||||
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||||
|
zstyle ':completion:*' use-compctl false
|
||||||
|
zstyle ':completion:*' verbose true
|
||||||
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||||
|
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
||||||
setup_completion() {
|
setup_completion() {
|
||||||
if ! command -v compinit >/dev/null; then
|
# Load completions
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit
|
compinit
|
||||||
fi
|
autoload -Uz bashcompinit
|
||||||
if ! command -v bashcompinit >/dev/null; then
|
bashcompinit
|
||||||
autoload -Uz bashcompinit
|
|
||||||
bashcompinit
|
|
||||||
fi
|
|
||||||
# Add default completions
|
|
||||||
fpath+="$HOME/.config/zsh-completions"
|
|
||||||
# Style completions
|
|
||||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
|
||||||
zstyle ':completion:*' auto-description 'specify: %d'
|
|
||||||
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
|
||||||
zstyle ':completion:*' format '%F{blue}-- %d --%f'
|
|
||||||
zstyle ':completion:*' group-name ''
|
|
||||||
zstyle ':completion:*' menu select=2
|
|
||||||
zstyle ':completion:*' list-colors ''
|
|
||||||
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
|
||||||
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
|
||||||
zstyle ':completion:*' menu select=long
|
|
||||||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
|
||||||
zstyle ':completion:*' use-compctl false
|
|
||||||
zstyle ':completion:*' verbose true
|
|
||||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
|
||||||
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
|
||||||
# Setup fast apps
|
# Setup fast apps
|
||||||
if which mc >/dev/null 2>/dev/null; then
|
if which mc >/dev/null 2>/dev/null; then
|
||||||
complete -o nospace -C mc mc
|
complete -o nospace -C mc mc
|
||||||
|
@ -254,7 +252,7 @@ setup_completion() {
|
||||||
slower_functions+=( setup_completion )
|
slower_functions+=( setup_completion )
|
||||||
setup_completion_more() {
|
setup_completion_more() {
|
||||||
# Depends:
|
# Depends:
|
||||||
setup_completion
|
#setup_completion
|
||||||
|
|
||||||
if which kubectl >/dev/null 2>/dev/null; then
|
if which kubectl >/dev/null 2>/dev/null; then
|
||||||
source <(kubectl completion zsh)
|
source <(kubectl completion zsh)
|
||||||
|
|
Loading…
Reference in New Issue