From bfff035fa1d206644d4b062d4f39268671f00324 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Tue, 3 Jan 2023 00:24:32 -0800 Subject: [PATCH] Fix bug and remove old code --- fnl/plugin.fnl | 57 +++++++++++++--------------------------------- fnl/plugin/lsp.fnl | 8 ------- 2 files changed, 16 insertions(+), 49 deletions(-) diff --git a/fnl/plugin.fnl b/fnl/plugin.fnl index d167ed8..ba09608 100644 --- a/fnl/plugin.fnl +++ b/fnl/plugin.fnl @@ -85,51 +85,26 @@ (if (= code 0) (vim.cmd "FzfLua git_files") (vim.cmd "FzfLua files"))))) - :config - (let [fzf (require :fzf-lua)] - (fzf.register_ui_select) - ;; (bind! :n :fq fzf.quickfix) - ;; (bind! :n :fr fzf.registers) - ;; (bind! :n :fj fzf.jumps) - ;; (bind! :n :fa fzf.marks) - ;; (bind! :n :fh fzf.help_tags) - ;; (bind! :n :g fzf.live_grep) - ;; (bind! :n :fg fzf.live_grep) - ;; (bind! :n :G fzf.grep) - ;; (bind! :n :fG fzf.grep) - ;; (bind! :n :b fzf.buffers) - ;; (bind! :n :gb fzf.buffers) - ;; (bind! :n :fu fzf.git_status) - ;; (bind! :n :fm fzf.man_pages) - ;; (bind! :n :fe fzf.diagnostics_document) - ;; (bind! :n :fE fzf.diagnostics_workspace) - ;; (bind! :n :d fzf.loclist) - ;; (bind! :n :fp fzf.spell_suggest) - ;; (bind! :n :i fzf.files) - ;; (bind! :n :z= fzf.spell_suggest) - ;; (bind! :n :ff (fn [] - ;; (let [code (os.execute "git rev-parse --is-inside-work-tree >/dev/null 2>&1")] - ;; (if (= code 0) - ;; (fzf.git_files) - ;; (fzf.files))))) - (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)] + (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) + (table.insert terms name) + (set term_count (+ term_count 1)) + (set last_id id)))) + (if (= term_count 0) (vim.cmd.terminal) - (= term_count 1) + (= term_count 1) (vim.cmd.buffer last_id) (vim.cmd "FzfLua buffers query=term://"))) - ;;(fzf.buffers { :query "term://" }))) - (bind! :n :t jump-or-open-terminal))) + (bind! :n :t jump-or-open-terminal) + :config + (let [fzf (require :fzf-lua)] + (fzf.register_ui_select))) ;; Nvim surround (use! :kylechui/nvim-surround diff --git a/fnl/plugin/lsp.fnl b/fnl/plugin/lsp.fnl index 92352a0..45a0450 100644 --- a/fnl/plugin/lsp.fnl +++ b/fnl/plugin/lsp.fnl @@ -31,14 +31,6 @@ (bind! :n :d "FzfLua lsp_document_symbols" buf) (bind! :n :fd "FzfLua lsp_document_symbols" buf) (bind! :n :cn "FzfLua lsp_code_actions" buf)) - ;; (let [fzf (require :fzf-lua)] - ;; (bind! :n :gr fzf.lsp_references buf) - ;; (bind! :n :s fzf.lsp_live_workspace_symbols buf) - ;; (bind! :n :fs fzf.lsp_live_workspace_symbols buf) - ;; (bind! :n :fS fzf.lsp_workspace_symbols buf) - ;; (bind! :n :d fzf.lsp_document_symbols buf) - ;; (bind! :n :fd fzf.lsp_document_symbols buf) - ;; (bind! :n :cn fzf.lsp_code_actions buf))) (fn get-data-dir [server root] (let [resolved_path (vim.fn.resolve root)