summaryrefslogtreecommitdiff
path: root/lua/functions.lua
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-02 20:02:42 +0200
committerHampusM <hampus@hampusmat.com>2024-06-02 20:02:42 +0200
commit0d380e8916a7ddf89193a76bd711ae1661ae9b44 (patch)
treee98f1bbae2eebef31fa775051cd07a41a017ba11 /lua/functions.lua
parentedfa7f32e71b6bd435fd47917bddb47ddedc02ab (diff)
prevent terminal appearing in buffer search
Diffstat (limited to 'lua/functions.lua')
-rw-r--r--lua/functions.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/lua/functions.lua b/lua/functions.lua
index 8e89c2f..07f8868 100644
--- a/lua/functions.lua
+++ b/lua/functions.lua
@@ -98,6 +98,24 @@ function _G.toggle_nerdtree()
)
end
+function _G.search_buffers()
+ local spec = vim.fn["fzf#vim#with_preview"]({ placeholder = "{1}" })
+
+ local nerdtree_buffer = vim.api.nvim_win_get_buf(get_nerdtree_win_id())
+
+ local buffers = table.filter(
+ vim.api.nvim_list_bufs(),
+ function(buffer)
+ return
+ vim.api.nvim_buf_is_loaded(buffer) and
+ buffer ~= nerdtree_buffer and
+ buffer ~= vim.g.term_buf
+ end
+ )
+
+ vim.fn["fzf#vim#buffers"]("", buffers, spec, 0)
+end
+
function _G.get_current_file()
return vim.fn.expand("%")
end