Make jump to term selector use fzf

This commit is contained in:
2022-12-03 22:54:50 -08:00
parent 7a42c9ecf5
commit af45712b8b
2 changed files with 18 additions and 23 deletions
-22
View File
@@ -81,28 +81,6 @@
#(if (= (vim.fn.buflisted (vim.api.nvim_get_current_buf)) 1)
(set vim.opt_local.spell true)))
(fn jump-or-open-terminal []
"If no terminal buffer exists, create one. Otherwise, open new one."
(var term_count 0)
(var last_id 0)
(var terms [ ])
(each [_ id (pairs (vim.api.nvim_list_bufs))]
(let [name (vim.api.nvim_buf_get_name id)]
(when (vim.startswith name "term://")
(table.insert terms name)
(set term_count (+ term_count 1))
(set last_id id))))
(if (= term_count 0)
(vim.cmd.terminal)
(= term_count 1)
(vim.cmd.buffer last_id)
(vim.ui.select terms
{ :prompt "Terminal Buffers" }
(fn [choice]
(when choice
(vim.cmd.buffer choice))))))
(bind! :n :<leader>t jump-or-open-terminal)
;; Some keybindings for diagnostics
(bind! :n :<leader>e vim.diagnostic.open_float)
(bind! :n "[d" vim.diagnostic.goto_prev)