From c76b54491dd13de34e4e3f144544506b1988df2c Mon Sep 17 00:00:00 2001
From: Gustaf Rydholm <gustaf.rydholm@gmail.com>
Date: Mon, 30 May 2022 21:28:23 +0200
Subject: Add window-picker

---
 fnl/config/init.fnl          | 1 +
 fnl/config/which-key.fnl     | 8 +++++++-
 fnl/config/window-picker.fnl | 7 +++++++
 fnl/plugins.fnl              | 3 ++-
 4 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 fnl/config/window-picker.fnl

(limited to 'fnl')

diff --git a/fnl/config/init.fnl b/fnl/config/init.fnl
index e4785e5..7c49270 100644
--- a/fnl/config/init.fnl
+++ b/fnl/config/init.fnl
@@ -20,4 +20,5 @@
                               config.which-key
                               config.zen
                               config.trim
+                              config.window-picker
                               config.lsp]})
diff --git a/fnl/config/which-key.fnl b/fnl/config/which-key.fnl
index 70080b7..db9f4f4 100644
--- a/fnl/config/which-key.fnl
+++ b/fnl/config/which-key.fnl
@@ -1,5 +1,5 @@
 ;; Which-key provides a pop-up meny for some key mappings.
-(module config.which-key {autoload {util util}})
+(module config.which-key {autoload {util util nvim aniseed.nvim}})
 
 (def- setup {:plugins {:marks true
                        :registers true
@@ -110,6 +110,12 @@
                "Replace Word"]
            :f ["<cmd>lua require('spectre').open_file_search()<cr>"
                "Replace Buffer"]}
+       :w [(fn switch-window []
+             (let [window-picker (require :window-picker)]
+               (let [win (window-picker.pick_window)]
+                 (if (not= win nil)
+                     (nvim.set_current_win win)))))
+           "Switch window"]
        :T {:name :Treesitter :p [:<cmd>TSPlaygroundToggle<cr> :Playground]}})
 
 (def- vopts {:mode :v
diff --git a/fnl/config/window-picker.fnl b/fnl/config/window-picker.fnl
new file mode 100644
index 0000000..51d7fb4
--- /dev/null
+++ b/fnl/config/window-picker.fnl
@@ -0,0 +1,7 @@
+;; Trim whitespaces on save.
+(module config.window-picker {autoload {util util}})
+
+(let [window-picker (util.load-plugin :window-picker)]
+  (window-picker.setup {:other_win_hl_color "#171717"
+                        :fg_color "#E1E1E1"
+                        :selection_chars :MNEIOARSTG}))
diff --git a/fnl/plugins.fnl b/fnl/plugins.fnl
index 49f413c..3207daf 100644
--- a/fnl/plugins.fnl
+++ b/fnl/plugins.fnl
@@ -61,4 +61,5 @@
               :norcalli/nvim-colorizer.lua {}
               :max397574/better-escape.nvim {}
               :nvim-orgmode/orgmode {}
-              :cappyzawa/trim.nvim {}})
+              :cappyzawa/trim.nvim {}
+              :s1n7ax/nvim-window-picker {}})
-- 
cgit v1.2.3-70-g09d2