chore: reformat with stylua 0.14.0
This commit is contained in:
@@ -242,10 +242,9 @@ end
|
|||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.select_default = {
|
actions.select_default = {
|
||||||
pre = function(prompt_bufnr)
|
pre = function(prompt_bufnr)
|
||||||
action_state.get_current_history():append(
|
action_state
|
||||||
action_state.get_current_line(),
|
.get_current_history()
|
||||||
action_state.get_current_picker(prompt_bufnr)
|
:append(action_state.get_current_line(), action_state.get_current_picker(prompt_bufnr))
|
||||||
)
|
|
||||||
end,
|
end,
|
||||||
action = function(prompt_bufnr)
|
action = function(prompt_bufnr)
|
||||||
return action_set.select(prompt_bufnr, "default")
|
return action_set.select(prompt_bufnr, "default")
|
||||||
@@ -259,10 +258,9 @@ actions.select_default = {
|
|||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.select_horizontal = {
|
actions.select_horizontal = {
|
||||||
pre = function(prompt_bufnr)
|
pre = function(prompt_bufnr)
|
||||||
action_state.get_current_history():append(
|
action_state
|
||||||
action_state.get_current_line(),
|
.get_current_history()
|
||||||
action_state.get_current_picker(prompt_bufnr)
|
:append(action_state.get_current_line(), action_state.get_current_picker(prompt_bufnr))
|
||||||
)
|
|
||||||
end,
|
end,
|
||||||
action = function(prompt_bufnr)
|
action = function(prompt_bufnr)
|
||||||
return action_set.select(prompt_bufnr, "horizontal")
|
return action_set.select(prompt_bufnr, "horizontal")
|
||||||
@@ -276,10 +274,9 @@ actions.select_horizontal = {
|
|||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.select_vertical = {
|
actions.select_vertical = {
|
||||||
pre = function(prompt_bufnr)
|
pre = function(prompt_bufnr)
|
||||||
action_state.get_current_history():append(
|
action_state
|
||||||
action_state.get_current_line(),
|
.get_current_history()
|
||||||
action_state.get_current_picker(prompt_bufnr)
|
:append(action_state.get_current_line(), action_state.get_current_picker(prompt_bufnr))
|
||||||
)
|
|
||||||
end,
|
end,
|
||||||
action = function(prompt_bufnr)
|
action = function(prompt_bufnr)
|
||||||
return action_set.select(prompt_bufnr, "vertical")
|
return action_set.select(prompt_bufnr, "vertical")
|
||||||
@@ -293,10 +290,9 @@ actions.select_vertical = {
|
|||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.select_tab = {
|
actions.select_tab = {
|
||||||
pre = function(prompt_bufnr)
|
pre = function(prompt_bufnr)
|
||||||
action_state.get_current_history():append(
|
action_state
|
||||||
action_state.get_current_line(),
|
.get_current_history()
|
||||||
action_state.get_current_picker(prompt_bufnr)
|
:append(action_state.get_current_line(), action_state.get_current_picker(prompt_bufnr))
|
||||||
)
|
|
||||||
end,
|
end,
|
||||||
action = function(prompt_bufnr)
|
action = function(prompt_bufnr)
|
||||||
return action_set.select(prompt_bufnr, "tab")
|
return action_set.select(prompt_bufnr, "tab")
|
||||||
@@ -1175,10 +1171,8 @@ actions.which_key = function(prompt_bufnr, opts)
|
|||||||
+ opts.name_width
|
+ opts.name_width
|
||||||
+ (3 * #opts.separator)
|
+ (3 * #opts.separator)
|
||||||
local num_total_columns = math.floor((vim.o.columns - #column_indent) / entry_width)
|
local num_total_columns = math.floor((vim.o.columns - #column_indent) / entry_width)
|
||||||
opts.num_rows = math.min(
|
opts.num_rows =
|
||||||
math.ceil(#mappings / num_total_columns),
|
math.min(math.ceil(#mappings / num_total_columns), resolver.resolve_height(opts.max_height)(_, _, vim.o.lines))
|
||||||
resolver.resolve_height(opts.max_height)(_, _, vim.o.lines)
|
|
||||||
)
|
|
||||||
local total_available_entries = opts.num_rows * num_total_columns
|
local total_available_entries = opts.num_rows * num_total_columns
|
||||||
local winheight = opts.num_rows + 2 * opts.line_padding
|
local winheight = opts.num_rows + 2 * opts.line_padding
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,8 @@ diagnostics.get = function(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
opts.path_display = vim.F.if_nil(opts.path_display, "hidden")
|
opts.path_display = vim.F.if_nil(opts.path_display, "hidden")
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = opts.bufnr == nil and "Workspace Diagnostics" or "Document Diagnostics",
|
prompt_title = opts.bufnr == nil and "Workspace Diagnostics" or "Document Diagnostics",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = locations,
|
results = locations,
|
||||||
@@ -133,7 +134,8 @@ diagnostics.get = function(opts)
|
|||||||
tag = "type",
|
tag = "type",
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
},
|
},
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function apply_checks(mod)
|
local function apply_checks(mod)
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ files.live_grep = function(opts)
|
|||||||
return flatten { vimgrep_arguments, additional_args, "--", prompt, search_list }
|
return flatten { vimgrep_arguments, additional_args, "--", prompt, search_list }
|
||||||
end, opts.entry_maker or make_entry.gen_from_vimgrep(opts), opts.max_results, opts.cwd)
|
end, opts.entry_maker or make_entry.gen_from_vimgrep(opts), opts.max_results, opts.cwd)
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Live Grep",
|
prompt_title = "Live Grep",
|
||||||
finder = live_grepper,
|
finder = live_grepper,
|
||||||
previewer = conf.grep_previewer(opts),
|
previewer = conf.grep_previewer(opts),
|
||||||
@@ -121,7 +122,8 @@ files.live_grep = function(opts)
|
|||||||
map("i", "<c-space>", actions.to_fuzzy_refine)
|
map("i", "<c-space>", actions.to_fuzzy_refine)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
files.grep_string = function(opts)
|
files.grep_string = function(opts)
|
||||||
@@ -161,12 +163,14 @@ files.grep_string = function(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
opts.entry_maker = opts.entry_maker or make_entry.gen_from_vimgrep(opts)
|
opts.entry_maker = opts.entry_maker or make_entry.gen_from_vimgrep(opts)
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Find Word (" .. word:gsub("\n", "\\n") .. ")",
|
prompt_title = "Find Word (" .. word:gsub("\n", "\\n") .. ")",
|
||||||
finder = finders.new_oneshot_job(args, opts),
|
finder = finders.new_oneshot_job(args, opts),
|
||||||
previewer = conf.grep_previewer(opts),
|
previewer = conf.grep_previewer(opts),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
files.find_files = function(opts)
|
files.find_files = function(opts)
|
||||||
@@ -291,12 +295,14 @@ files.find_files = function(opts)
|
|||||||
|
|
||||||
opts.entry_maker = opts.entry_maker or make_entry.gen_from_file(opts)
|
opts.entry_maker = opts.entry_maker or make_entry.gen_from_file(opts)
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Find Files",
|
prompt_title = "Find Files",
|
||||||
finder = finders.new_oneshot_job(find_command, opts),
|
finder = finders.new_oneshot_job(find_command, opts),
|
||||||
previewer = conf.file_previewer(opts),
|
previewer = conf.file_previewer(opts),
|
||||||
sorter = conf.file_sorter(opts),
|
sorter = conf.file_sorter(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function prepare_match(entry, kind)
|
local function prepare_match(entry, kind)
|
||||||
@@ -349,7 +355,8 @@ files.treesitter = function(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Treesitter Symbols",
|
prompt_title = "Treesitter Symbols",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = results,
|
results = results,
|
||||||
@@ -360,7 +367,8 @@ files.treesitter = function(opts)
|
|||||||
tag = "kind",
|
tag = "kind",
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
},
|
},
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
files.current_buffer_fuzzy_find = function(opts)
|
files.current_buffer_fuzzy_find = function(opts)
|
||||||
@@ -432,7 +440,8 @@ files.current_buffer_fuzzy_find = function(opts)
|
|||||||
opts.line_highlights = line_highlights
|
opts.line_highlights = line_highlights
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Current Buffer Fuzzy",
|
prompt_title = "Current Buffer Fuzzy",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = lines_with_numbers,
|
results = lines_with_numbers,
|
||||||
@@ -450,7 +459,8 @@ files.current_buffer_fuzzy_find = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
files.tags = function(opts)
|
files.tags = function(opts)
|
||||||
@@ -467,7 +477,8 @@ files.tags = function(opts)
|
|||||||
end
|
end
|
||||||
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_ctags(opts))
|
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_ctags(opts))
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Tags",
|
prompt_title = "Tags",
|
||||||
finder = finders.new_oneshot_job(flatten { "cat", tagfiles }, opts),
|
finder = finders.new_oneshot_job(flatten { "cat", tagfiles }, opts),
|
||||||
previewer = previewers.ctags.new(opts),
|
previewer = previewers.ctags.new(opts),
|
||||||
@@ -498,7 +509,8 @@ files.tags = function(opts)
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
files.current_buffer_tags = function(opts)
|
files.current_buffer_tags = function(opts)
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ git.files = function(opts)
|
|||||||
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_file(opts))
|
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_file(opts))
|
||||||
local git_command = vim.F.if_nil(opts.git_command, { "git", "ls-files", "--exclude-standard", "--cached" })
|
local git_command = vim.F.if_nil(opts.git_command, { "git", "ls-files", "--exclude-standard", "--cached" })
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Git Files",
|
prompt_title = "Git Files",
|
||||||
finder = finders.new_oneshot_job(
|
finder = finders.new_oneshot_job(
|
||||||
vim.tbl_flatten {
|
vim.tbl_flatten {
|
||||||
@@ -49,14 +50,16 @@ git.files = function(opts)
|
|||||||
),
|
),
|
||||||
previewer = conf.file_previewer(opts),
|
previewer = conf.file_previewer(opts),
|
||||||
sorter = conf.file_sorter(opts),
|
sorter = conf.file_sorter(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
git.commits = function(opts)
|
git.commits = function(opts)
|
||||||
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_commits(opts))
|
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_commits(opts))
|
||||||
local git_command = vim.F.if_nil(opts.git_command, { "git", "log", "--pretty=oneline", "--abbrev-commit", "--", "." })
|
local git_command = vim.F.if_nil(opts.git_command, { "git", "log", "--pretty=oneline", "--abbrev-commit", "--", "." })
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Git Commits",
|
prompt_title = "Git Commits",
|
||||||
finder = finders.new_oneshot_job(git_command, opts),
|
finder = finders.new_oneshot_job(git_command, opts),
|
||||||
previewer = {
|
previewer = {
|
||||||
@@ -76,14 +79,16 @@ git.commits = function(opts)
|
|||||||
map("n", "<c-r>h", actions.git_reset_hard)
|
map("n", "<c-r>h", actions.git_reset_hard)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
git.stash = function(opts)
|
git.stash = function(opts)
|
||||||
opts.show_branch = vim.F.if_nil(opts.show_branch, true)
|
opts.show_branch = vim.F.if_nil(opts.show_branch, true)
|
||||||
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_stash(opts))
|
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_stash(opts))
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Git Stash",
|
prompt_title = "Git Stash",
|
||||||
finder = finders.new_oneshot_job(
|
finder = finders.new_oneshot_job(
|
||||||
vim.tbl_flatten {
|
vim.tbl_flatten {
|
||||||
@@ -100,7 +105,8 @@ git.stash = function(opts)
|
|||||||
actions.select_default:replace(actions.git_apply_stash)
|
actions.select_default:replace(actions.git_apply_stash)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
local get_current_buf_line = function(winnr)
|
local get_current_buf_line = function(winnr)
|
||||||
@@ -112,12 +118,11 @@ git.bcommits = function(opts)
|
|||||||
opts.current_line = (opts.current_file == nil) and get_current_buf_line(opts.winnr) or nil
|
opts.current_line = (opts.current_file == nil) and get_current_buf_line(opts.winnr) or nil
|
||||||
opts.current_file = vim.F.if_nil(opts.current_file, vim.api.nvim_buf_get_name(opts.bufnr))
|
opts.current_file = vim.F.if_nil(opts.current_file, vim.api.nvim_buf_get_name(opts.bufnr))
|
||||||
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_commits(opts))
|
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_commits(opts))
|
||||||
local git_command = vim.F.if_nil(
|
local git_command =
|
||||||
opts.git_command,
|
vim.F.if_nil(opts.git_command, { "git", "log", "--pretty=oneline", "--abbrev-commit", "--follow" })
|
||||||
{ "git", "log", "--pretty=oneline", "--abbrev-commit", "--follow" }
|
|
||||||
)
|
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Git BCommits",
|
prompt_title = "Git BCommits",
|
||||||
finder = finders.new_oneshot_job(
|
finder = finders.new_oneshot_job(
|
||||||
vim.tbl_flatten {
|
vim.tbl_flatten {
|
||||||
@@ -188,7 +193,8 @@ git.bcommits = function(opts)
|
|||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
git.branches = function(opts)
|
git.branches = function(opts)
|
||||||
@@ -197,10 +203,8 @@ git.branches = function(opts)
|
|||||||
.. "%(authorname)"
|
.. "%(authorname)"
|
||||||
.. "%(upstream:lstrip=2)"
|
.. "%(upstream:lstrip=2)"
|
||||||
.. "%(committerdate:format-local:%Y/%m/%d %H:%M:%S)"
|
.. "%(committerdate:format-local:%Y/%m/%d %H:%M:%S)"
|
||||||
local output = utils.get_os_command_output(
|
local output =
|
||||||
{ "git", "for-each-ref", "--perl", "--format", format, opts.pattern },
|
utils.get_os_command_output({ "git", "for-each-ref", "--perl", "--format", format, opts.pattern }, opts.cwd)
|
||||||
opts.cwd
|
|
||||||
)
|
|
||||||
|
|
||||||
local results = {}
|
local results = {}
|
||||||
local widths = {
|
local widths = {
|
||||||
@@ -273,7 +277,8 @@ git.branches = function(opts)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Git Branches",
|
prompt_title = "Git Branches",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = results,
|
results = results,
|
||||||
@@ -307,7 +312,8 @@ git.branches = function(opts)
|
|||||||
map("n", "<c-y>", actions.git_merge_branch)
|
map("n", "<c-y>", actions.git_merge_branch)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
git.status = function(opts)
|
git.status = function(opts)
|
||||||
@@ -349,7 +355,8 @@ git.status = function(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Git Status",
|
prompt_title = "Git Status",
|
||||||
finder = initial_finder,
|
finder = initial_finder,
|
||||||
previewer = previewers.git_file_diff.new(opts),
|
previewer = previewers.git_file_diff.new(opts),
|
||||||
@@ -365,7 +372,8 @@ git.status = function(opts)
|
|||||||
map("n", "<tab>", actions.git_staging_toggle)
|
map("n", "<tab>", actions.git_staging_toggle)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
local set_opts_cwd = function(opts)
|
local set_opts_cwd = function(opts)
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ internal.builtin = function(opts)
|
|||||||
|
|
||||||
opts.bufnr = vim.api.nvim_get_current_buf()
|
opts.bufnr = vim.api.nvim_get_current_buf()
|
||||||
opts.winnr = vim.api.nvim_get_current_win()
|
opts.winnr = vim.api.nvim_get_current_win()
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = title,
|
prompt_title = title,
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = objs,
|
results = objs,
|
||||||
@@ -110,7 +111,8 @@ internal.builtin = function(opts)
|
|||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.resume = function(opts)
|
internal.resume = function(opts)
|
||||||
@@ -176,7 +178,8 @@ internal.pickers = function(opts)
|
|||||||
opts.cache_picker = nil
|
opts.cache_picker = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Pickers",
|
prompt_title = "Pickers",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = cached_pickers,
|
results = cached_pickers,
|
||||||
@@ -199,7 +202,8 @@ internal.pickers = function(opts)
|
|||||||
map("n", "<C-x>", actions.remove_selected_picker)
|
map("n", "<C-x>", actions.remove_selected_picker)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.planets = function(opts)
|
internal.planets = function(opts)
|
||||||
@@ -216,7 +220,8 @@ internal.planets = function(opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Planets",
|
prompt_title = "Planets",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = acceptable_files,
|
results = acceptable_files,
|
||||||
@@ -244,7 +249,8 @@ internal.planets = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.symbols = function(opts)
|
internal.symbols = function(opts)
|
||||||
@@ -293,7 +299,8 @@ internal.symbols = function(opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Symbols",
|
prompt_title = "Symbols",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = results,
|
results = results,
|
||||||
@@ -314,11 +321,13 @@ internal.symbols = function(opts)
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.commands = function(opts)
|
internal.commands = function(opts)
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Commands",
|
prompt_title = "Commands",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = (function()
|
results = (function()
|
||||||
@@ -366,7 +375,8 @@ internal.commands = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.quickfix = function(opts)
|
internal.quickfix = function(opts)
|
||||||
@@ -377,7 +387,8 @@ internal.quickfix = function(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Quickfix",
|
prompt_title = "Quickfix",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = locations,
|
results = locations,
|
||||||
@@ -385,7 +396,8 @@ internal.quickfix = function(opts)
|
|||||||
},
|
},
|
||||||
previewer = conf.qflist_previewer(opts),
|
previewer = conf.qflist_previewer(opts),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.quickfixhistory = function(opts)
|
internal.quickfixhistory = function(opts)
|
||||||
@@ -409,7 +421,8 @@ internal.quickfixhistory = function(opts)
|
|||||||
}, opts)
|
}, opts)
|
||||||
end
|
end
|
||||||
local qf_entry_maker = make_entry.gen_from_quickfix(opts)
|
local qf_entry_maker = make_entry.gen_from_quickfix(opts)
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Quickfix History",
|
prompt_title = "Quickfix History",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = qflists,
|
results = qflists,
|
||||||
@@ -444,7 +457,8 @@ internal.quickfixhistory = function(opts)
|
|||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.loclist = function(opts)
|
internal.loclist = function(opts)
|
||||||
@@ -462,7 +476,8 @@ internal.loclist = function(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Loclist",
|
prompt_title = "Loclist",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = locations,
|
results = locations,
|
||||||
@@ -470,7 +485,8 @@ internal.loclist = function(opts)
|
|||||||
},
|
},
|
||||||
previewer = conf.qflist_previewer(opts),
|
previewer = conf.qflist_previewer(opts),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.oldfiles = function(opts)
|
internal.oldfiles = function(opts)
|
||||||
@@ -508,7 +524,8 @@ internal.oldfiles = function(opts)
|
|||||||
end, results)
|
end, results)
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Oldfiles",
|
prompt_title = "Oldfiles",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = results,
|
results = results,
|
||||||
@@ -516,7 +533,8 @@ internal.oldfiles = function(opts)
|
|||||||
},
|
},
|
||||||
sorter = conf.file_sorter(opts),
|
sorter = conf.file_sorter(opts),
|
||||||
previewer = conf.file_previewer(opts),
|
previewer = conf.file_previewer(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.command_history = function(opts)
|
internal.command_history = function(opts)
|
||||||
@@ -530,7 +548,8 @@ internal.command_history = function(opts)
|
|||||||
table.insert(results, string.sub(item, finish + 1))
|
table.insert(results, string.sub(item, finish + 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Command History",
|
prompt_title = "Command History",
|
||||||
finder = finders.new_table(results),
|
finder = finders.new_table(results),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
@@ -546,7 +565,8 @@ internal.command_history = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.search_history = function(opts)
|
internal.search_history = function(opts)
|
||||||
@@ -560,7 +580,8 @@ internal.search_history = function(opts)
|
|||||||
table.insert(results, string.sub(item, finish + 1))
|
table.insert(results, string.sub(item, finish + 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Search History",
|
prompt_title = "Search History",
|
||||||
finder = finders.new_table(results),
|
finder = finders.new_table(results),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
@@ -576,7 +597,8 @@ internal.search_history = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.vim_options = function(opts)
|
internal.vim_options = function(opts)
|
||||||
@@ -588,7 +610,8 @@ internal.vim_options = function(opts)
|
|||||||
return left.name < right.name
|
return left.name < right.name
|
||||||
end)
|
end)
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "options",
|
prompt_title = "options",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = res,
|
results = res,
|
||||||
@@ -617,7 +640,8 @@ internal.vim_options = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.help_tags = function(opts)
|
internal.help_tags = function(opts)
|
||||||
@@ -685,7 +709,8 @@ internal.help_tags = function(opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Help",
|
prompt_title = "Help",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = tags,
|
results = tags,
|
||||||
@@ -721,7 +746,8 @@ internal.help_tags = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.man_pages = function(opts)
|
internal.man_pages = function(opts)
|
||||||
@@ -734,7 +760,8 @@ internal.man_pages = function(opts)
|
|||||||
opts.entry_maker = opts.entry_maker or make_entry.gen_from_apropos(opts)
|
opts.entry_maker = opts.entry_maker or make_entry.gen_from_apropos(opts)
|
||||||
opts.env = { PATH = vim.env.PATH, MANPATH = vim.env.MANPATH }
|
opts.env = { PATH = vim.env.PATH, MANPATH = vim.env.MANPATH }
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Man",
|
prompt_title = "Man",
|
||||||
finder = finders.new_oneshot_job(opts.man_cmd, opts),
|
finder = finders.new_oneshot_job(opts.man_cmd, opts),
|
||||||
previewer = previewers.man.new(opts),
|
previewer = previewers.man.new(opts),
|
||||||
@@ -760,7 +787,8 @@ internal.man_pages = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.reloader = function(opts)
|
internal.reloader = function(opts)
|
||||||
@@ -781,7 +809,8 @@ internal.reloader = function(opts)
|
|||||||
end
|
end
|
||||||
opts.column_len = vim.F.if_nil(opts.column_len, column_len)
|
opts.column_len = vim.F.if_nil(opts.column_len, column_len)
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Packages",
|
prompt_title = "Packages",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = package_list,
|
results = package_list,
|
||||||
@@ -808,7 +837,8 @@ internal.reloader = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.buffers = function(opts)
|
internal.buffers = function(opts)
|
||||||
@@ -866,7 +896,8 @@ internal.buffers = function(opts)
|
|||||||
opts.bufnr_width = #tostring(max_bufnr)
|
opts.bufnr_width = #tostring(max_bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Buffers",
|
prompt_title = "Buffers",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = buffers,
|
results = buffers,
|
||||||
@@ -875,7 +906,8 @@ internal.buffers = function(opts)
|
|||||||
previewer = conf.grep_previewer(opts),
|
previewer = conf.grep_previewer(opts),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
default_selection_index = default_selection_idx,
|
default_selection_index = default_selection_idx,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.colorscheme = function(opts)
|
internal.colorscheme = function(opts)
|
||||||
@@ -1020,7 +1052,8 @@ internal.marks = function(opts)
|
|||||||
end
|
end
|
||||||
marks_table = vim.fn.extend(marks_table, marks_others)
|
marks_table = vim.fn.extend(marks_table, marks_others)
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Marks",
|
prompt_title = "Marks",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = marks_table,
|
results = marks_table,
|
||||||
@@ -1030,7 +1063,8 @@ internal.marks = function(opts)
|
|||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
push_cursor_on_edit = true,
|
push_cursor_on_edit = true,
|
||||||
push_tagstack_on_edit = true,
|
push_tagstack_on_edit = true,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.registers = function(opts)
|
internal.registers = function(opts)
|
||||||
@@ -1046,7 +1080,8 @@ internal.registers = function(opts)
|
|||||||
table.insert(registers_table, string.char(i))
|
table.insert(registers_table, string.char(i))
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Registers",
|
prompt_title = "Registers",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = registers_table,
|
results = registers_table,
|
||||||
@@ -1060,7 +1095,8 @@ internal.registers = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: make filtering include the mapping and the action
|
-- TODO: make filtering include the mapping and the action
|
||||||
@@ -1094,7 +1130,8 @@ internal.keymaps = function(opts)
|
|||||||
end
|
end
|
||||||
opts.width_lhs = max_len_lhs + 1
|
opts.width_lhs = max_len_lhs + 1
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Key Maps",
|
prompt_title = "Key Maps",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = keymaps_table,
|
results = keymaps_table,
|
||||||
@@ -1114,13 +1151,15 @@ internal.keymaps = function(opts)
|
|||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.filetypes = function(opts)
|
internal.filetypes = function(opts)
|
||||||
local filetypes = vim.fn.getcompletion("", "filetype")
|
local filetypes = vim.fn.getcompletion("", "filetype")
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Filetypes",
|
prompt_title = "Filetypes",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = filetypes,
|
results = filetypes,
|
||||||
@@ -1139,13 +1178,15 @@ internal.filetypes = function(opts)
|
|||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.highlights = function(opts)
|
internal.highlights = function(opts)
|
||||||
local highlights = vim.fn.getcompletion("", "highlight")
|
local highlights = vim.fn.getcompletion("", "highlight")
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Highlights",
|
prompt_title = "Highlights",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = highlights,
|
results = highlights,
|
||||||
@@ -1166,7 +1207,8 @@ internal.highlights = function(opts)
|
|||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
previewer = previewers.highlights.new(opts),
|
previewer = previewers.highlights.new(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.autocommands = function(opts)
|
internal.autocommands = function(opts)
|
||||||
@@ -1174,7 +1216,8 @@ internal.autocommands = function(opts)
|
|||||||
table.sort(autocmds, function(lhs, rhs)
|
table.sort(autocmds, function(lhs, rhs)
|
||||||
return lhs.event < rhs.event
|
return lhs.event < rhs.event
|
||||||
end)
|
end)
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "autocommands",
|
prompt_title = "autocommands",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = autocmds,
|
results = autocmds,
|
||||||
@@ -1190,7 +1233,8 @@ internal.autocommands = function(opts)
|
|||||||
end
|
end
|
||||||
local val = selection.value
|
local val = selection.value
|
||||||
local group_name = val.group_name ~= "<anonymous>" and val.group_name or ""
|
local group_name = val.group_name ~= "<anonymous>" and val.group_name or ""
|
||||||
local output = vim.fn.execute("verb autocmd " .. group_name .. " " .. val.event .. " " .. val.pattern, "silent")
|
local output =
|
||||||
|
vim.fn.execute("verb autocmd " .. group_name .. " " .. val.event .. " " .. val.pattern, "silent")
|
||||||
for line in output:gmatch "[^\r\n]+" do
|
for line in output:gmatch "[^\r\n]+" do
|
||||||
local source_file = line:match "Last set from (.*) line %d*$" or line:match "Last set from (.*)$"
|
local source_file = line:match "Last set from (.*) line %d*$" or line:match "Last set from (.*)$"
|
||||||
if source_file and source_file ~= "Lua" then
|
if source_file and source_file ~= "Lua" then
|
||||||
@@ -1210,14 +1254,16 @@ internal.autocommands = function(opts)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.spell_suggest = function(opts)
|
internal.spell_suggest = function(opts)
|
||||||
local cursor_word = vim.fn.expand "<cword>"
|
local cursor_word = vim.fn.expand "<cword>"
|
||||||
local suggestions = vim.fn.spellsuggest(cursor_word)
|
local suggestions = vim.fn.spellsuggest(cursor_word)
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Spelling Suggestions",
|
prompt_title = "Spelling Suggestions",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = suggestions,
|
results = suggestions,
|
||||||
@@ -1238,7 +1284,8 @@ internal.spell_suggest = function(opts)
|
|||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.tagstack = function(opts)
|
internal.tagstack = function(opts)
|
||||||
@@ -1267,7 +1314,8 @@ internal.tagstack = function(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "TagStack",
|
prompt_title = "TagStack",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = tags,
|
results = tags,
|
||||||
@@ -1275,7 +1323,8 @@ internal.tagstack = function(opts)
|
|||||||
},
|
},
|
||||||
previewer = conf.qflist_previewer(opts),
|
previewer = conf.qflist_previewer(opts),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
internal.jumplist = function(opts)
|
internal.jumplist = function(opts)
|
||||||
@@ -1292,7 +1341,8 @@ internal.jumplist = function(opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "Jumplist",
|
prompt_title = "Jumplist",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = sorted_jumplist,
|
results = sorted_jumplist,
|
||||||
@@ -1300,7 +1350,8 @@ internal.jumplist = function(opts)
|
|||||||
},
|
},
|
||||||
previewer = conf.qflist_previewer(opts),
|
previewer = conf.qflist_previewer(opts),
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function apply_checks(mod)
|
local function apply_checks(mod)
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ lsp.references = function(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "LSP References",
|
prompt_title = "LSP References",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = locations,
|
results = locations,
|
||||||
@@ -49,7 +50,8 @@ lsp.references = function(opts)
|
|||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
push_cursor_on_edit = true,
|
push_cursor_on_edit = true,
|
||||||
push_tagstack_on_edit = true,
|
push_tagstack_on_edit = true,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -77,7 +79,8 @@ local function call_hierarchy(opts, method, title, direction, item)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = title,
|
prompt_title = title,
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = locations,
|
results = locations,
|
||||||
@@ -87,7 +90,8 @@ local function call_hierarchy(opts, method, title, direction, item)
|
|||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
push_cursor_on_edit = true,
|
push_cursor_on_edit = true,
|
||||||
push_tagstack_on_edit = true,
|
push_tagstack_on_edit = true,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -171,7 +175,8 @@ local function list_or_jump(action, title, opts)
|
|||||||
vim.lsp.util.jump_to_location(flattened_results[1], offset_encoding)
|
vim.lsp.util.jump_to_location(flattened_results[1], offset_encoding)
|
||||||
else
|
else
|
||||||
local locations = vim.lsp.util.locations_to_items(flattened_results, offset_encoding)
|
local locations = vim.lsp.util.locations_to_items(flattened_results, offset_encoding)
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = title,
|
prompt_title = title,
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = locations,
|
results = locations,
|
||||||
@@ -181,7 +186,8 @@ local function list_or_jump(action, title, opts)
|
|||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
push_cursor_on_edit = true,
|
push_cursor_on_edit = true,
|
||||||
push_tagstack_on_edit = true,
|
push_tagstack_on_edit = true,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -230,7 +236,8 @@ lsp.document_symbols = function(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
opts.path_display = { "hidden" }
|
opts.path_display = { "hidden" }
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "LSP Document Symbols",
|
prompt_title = "LSP Document Symbols",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = locations,
|
results = locations,
|
||||||
@@ -243,7 +250,8 @@ lsp.document_symbols = function(opts)
|
|||||||
},
|
},
|
||||||
push_cursor_on_edit = true,
|
push_cursor_on_edit = true,
|
||||||
push_tagstack_on_edit = true,
|
push_tagstack_on_edit = true,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -273,7 +281,8 @@ lsp.workspace_symbols = function(opts)
|
|||||||
|
|
||||||
opts.ignore_filename = vim.F.if_nil(opts.ignore_filename, false)
|
opts.ignore_filename = vim.F.if_nil(opts.ignore_filename, false)
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "LSP Workspace Symbols",
|
prompt_title = "LSP Workspace Symbols",
|
||||||
finder = finders.new_table {
|
finder = finders.new_table {
|
||||||
results = locations,
|
results = locations,
|
||||||
@@ -284,7 +293,8 @@ lsp.workspace_symbols = function(opts)
|
|||||||
tag = "symbol_type",
|
tag = "symbol_type",
|
||||||
sorter = conf.generic_sorter(opts),
|
sorter = conf.generic_sorter(opts),
|
||||||
},
|
},
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -309,7 +319,8 @@ local function get_workspace_symbols_requester(bufnr, opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
lsp.dynamic_workspace_symbols = function(opts)
|
lsp.dynamic_workspace_symbols = function(opts)
|
||||||
pickers.new(opts, {
|
pickers
|
||||||
|
.new(opts, {
|
||||||
prompt_title = "LSP Dynamic Workspace Symbols",
|
prompt_title = "LSP Dynamic Workspace Symbols",
|
||||||
finder = finders.new_dynamic {
|
finder = finders.new_dynamic {
|
||||||
entry_maker = opts.entry_maker or make_entry.gen_from_lsp_symbols(opts),
|
entry_maker = opts.entry_maker or make_entry.gen_from_lsp_symbols(opts),
|
||||||
@@ -321,7 +332,8 @@ lsp.dynamic_workspace_symbols = function(opts)
|
|||||||
map("i", "<c-space>", actions.to_fuzzy_refine)
|
map("i", "<c-space>", actions.to_fuzzy_refine)
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
}):find()
|
})
|
||||||
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_capabilities(feature, bufnr)
|
local function check_capabilities(feature, bufnr)
|
||||||
|
|||||||
@@ -147,11 +147,8 @@ local telescope_map = function(prompt_bufnr, mode, key_bind, key_func, opts)
|
|||||||
|
|
||||||
local map_string
|
local map_string
|
||||||
if opts.expr then
|
if opts.expr then
|
||||||
map_string = string.format(
|
map_string =
|
||||||
[[luaeval("require('telescope.mappings').execute_keymap(%s, %s)")]],
|
string.format([[luaeval("require('telescope.mappings').execute_keymap(%s, %s)")]], prompt_bufnr, key_id)
|
||||||
prompt_bufnr,
|
|
||||||
key_id
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
if mode == "i" and not opts.expr then
|
if mode == "i" and not opts.expr then
|
||||||
prefix = "<cmd>"
|
prefix = "<cmd>"
|
||||||
@@ -161,12 +158,8 @@ local telescope_map = function(prompt_bufnr, mode, key_bind, key_func, opts)
|
|||||||
prefix = ":"
|
prefix = ":"
|
||||||
end
|
end
|
||||||
|
|
||||||
map_string = string.format(
|
map_string =
|
||||||
"%slua require('telescope.mappings').execute_keymap(%s, %s)<CR>",
|
string.format("%slua require('telescope.mappings').execute_keymap(%s, %s)<CR>", prefix, prompt_bufnr, key_id)
|
||||||
prefix,
|
|
||||||
prompt_bufnr,
|
|
||||||
key_id
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
a.nvim_buf_set_keymap(prompt_bufnr, mode, key_bind, map_string, opts)
|
a.nvim_buf_set_keymap(prompt_bufnr, mode, key_bind, map_string, opts)
|
||||||
|
|||||||
@@ -372,11 +372,8 @@ function Picker:find()
|
|||||||
popup_opts.preview.titlehighlight = "TelescopePreviewTitle"
|
popup_opts.preview.titlehighlight = "TelescopePreviewTitle"
|
||||||
end
|
end
|
||||||
|
|
||||||
local results_win, results_opts, results_border_win = self:_create_window(
|
local results_win, results_opts, results_border_win =
|
||||||
"",
|
self:_create_window("", popup_opts.results, not self.wrap_results)
|
||||||
popup_opts.results,
|
|
||||||
not self.wrap_results
|
|
||||||
)
|
|
||||||
|
|
||||||
local results_bufnr = a.nvim_win_get_buf(results_win)
|
local results_bufnr = a.nvim_win_get_buf(results_win)
|
||||||
pcall(a.nvim_buf_set_option, results_bufnr, "tabstop", 1) -- #1834
|
pcall(a.nvim_buf_set_option, results_bufnr, "tabstop", 1) -- #1834
|
||||||
|
|||||||
@@ -693,11 +693,8 @@ layout_strategies.vertical = make_documented_layout(
|
|||||||
-- Cap over/undersized height (with previewer)
|
-- Cap over/undersized height (with previewer)
|
||||||
height, h_space = calc_size_and_spacing(height, max_lines, bs, 3, 6, 2)
|
height, h_space = calc_size_and_spacing(height, max_lines, bs, 3, 6, 2)
|
||||||
|
|
||||||
preview.height = resolve.resolve_height(vim.F.if_nil(layout_config.preview_height, 0.5))(
|
preview.height =
|
||||||
self,
|
resolve.resolve_height(vim.F.if_nil(layout_config.preview_height, 0.5))(self, max_columns, height)
|
||||||
max_columns,
|
|
||||||
height
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
-- Cap over/undersized height (without previewer)
|
-- Cap over/undersized height (without previewer)
|
||||||
height, h_space = calc_size_and_spacing(height, max_lines, bs, 2, 4, 1)
|
height, h_space = calc_size_and_spacing(height, max_lines, bs, 2, 4, 1)
|
||||||
|
|||||||
@@ -45,8 +45,7 @@ utils.job_maker = function(cmd, bufnr, opts)
|
|||||||
end
|
end
|
||||||
end)()
|
end)()
|
||||||
|
|
||||||
Job
|
Job:new({
|
||||||
:new({
|
|
||||||
command = command,
|
command = command,
|
||||||
args = cmd,
|
args = cmd,
|
||||||
env = opts.env,
|
env = opts.env,
|
||||||
@@ -65,8 +64,7 @@ utils.job_maker = function(cmd, bufnr, opts)
|
|||||||
opts.callback(bufnr, j:result())
|
opts.callback(bufnr, j:result())
|
||||||
end
|
end
|
||||||
end),
|
end),
|
||||||
})
|
}):start()
|
||||||
:start()
|
|
||||||
else
|
else
|
||||||
if opts.callback then
|
if opts.callback then
|
||||||
opts.callback(bufnr)
|
opts.callback(bufnr)
|
||||||
|
|||||||
@@ -417,16 +417,14 @@ function utils.get_os_command_output(cmd, cwd)
|
|||||||
end
|
end
|
||||||
local command = table.remove(cmd, 1)
|
local command = table.remove(cmd, 1)
|
||||||
local stderr = {}
|
local stderr = {}
|
||||||
local stdout, ret = Job
|
local stdout, ret = Job:new({
|
||||||
:new({
|
|
||||||
command = command,
|
command = command,
|
||||||
args = cmd,
|
args = cmd,
|
||||||
cwd = cwd,
|
cwd = cwd,
|
||||||
on_stderr = function(_, data)
|
on_stderr = function(_, data)
|
||||||
table.insert(stderr, data)
|
table.insert(stderr, data)
|
||||||
end,
|
end,
|
||||||
})
|
}):sync()
|
||||||
:sync()
|
|
||||||
return stdout, ret, stderr
|
return stdout, ret, stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user