all repos — dotfiles @ 55a74361d288fd5959556da9dd1d0c3b9f65fe15

my *nix dotfiles

nvim/lua/fuzzy/edit.lua (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
local fn = vim.fn
local cmd = vim.cmd
local M = {}

function M.fuzzy_edit(fuzzy_cmd)
  fuzzy_cmd = {
    ls_cmd,
    '| zf',
  }

  require('fuzzy/fuzzy').fuzzy_search(table.concat(fuzzy_cmd), function(stdout)
    -- strip '\n'
    local selected, _ = stdout:gsub('\n', '')
    cmd('bd!')
    cmd('e ' .. selected)
  end
  )
end

return M