diff --git a/profiles/desktop/steam.nix b/profiles/desktop/steam.nix index d8b95fd..6ebe5bf 100644 --- a/profiles/desktop/steam.nix +++ b/profiles/desktop/steam.nix @@ -14,10 +14,12 @@ ]; programs.bash.shellInit = '' + if command -v complete >/dev/null; then if [ -n "''${BASH_VERSION:-}" ]; then complete -F _command steam-run # complete -F _command fhs-run fi + fi ''; /** / diff --git a/users/pbsds/home/modules/jump.nix b/users/pbsds/home/modules/jump.nix index ae91ec5..0d40757 100644 --- a/users/pbsds/home/modules/jump.nix +++ b/users/pbsds/home/modules/jump.nix @@ -61,13 +61,15 @@ in { #ls -l "$_JUMP_MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo command ls --color=always -l "$_JUMP_MARKPATH" | tr -s ' ' | cut -d' ' -f9- | sed -e 's/ -> /§/g' | column -t -s '§' -o ' -> ' } - _complete_jump_marks() { - local curw=''${COMP_WORDS[COMP_CWORD]} - local wordlist=($(find "$_JUMP_MARKPATH" -type l -printf "%f\n")) - COMPREPLY=($(compgen -W "''${wordlist[@]}" -- "$curw")) - return 0 - } - complete -F _complete_jump_marks jump unmark + if command -v complete >/dev/null; then + _complete_jump_marks() { + local curw=''${COMP_WORDS[COMP_CWORD]} + local wordlist=($(find "$_JUMP_MARKPATH" -type l -printf "%f\n")) + COMPREPLY=($(compgen -W "''${wordlist[@]}" -- "$curw")) + return 0 + } + complete -F _complete_jump_marks jump unmark + fi ''; in { # TODO: fish diff --git a/users/pbsds/home/profiles/desktop/default.nix b/users/pbsds/home/profiles/desktop/default.nix index 23ace75..07b394d 100644 --- a/users/pbsds/home/profiles/desktop/default.nix +++ b/users/pbsds/home/profiles/desktop/default.nix @@ -29,10 +29,12 @@ # TODO: add remote-exec once packaged programs.bash.initExtra = '' # remote-exec + if command -v complete >/dev/null; then if command -v remote >/dev/null && command -v remote-quick >/dev/null; then complete -F _command remote complete -F _command remote-quick fi + fi ''; home.packages = with pkgs; [ diff --git a/users/pbsds/home/profiles/desktop/sshuttle.nix b/users/pbsds/home/profiles/desktop/sshuttle.nix index 764cb0b..d887daf 100644 --- a/users/pbsds/home/profiles/desktop/sshuttle.nix +++ b/users/pbsds/home/profiles/desktop/sshuttle.nix @@ -13,10 +13,12 @@ sshuttle 0.0.0.0/0 ::/0 --dns -r "$1" -x $ip -x 127.0.0.1 -x 172.0.0.0/8 ) + if command -v complete >/dev/null; then if test -f ~/.ssh/config; then complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" vpn complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" lvpn complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" dvpn fi + fi ''; } diff --git a/users/pbsds/home/profiles/minimal/shell.nix b/users/pbsds/home/profiles/minimal/shell.nix index 9e8a348..872ea0d 100644 --- a/users/pbsds/home/profiles/minimal/shell.nix +++ b/users/pbsds/home/profiles/minimal/shell.nix @@ -32,9 +32,11 @@ in programs.bash.historyIgnore = [ "ls" "file" "cat" "type" "exit" ]; programs.bash.initExtra = '' # tldr + if command -v complete >/dev/null; then if command -v tldr >/dev/null; then complete -F _command tldr fi + fi ''; # ~/.inputrc diff --git a/users/pbsds/home/profiles/minimal/ssh.nix b/users/pbsds/home/profiles/minimal/ssh.nix index 6df8af3..32a5874 100644 --- a/users/pbsds/home/profiles/minimal/ssh.nix +++ b/users/pbsds/home/profiles/minimal/ssh.nix @@ -7,6 +7,7 @@ programs.bash.initExtra = '' # ssh autocomplete + if command -v complete >/dev/null; then if [[ -f ~/.ssh/config ]]; then complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" ssh complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" tssh @@ -19,6 +20,7 @@ complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" remote-add fi fi + fi ''; programs.ssh.enable = true;