feat: new 'tasks' utils
This commit is contained in:
1 parent
164b13f9f0
commit
2160370d41
5 files changed
+99
-1
No files matched your search
@@ -80,6 +80,55 @@ map("n", "<leader>gs", function()
|
||||
Snacks.lazygit({ args = { "status" } })
|
||||
end, { desc = "Lazygit Log (cwd)" })
|
||||
|
||||
-- developer custom utils
|
||||
|
||||
map("n", "<leader>cu", function()
|
||||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local conf = require("telescope.config").values
|
||||
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
|
||||
local opts = {
|
||||
layout_config = {
|
||||
width = 0.3,
|
||||
height = 0.3,
|
||||
}
|
||||
}
|
||||
|
||||
local utils = { "Conventional commit", "Colorizer", "Code templates" }
|
||||
local commands = { "bash ~/.config/nvim/tasks/commit-builder.sh", "~/.config/utils/colorizer",
|
||||
"~/.config/utils/code_templates" }
|
||||
|
||||
pickers
|
||||
.new(opts, {
|
||||
prompt_title = "External Utils",
|
||||
finder = finders.new_table({
|
||||
results = utils,
|
||||
}),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
|
||||
local index = {}
|
||||
for k, v in pairs(utils) do
|
||||
index[v] = k
|
||||
end
|
||||
local pos = index[selection[1]]
|
||||
|
||||
Snacks.terminal.toggle(
|
||||
string.format("clear && %s && echo 'Finished | Enter to exit' && read", commands[pos]),
|
||||
{ interactive = true, win = { height = 0.4, width = 0.4, position = "bottom" } })
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
:find()
|
||||
end, { desc = "Deploy developer tools selector" })
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
-- Neotree
|
||||
|
||||
Reference in new issue
Block a user