Fix bug and remove old code

This commit is contained in:
Alexander Rosenberg 2023-01-03 00:24:32 -08:00
parent 06142dec66
commit bfff035fa1
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 16 additions and 49 deletions

View File

@ -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 :<leader>fq fzf.quickfix)
;; (bind! :n :<leader>fr fzf.registers)
;; (bind! :n :<leader>fj fzf.jumps)
;; (bind! :n :<leader>fa fzf.marks)
;; (bind! :n :<leader>fh fzf.help_tags)
;; (bind! :n :<leader>g fzf.live_grep)
;; (bind! :n :<leader>fg fzf.live_grep)
;; (bind! :n :<leader>G fzf.grep)
;; (bind! :n :<leader>fG fzf.grep)
;; (bind! :n :<leader>b fzf.buffers)
;; (bind! :n :gb fzf.buffers)
;; (bind! :n :<leader>fu fzf.git_status)
;; (bind! :n :<leader>fm fzf.man_pages)
;; (bind! :n :<leader>fe fzf.diagnostics_document)
;; (bind! :n :<leader>fE fzf.diagnostics_workspace)
;; (bind! :n :<leader>d fzf.loclist)
;; (bind! :n :<leader>fp fzf.spell_suggest)
;; (bind! :n :<leader>i fzf.files)
;; (bind! :n :z= fzf.spell_suggest)
;; (bind! :n :<leader>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 :<leader>t jump-or-open-terminal)))
(bind! :n :<leader>t jump-or-open-terminal)
:config
(let [fzf (require :fzf-lua)]
(fzf.register_ui_select)))
;; Nvim surround
(use! :kylechui/nvim-surround

View File

@ -31,14 +31,6 @@
(bind! :n :<leader>d "<cmd>FzfLua lsp_document_symbols<cr>" buf)
(bind! :n :<leader>fd "<cmd>FzfLua lsp_document_symbols<cr>" buf)
(bind! :n :<leader>cn "<cmd>FzfLua lsp_code_actions<cr>" buf))
;; (let [fzf (require :fzf-lua)]
;; (bind! :n :gr fzf.lsp_references buf)
;; (bind! :n :<leader>s fzf.lsp_live_workspace_symbols buf)
;; (bind! :n :<leader>fs fzf.lsp_live_workspace_symbols buf)
;; (bind! :n :<leader>fS fzf.lsp_workspace_symbols buf)
;; (bind! :n :<leader>d fzf.lsp_document_symbols buf)
;; (bind! :n :<leader>fd fzf.lsp_document_symbols buf)
;; (bind! :n :<leader>cn fzf.lsp_code_actions buf)))
(fn get-data-dir [server root]
(let [resolved_path (vim.fn.resolve root)