1
0
Fork 0

neovim: Add floating VCS shell

This commit is contained in:
Daniel Kempkens 2022-08-26 00:49:54 +02:00
parent 199026a401
commit daedb5a164
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 16 additions and 3 deletions

View file

@ -48,6 +48,8 @@
#(telescope-builtin.git_branches telescope-dropdown)
{:desc "List VCS Branches"})
(keymap.set :n :<leader>vl gitsigns.blame_line {:desc "Blame Line"})
(keymap.set :n :<leader>vc #(repl.toggle-specific-shell :vcs)
{:desc "Toggle VCS Shell"})
(keymap.set :n :<leader>lk telescope-builtin.keymaps
{:desc "Show Keymappings"})
(keymap.set :n :<leader>ld #(telescope-builtin.diagnostics telescope-ivy)

View file

@ -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)