From daedb5a164ecd85d57f9200ff58af265f4590e59 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Fri, 26 Aug 2022 00:49:54 +0200 Subject: [PATCH] neovim: Add floating VCS shell --- home/config/nvim/nifoc/keymap.fnl | 2 ++ home/config/nvim/nifoc/repl.fnl | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/home/config/nvim/nifoc/keymap.fnl b/home/config/nvim/nifoc/keymap.fnl index a6c5795..f68c81b 100644 --- a/home/config/nvim/nifoc/keymap.fnl +++ b/home/config/nvim/nifoc/keymap.fnl @@ -48,6 +48,8 @@ #(telescope-builtin.git_branches telescope-dropdown) {:desc "List VCS Branches"}) (keymap.set :n :vl gitsigns.blame_line {:desc "Blame Line"}) + (keymap.set :n :vc #(repl.toggle-specific-shell :vcs) + {:desc "Toggle VCS Shell"}) (keymap.set :n :lk telescope-builtin.keymaps {:desc "Show Keymappings"}) (keymap.set :n :ld #(telescope-builtin.diagnostics telescope-ivy) diff --git a/home/config/nvim/nifoc/repl.fnl b/home/config/nvim/nifoc/repl.fnl index 26de063..1bc9a4e 100644 --- a/home/config/nvim/nifoc/repl.fnl +++ b/home/config/nvim/nifoc/repl.fnl @@ -4,8 +4,8 @@ (fn repl-setup [] (set vim.b.nifoc_shell_mode :REPL)) - (fn shell-setup [] - (set vim.b.nifoc_shell_mode :SHELL)) + (fn generic-setup [label] + (set vim.b.nifoc_shell_mode label)) (local elixir (terminal:new {:cmd :iex :on_open repl-setup @@ -17,7 +17,7 @@ :on_open repl-setup :close_on_exit true})) (local fish (terminal:new {:cmd :fish - :on_open shell-setup + :on_open #(generic-setup :SHELL) :close_on_exit true})) (local javascript (terminal:new {:cmd :node :on_open repl-setup @@ -29,6 +29,13 @@ (terminal:new {:cmd :irb :on_open repl-setup :close_on_exit true})) ;; Map filetype to REPL (local repl-map {: elixir : erlang : fennel : fish : javascript : nix : ruby}) + ;; Various specific shell windows + (local specific-shell + {:vcs (terminal:new {:cmd :fish + :on_open #(generic-setup :VCS) + :direction :float + :close_on_exit true + :float_opts {:border :rounded}})}) (fn mod.toggle-shell [] (let [shell (. repl-map :fish)] @@ -40,5 +47,9 @@ (when (not= repl nil) (repl:toggle)))) + (fn mod.toggle-specific-shell [name] + (let [shell (. specific-shell name)] + (shell:toggle))) + mod)