From 479d59f0d069e31e9c34b3302180fbed6eaa1d43 Mon Sep 17 00:00:00 2001
From: "Kenneth Benzie (Benie)" <k.benzie83@gmail.com>
Date: Mon, 1 Jan 2018 18:39:10 +0000
Subject: [PATCH] Add autosuggestions plugin

Fish-like autosuggestions for zsh
---
 .conduit.yaml |  3 ++-
 zshrc         | 10 +++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.conduit.yaml b/.conduit.yaml
index cc3daf3..e5c2f6f 100644
--- a/.conduit.yaml
+++ b/.conduit.yaml
@@ -17,6 +17,7 @@
       src: prompt_fresh_setup
       dst: ~/.local/share/zsh/site-functions/prompt_fresh_setup
 - repo:
-    - https://github.com/zsh-users/zsh-syntax-highlighting.git
+    - https://github.com/zsh-users/zsh-autosuggestions.git
     - https://github.com/zsh-users/zsh-history-substring-search.git
+    - https://github.com/zsh-users/zsh-syntax-highlighting.git
 - message: zsh will be the default prompt after next login
diff --git a/zshrc b/zshrc
index 9eeab79..a770cbb 100644
--- a/zshrc
+++ b/zshrc
@@ -3,8 +3,12 @@
 
 # Load plugin scripts
 plugin-load() { source ~/.config/zsh/$1/$1.plugin.zsh }
-plugin-load zsh-syntax-highlighting
+plugin-load zsh-autosuggestions
 plugin-load zsh-history-substring-search
+plugin-load zsh-syntax-highlighting
+
+# Disable non end-of-line autosuggest accept widgets
+ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(end-of-line vi-end-of-line)
 
 # Remove duplicates from history
 setopt hist_ignore_all_dups
@@ -50,6 +54,10 @@ bindkey -M vicmd 'gcc' vi-pound-insert
 
 # TODO: vi-pipe???
 
+# Enable accepting autosuggestions
+bindkey '^O' forward-work
+bindkey '^P' autosuggest-accept
+
 # Enable substring history search with 'j' and 'k'
 bindkey -M vicmd 'k' history-substring-search-up
 bindkey -M vicmd 'j' history-substring-search-down