68 lines
1.7 KiB
Lua
68 lines
1.7 KiB
Lua
|
_G._command_panel = function()
|
||
|
require("telescope.builtin").keymaps({
|
||
|
lhs_filter = function(lhs)
|
||
|
return not string.find(lhs, "Þ")
|
||
|
end,
|
||
|
layout_config = {
|
||
|
width = 0.6,
|
||
|
height = 0.6,
|
||
|
prompt_position = "top",
|
||
|
},
|
||
|
})
|
||
|
end
|
||
|
|
||
|
_G._telescope_collections = function(picker_type)
|
||
|
local actions = require("telescope.actions")
|
||
|
local action_state = require("telescope.actions.state")
|
||
|
local conf = require("telescope.config").values
|
||
|
local finder = require("telescope.finders")
|
||
|
local pickers = require("telescope.pickers")
|
||
|
picker_type = picker_type or {}
|
||
|
|
||
|
local collections = vim.tbl_keys(require("search.tabs").collections)
|
||
|
pickers
|
||
|
.new(picker_type, {
|
||
|
prompt_title = "Telescope Collections",
|
||
|
finder = finder.new_table({ results = collections }),
|
||
|
sorter = conf.generic_sorter(picker_type),
|
||
|
attach_mappings = function(bufnr)
|
||
|
actions.select_default:replace(function()
|
||
|
actions.close(bufnr)
|
||
|
local selection = action_state.get_selected_entry()
|
||
|
require("search").open({ collection = selection[1] })
|
||
|
end)
|
||
|
|
||
|
return true
|
||
|
end,
|
||
|
})
|
||
|
:find()
|
||
|
end
|
||
|
|
||
|
_G._flash_esc_or_noh = function()
|
||
|
local flash_active, state = pcall(function()
|
||
|
return require("flash.plugins.char").state
|
||
|
end)
|
||
|
if flash_active and state then
|
||
|
state:hide()
|
||
|
else
|
||
|
pcall(vim.cmd.noh)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local _lazygit = nil
|
||
|
_G._toggle_lazygit = function()
|
||
|
if vim.fn.executable("lazygit") == 1 then
|
||
|
if not _lazygit then
|
||
|
_lazygit = require("toggleterm.terminal").Terminal:new({
|
||
|
cmd = "lazygit",
|
||
|
direction = "float",
|
||
|
close_on_exit = true,
|
||
|
hidden = true,
|
||
|
})
|
||
|
end
|
||
|
_lazygit:toggle()
|
||
|
else
|
||
|
vim.notify("Command [lazygit] not found!", vim.log.levels.ERROR, { title = "toggleterm.nvim" })
|
||
|
end
|
||
|
end
|