From f70cd6aad820d2559aed59da1289df49183d9fea Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Fri, 2 Sep 2022 21:18:34 +0100 Subject: [PATCH] fix: remove the completion buffer from the buffer list You will no longer see the completion "Buffers" in the list of buffers when searching for buffers. Fixes-issue: #7 --- plugin/ivy.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/ivy.lua b/plugin/ivy.lua index e6351d3..2ec73a7 100644 --- a/plugin/ivy.lua +++ b/plugin/ivy.lua @@ -27,7 +27,8 @@ vim.api.nvim_create_user_command("IvyBuffers", function() -- substring +2 to remove the `/` from the start of the path to give us a -- true relative path local buffer_name = vim.api.nvim_buf_get_name(buffer):sub(#vim.fn.getcwd() + 2, -1) - if vim.api.nvim_buf_is_loaded(buffer) and #buffer_name > 0 then + local file_type = vim.api.nvim_buf_get_option(buffer, "filetype") + if vim.api.nvim_buf_is_loaded(buffer) and file_type ~= "ivy" and #buffer_name > 0 then local score = libivy.ivy_match(input, buffer_name) if score > -200 or #input == 0 then table.insert(list, { score = score, content = buffer_name })