diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 28c3ffa..485aff1 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -16,5 +16,28 @@ vim.keymap.set('n', '/', fzf.blines, { desc = "Search buffer" }) vim.keymap.set('n', 'g', ":Neogit", { desc = "Git Manager" }) vim.keymap.set('n', 't', ":Neotree", { desc = "File Manager" }) +-- -- configure workspaces -vim.keymap.set('n', 'w', ":WorkspacesOpen", { desc = "Open a workspace" }) +-- also add a custom picker to fzf +-- +local workspaces = require('workspaces') +workspaces_fzf_picker = function(opts) + local fzf_lua = require('fzf-lua') + opts = opts or {} + opts.prompt = "Workspaces> " + opts.actions = { + ['default'] = function(selected) + workspaces.open(selected[1]) + end + } + fzf_lua.fzf_exec(function(fzf_cb) + -- NOP + local ws = workspaces.get() + ws = ws or {} + for i = 1, #ws do + fzf_cb(ws[i].name) + end + fzf_cb() -- EOF + end, opts) +end +vim.keymap.set('n', 'w', workspaces_fzf_picker) diff --git a/lua/plugins.lua b/lua/plugins.lua index 2a654ca..098bf01 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -102,7 +102,7 @@ require("lazy").setup({ expand = 4, keys = { scroll_down = "", -- binding to scroll down inside the popup - scroll_up = "", -- binding to scroll up inside the popup + scroll_up = "", -- binding to scroll up inside the popup }, }, keys = {