summaryrefslogtreecommitdiff
path: root/modules/examples
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2017-01-30 23:04:29 +0100
committerDaiderd Jordan <daiderd@gmail.com>2017-01-30 23:04:29 +0100
commit8cdebe9fa917f9eee42c7276ea6cb654868818f0 (patch)
treef502224a085b4ca0230663ac8f09337464e4d072 /modules/examples
parent0c9710c375adc9c098f23a4a6d88f5c4292a75a0 (diff)
add fzf history keybindings for zsh
Diffstat (limited to 'modules/examples')
-rw-r--r--modules/examples/lnl.nix32
1 files changed, 2 insertions, 30 deletions
diff --git a/modules/examples/lnl.nix b/modules/examples/lnl.nix
index 0b21939..a5e46d8 100644
--- a/modules/examples/lnl.nix
+++ b/modules/examples/lnl.nix
@@ -51,7 +51,7 @@
services.nix-daemon.enable = true;
services.nix-daemon.tempDir = "/nix/tmp";
- nix.distributedBuilds = true;
+ # nix.distributedBuilds = true;
nix.extraOptions = "pre-build-hook = ";
nix.binaryCachePublicKeys = [ "cache.daiderd.com-1:R8KOWZ8lDaLojqD+v9dzXAqGn29gEzPTTbr/GIpCTrI=" ];
@@ -152,6 +152,7 @@
programs.zsh.enable = true;
programs.zsh.enableBashCompletion = true;
+ programs.zsh.enableFzfHistory = true;
programs.zsh.variables.cfg = "$HOME/.nixpkgs/darwin-config.nix";
programs.zsh.variables.darwin = "$HOME/.nix-defexpr/darwin";
@@ -184,35 +185,6 @@
bindkey '^[[A' up-line-or-beginning-search
zle -N down-line-or-beginning-search
zle -N up-line-or-beginning-search
-
- __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"
- }
-
- # CTRL-R - Paste the selected command from history into the command line
- fzf-history-widget() {
- local selected num
- setopt localoptions noglobsubst pipefail 2> /dev/null
- selected=( $(fc -l 1 |
- FZF_DEFAULT_OPTS="--height ''${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS +s --tac -n2..,.. --tiebreak=index --toggle-sort=ctrl-r $FZF_CTRL_R_OPTS --query=''${(q)LBUFFER} +m" $(__fzfcmd)) )
- local ret=$?
- if [ -n "$selected" ]; then
- num=$selected[1]
- if [ -n "$num" ]; then
- zle vi-fetch-history -n $num
- fi
- fi
- zle redisplay
- typeset -f zle-line-init >/dev/null && zle zle-line-init
- return $ret
- }
- zle -N fzf-history-widget
- bindkey '^R' fzf-history-widget
'';
environment.variables.HOMEBREW_CASK_OPTS = "--appdir=/Applications/cask";