diff options
author | lassulus <lassulus@lassul.us> | 2017-07-23 21:39:36 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2017-07-23 21:39:36 +0200 |
commit | c06435596a276f2039ca64b24a90fbb390cadf9c (patch) | |
tree | 5d9b15c67c6697a86cf5417395cf06302c1cd77c /makefu/2configs | |
parent | 8d34735c3099648fb3444d218c78fb3fb7612c46 (diff) | |
parent | 1e3931d983127bb2cf5fc93471bacfc9770e5b08 (diff) |
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/2configs')
-rw-r--r-- | makefu/2configs/git/brain-retiolum.nix | 3 | ||||
-rw-r--r-- | makefu/2configs/zsh-user.nix | 46 |
2 files changed, 47 insertions, 2 deletions
diff --git a/makefu/2configs/git/brain-retiolum.nix b/makefu/2configs/git/brain-retiolum.nix index 18275e3d..05754dc7 100644 --- a/makefu/2configs/git/brain-retiolum.nix +++ b/makefu/2configs/git/brain-retiolum.nix @@ -8,6 +8,7 @@ let krebs-repos = mapAttrs make-krebs-repo { brain = { }; + krebs-secrets = { }; }; @@ -33,7 +34,7 @@ let set-owners repo [ config.krebs.users.makefu ] ++ set-ro-access repo krebsminister; set-ro-access = with git; repo: user: - optional repo.public { + singleton { inherit user; repo = [ repo ]; perm = fetch; diff --git a/makefu/2configs/zsh-user.nix b/makefu/2configs/zsh-user.nix index 453bfbe8..7615f4c0 100644 --- a/makefu/2configs/zsh-user.nix +++ b/makefu/2configs/zsh-user.nix @@ -8,6 +8,7 @@ in users.extraUsers.${mainUser}.shell = "/run/current-system/sw/bin/zsh"; programs.zsh= { enable = true; + enableCompletion = false ; #manually at the end interactiveShellInit = '' HISTSIZE=900001 HISTFILESIZE=$HISTSIZE @@ -29,7 +30,49 @@ in unset SSH_AGENT_PID export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" - ''; + + # fzf + __fsel_fzf() { + local cmd="''${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ + -o -type f -print \ + -o -type d -print \ + -o -type l -print 2> /dev/null | cut -b3-"}" + setopt localoptions pipefail 2> /dev/null + eval "$cmd" | FZF_DEFAULT_OPTS="--height ''${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" $(__fzfcmd) -m "$@" | while read item; do + echo -n "''${(q)item} " + done + local ret=$? + echo + return $ret + } + + __fzf_use_tmux__() { + [ -n "$TMUX_PANE" ] && [ "''${FZF_TMUX:-0}" != 0 ] && [ ''${LINES:-40} -gt 15 ] + } + + __fzfcmd() { + __fzf_use_tmux__ && + echo "fzf-tmux -d''${FZF_TMUX_HEIGHT:-40%}" || echo "fzf" + } + + fzf-file-widget() { + LBUFFER="''${LBUFFER}$(__fsel_fzf)" + local ret=$? + zle redisplay + typeset -f zle-line-init >/dev/null && zle zle-line-init + return $ret + } + zle -N fzf-file-widget + bindkey '^T' fzf-file-widget + + # Auto-Completion + for p in ''${(z)NIX_PROFILES}; do + fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions) + done + autoload -U compinit && compinit + compdef _pass brain + zstyle ':completion::complete:brain::' prefix "$HOME/brain" + ''; promptInit = '' RPROMPT="" @@ -47,5 +90,6 @@ in krebs.per-user.${mainUser}.packages = [ pkgs.nix-zsh-completions + pkgs.fzf ]; } |