From 1b534d96b4689145770363cc6c6877ca7e41a904 Mon Sep 17 00:00:00 2001
From: Gustaf Rydholm <gustaf.rydholm@gmail.com>
Date: Sat, 2 Jul 2022 03:14:04 +0200
Subject: Add lir

---
 fnl/config/alpha.fnl     |  2 +-
 fnl/config/init.fnl      |  1 +
 fnl/config/lir.fnl       | 42 ++++++++++++++++++++++++++++++++++++++++++
 fnl/config/nvim-tree.fnl |  2 +-
 fnl/plugins.fnl          |  1 +
 5 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 fnl/config/lir.fnl

diff --git a/fnl/config/alpha.fnl b/fnl/config/alpha.fnl
index 8265ff0..c269d17 100644
--- a/fnl/config/alpha.fnl
+++ b/fnl/config/alpha.fnl
@@ -24,7 +24,7 @@
   (let [dashboard (require :alpha.themes.dashboard)]
     (set dashboard.section.header.val ascii-art)
     (set dashboard.section.buttons.val
-         [(dashboard.button :f "  Find file" ":Telescope file_browser <CR>")
+         [(dashboard.button :f "  Find file" ":lua require'lir.float'.toggle()<CR>")
           (dashboard.button :e "  New file" ":ene <BAR> startinsert <CR>")
           (dashboard.button :p "  Find project" ":Telescope projects <CR>")
           (dashboard.button :r "  Recently used files"
diff --git a/fnl/config/init.fnl b/fnl/config/init.fnl
index 451e605..b0ec185 100644
--- a/fnl/config/init.fnl
+++ b/fnl/config/init.fnl
@@ -22,4 +22,5 @@
                               config.which-key
                               config.zen
                               config.trim
+                              config.lir
                               config.lsp]})
diff --git a/fnl/config/lir.fnl b/fnl/config/lir.fnl
new file mode 100644
index 0000000..8713b08
--- /dev/null
+++ b/fnl/config/lir.fnl
@@ -0,0 +1,42 @@
+;; Simple file manager.
+(module config.lir {autoload {util util nvim aniseed.nvim}})
+
+(defn- opts [actions mark-actions clipboard-actions]
+       {:show_hidden_files false
+        :devicons_enable true
+        :mappings {:l actions.edit
+                   :<C-s> actions.split
+                   :v actions.vsplit
+                   :<C-t> actions.tabedit
+                   :h actions.up
+                   :q actions.quit
+                   :A actions.mkdir
+                   :a actions.newfile
+                   :r actions.rename
+                   "@" actions.cd
+                   :Y actions.yank_path
+                   :i actions.toggle_show_hidden
+                   :d actions.delete
+                   :J (fn []
+                        (mark-actions.toggle_mark)
+                        (vim.cmd "normal! j"))
+                   :c clipboard-actions.copy
+                   :x clipboard-actions.cut
+                   :p clipboard-actions.paste}
+        :float {:winblend 0
+                :curdir_window {:enable false :highlight_dirname true}
+                :win_opts (fn []
+                            (let [width (math.floor (* vim.o.columns 0.7))
+                                  height (math.floor (* vim.o.lines 0.7))]
+                              {:border :rounded : width : height}))}
+        :hide_cursor false
+        :on_init (fn []
+                   (nvim.buf_set_keymap 0 :x :J
+                                        ":<C-u>lua require(\"lir.mark.actions\").toggle_mark(\"v\")<CR>"
+                                        {:noremap true :silent true}))})
+
+(let [lir (util.load-plugin :lir)]
+  (let [actions (require :lir.actions)
+        mark-actions (require :lir.mark.actions)
+        clipboard-actions (require :lir.clipboard.actions)]
+    (lir.setup (opts actions mark-actions clipboard-actions))))
diff --git a/fnl/config/nvim-tree.fnl b/fnl/config/nvim-tree.fnl
index bf8bfa4..a957259 100644
--- a/fnl/config/nvim-tree.fnl
+++ b/fnl/config/nvim-tree.fnl
@@ -28,7 +28,7 @@
                                                 :cb (tree_cb :close_node)}
                                                {:key :v :cb (tree_cb :vsplit)}]}}
                       :renderer {:icons {:webdev_colors false}}
-                      :hijack_directories {:enable true :auto_open true}
+                      :hijack_directories {:enable false}
                       :update_focused_file {:enable true
                                             :update_cwd true
                                             :ignore_list {}}
diff --git a/fnl/plugins.fnl b/fnl/plugins.fnl
index 76536a8..774e3ec 100644
--- a/fnl/plugins.fnl
+++ b/fnl/plugins.fnl
@@ -64,4 +64,5 @@
               :cappyzawa/trim.nvim {}
               :dstein64/vim-startuptime {}
               :lewis6991/spellsitter.nvim {}
+              :tamago324/lir.nvim {}
               :s1n7ax/nvim-window-picker {}})
-- 
cgit v1.2.3-70-g09d2