diff --git a/.config/sway/config b/.config/sway/config index 186c3f1..77aa3b2 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -345,7 +345,7 @@ bindsym $mod+F5 \ # # 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="Picture-in-Picture"] floating enable, sticky enable for_window [title="Picture-in-picture"] floating enable, sticky enable diff --git a/.local/bin/stignore-gen b/.local/bin/stignore-gen index 46bf1c9..142f10a 100755 --- a/.local/bin/stignore-gen +++ b/.local/bin/stignore-gen @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from typing import Optional, Iterable from pathlib import Path @@ -29,6 +29,7 @@ def write_line(path: Path, line: str): def resolve(parent: Path, line: str) -> Iterable[str]: if line.startswith("#") or len(line.strip()) == 0: return + negate = line.startswith("!") path = line.removeprefix("!").strip() absolute = "/" in line.removesuffix("/") @@ -37,6 +38,7 @@ def resolve(parent: Path, line: str) -> Iterable[str]: if negate: prefix += "!" else: + # gitignore lines to recursively delete if ( "target" in path or "generated" in path @@ -46,6 +48,9 @@ def resolve(parent: Path, line: str) -> Iterable[str]: or "node_modules" in path ): prefix += "(?d)" + # gitignore lines to exclude + if "[._]" in path: + return yield "// " + str(parent) + ": " + line.strip() if absolute: @@ -74,14 +79,18 @@ if __name__ == "__main__": parser.add_argument( "-w", "--write", action="store_const", const=True, default=False ) + parser.add_argument( + "path", type=Path, nargs="*", default=[Path(".")] + ) args = parser.parse_args() if args.write: ignore = Path(".stignore") ignore_gen = Path(".stignore.gen") with open(ignore_gen, "w") as f: - for line in scan(Path(".")): - f.write(line + "\n") + for path in args.path: + for line in scan(Path(path)): + f.write(line + "\n") ignore_line = "#include " + str(ignore_gen) if not check_line(ignore, ignore_line): print("WARNING: .stignore does not exist or is missing the include line") @@ -89,7 +98,8 @@ if __name__ == "__main__": if response.lower() == "y": write_line(ignore, ignore_line) else: - for line in scan(Path(".")): - print(line) + for path in args.path: + for line in scan(Path(path)): + print(line) # vim: set et ts=4 sw=4: diff --git a/.zshrc b/.zshrc index a7177e0..6c75f33 100644 --- a/.zshrc +++ b/.zshrc @@ -216,33 +216,31 @@ fi # 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() { - if ! command -v compinit >/dev/null; then - autoload -Uz compinit - compinit - fi - if ! command -v bashcompinit >/dev/null; then - 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' + # Load completions + autoload -Uz compinit + compinit + autoload -Uz bashcompinit + bashcompinit + # Setup fast apps if which mc >/dev/null 2>/dev/null; then complete -o nospace -C mc mc @@ -254,7 +252,7 @@ setup_completion() { slower_functions+=( setup_completion ) setup_completion_more() { # Depends: - setup_completion + #setup_completion if which kubectl >/dev/null 2>/dev/null; then source <(kubectl completion zsh)