|
|
|
@ -11,8 +11,6 @@ M.commands = function(opts)
|
|
|
|
|
opts = config.normalize_opts(opts, config.globals.nvim.commands)
|
|
|
|
|
if not opts then return end
|
|
|
|
|
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local commands = vim.api.nvim_get_commands {}
|
|
|
|
|
|
|
|
|
|
local prev_act = shell.action(function (args)
|
|
|
|
@ -33,7 +31,7 @@ M.commands = function(opts)
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
opts.fzf_opts['--preview'] = prev_act
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected)
|
|
|
|
@ -43,7 +41,6 @@ M.commands = function(opts)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local history = function(opts, str)
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local history = vim.fn.execute("history " .. str)
|
|
|
|
|
history = vim.split(history, "\n")
|
|
|
|
@ -58,7 +55,7 @@ local history = function(opts, str)
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
opts.fzf_opts['--preview-window'] = 'hidden:right:0'
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected)
|
|
|
|
@ -91,8 +88,6 @@ M.jumps = function(opts)
|
|
|
|
|
opts = config.normalize_opts(opts, config.globals.nvim.jumps)
|
|
|
|
|
if not opts then return end
|
|
|
|
|
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local jumps = vim.fn.execute("jumps")
|
|
|
|
|
jumps = vim.split(jumps, "\n")
|
|
|
|
|
|
|
|
|
@ -109,7 +104,7 @@ M.jumps = function(opts)
|
|
|
|
|
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected, opts)
|
|
|
|
@ -121,8 +116,6 @@ M.marks = function(opts)
|
|
|
|
|
opts = config.normalize_opts(opts, config.globals.nvim.marks)
|
|
|
|
|
if not opts then return end
|
|
|
|
|
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local marks = vim.fn.execute("marks")
|
|
|
|
|
marks = vim.split(marks, "\n")
|
|
|
|
|
|
|
|
|
@ -155,7 +148,7 @@ M.marks = function(opts)
|
|
|
|
|
opts.fzf_opts['--preview'] = prev_act
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected)
|
|
|
|
@ -168,8 +161,6 @@ M.registers = function(opts)
|
|
|
|
|
opts = config.normalize_opts(opts, config.globals.nvim.registers)
|
|
|
|
|
if not opts then return end
|
|
|
|
|
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local registers = { '"', "_", "#", "=", "_", "/", "*", "+", ":", ".", "%" }
|
|
|
|
|
-- named
|
|
|
|
|
for i = 0, 9 do
|
|
|
|
@ -202,7 +193,7 @@ M.registers = function(opts)
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
opts.fzf_opts['--preview'] = prev_act
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected)
|
|
|
|
@ -215,8 +206,6 @@ M.keymaps = function(opts)
|
|
|
|
|
opts = config.normalize_opts(opts, config.globals.nvim.keymaps)
|
|
|
|
|
if not opts then return end
|
|
|
|
|
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local modes = { "n", "i", "c" }
|
|
|
|
|
local keymaps = {}
|
|
|
|
|
|
|
|
|
@ -262,7 +251,7 @@ M.keymaps = function(opts)
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
opts.fzf_opts['--preview'] = prev_act
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected)
|
|
|
|
@ -276,8 +265,6 @@ M.spell_suggest = function(opts)
|
|
|
|
|
opts = config.normalize_opts(opts, config.globals.nvim.spell_suggest)
|
|
|
|
|
if not opts then return end
|
|
|
|
|
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local cursor_word = vim.fn.expand "<cword>"
|
|
|
|
|
local entries = vim.fn.spellsuggest(cursor_word)
|
|
|
|
|
|
|
|
|
@ -286,7 +273,7 @@ M.spell_suggest = function(opts)
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
opts.fzf_opts['--preview-window'] = 'hidden:right:0'
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected)
|
|
|
|
@ -300,15 +287,13 @@ M.filetypes = function(opts)
|
|
|
|
|
opts = config.normalize_opts(opts, config.globals.nvim.filetypes)
|
|
|
|
|
if not opts then return end
|
|
|
|
|
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local entries = vim.fn.getcompletion('', 'filetype')
|
|
|
|
|
if vim.tbl_isempty(entries) then return end
|
|
|
|
|
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
opts.fzf_opts['--preview-window'] = 'hidden:right:0'
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected)
|
|
|
|
@ -322,8 +307,6 @@ M.packadd = function(opts)
|
|
|
|
|
opts = config.normalize_opts(opts, config.globals.nvim.packadd)
|
|
|
|
|
if not opts then return end
|
|
|
|
|
|
|
|
|
|
coroutine.wrap(function ()
|
|
|
|
|
|
|
|
|
|
local entries = vim.fn.getcompletion('', 'packadd')
|
|
|
|
|
|
|
|
|
|
if vim.tbl_isempty(entries) then return end
|
|
|
|
@ -331,7 +314,7 @@ M.packadd = function(opts)
|
|
|
|
|
opts.fzf_opts['--no-multi'] = ''
|
|
|
|
|
opts.fzf_opts['--preview-window'] = 'hidden:right:0'
|
|
|
|
|
|
|
|
|
|
local selected = core.fzf(opts, entries)
|
|
|
|
|
core.fzf_wrap(opts, entries, function(selected)
|
|
|
|
|
|
|
|
|
|
if not selected then return end
|
|
|
|
|
actions.act(opts.actions, selected)
|
|
|
|
|