diff --git a/lua/config/remap.lua b/lua/config/remap.lua index 020ead2..ae2cea5 100644 --- a/lua/config/remap.lua +++ b/lua/config/remap.lua @@ -80,6 +80,55 @@ map("n", "gs", function() Snacks.lazygit({ args = { "status" } }) end, { desc = "Lazygit Log (cwd)" }) +-- developer custom utils + +map("n", "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 diff --git a/lua/plugins/qol.lua b/lua/plugins/qol.lua index 05f7404..f45ec1f 100644 --- a/lua/plugins/qol.lua +++ b/lua/plugins/qol.lua @@ -49,7 +49,7 @@ local config = { notify = { enabled = true }, quickfile = { enabled = false }, scope = { enabled = true }, - terminal = { enabled = false }, + terminal = { enabled = true }, scroll = { enabled = true }, statuscolumn = { enabled = true }, words = { enabled = true }, diff --git a/tasks/assets/conventional_commits_types.txt b/tasks/assets/conventional_commits_types.txt new file mode 100644 index 0000000..68c858c --- /dev/null +++ b/tasks/assets/conventional_commits_types.txt @@ -0,0 +1,10 @@ +feat | New feature +fix | A bug fix +chore | Unavoidable task not related +build | Changes to the build system or external dependencies +ci | Changes to our CI configuration +docs | Documentation only changes +style | Changes to white-space, formatting, missing semi-colons, etc. +refactor | A code change that neither fixes a bug nor adds a feature +perf | A code change that improves performance +test | Adding or correcting tests diff --git a/tasks/assets/emoji_list.txt b/tasks/assets/emoji_list.txt new file mode 100644 index 0000000..6f2d2a3 --- /dev/null +++ b/tasks/assets/emoji_list.txt @@ -0,0 +1,27 @@ +:broom: โ”‚ ๐Ÿงน โ”‚ clean, cleanup, remove +:recycle: โ”‚ โ™ป๏ธ โ”‚ recycle, actor +:wrench: โ”‚ ๐Ÿ”ง โ”‚ adjustment, rection, adapter +:gear: โ”‚ โš™๏ธ โ”‚ adjustment +:control_knobs: โ”‚ ๐ŸŽ› โ”‚ config, adjustment +:bug: โ”‚ ๐Ÿ› โ”‚ bug +:zap: โ”‚ โšก๏ธ โ”‚ speeded +:bar_chart: โ”‚ ๐Ÿ“Š โ”‚ analytics, chart +:chart_with_upwards_trend: โ”‚ ๐Ÿ“ˆ โ”‚ analytics, chart, upwards +:package: โ”‚ ๐Ÿ“ฆ โ”‚ package, wrap, ture +:fire: โ”‚ ๐Ÿ”ฅ โ”‚ fire, fix +:sparkles: โ”‚ โœจ โ”‚ new, feature +:nail_care: โ”‚ ๐Ÿ’… โ”‚ styles, prettify +:art: โ”‚ ๐ŸŽจ โ”‚ styles, colors +:lipstick: โ”‚ ๐Ÿ’„ โ”‚ styles, prettify +:white_check_mark: โ”‚ โœ… โ”‚ check, done +:test_tube: โ”‚ ๐Ÿงช โ”‚ test, testing +:pencil: โ”‚ ๐Ÿ“ โ”‚ docs +:warning: โ”‚ โš ๏ธ โ”‚ warning +:no_entry_sign: โ”‚ ๐Ÿšซ โ”‚ cancel +:rotating_light: โ”‚ ๐Ÿšจ โ”‚ alert, ect +:mag_right: โ”‚ ๐Ÿ”Ž โ”‚ search +:old_key: โ”‚ ๐Ÿ— โ”‚ dentials +:rocket: โ”‚ ๐Ÿš€ โ”‚ shipping +:stopwatch: โ”‚ โฑ โ”‚ speed, performance +:wheelchair: โ”‚ โ™ฟ๏ธ โ”‚ accessibility, a11y +:globe_with_meridians: โ”‚ ๐ŸŒ โ”‚ intl, i18n, i10n, tradus, lang diff --git a/tasks/commit-builder.sh b/tasks/commit-builder.sh new file mode 100644 index 0000000..bca8fa9 --- /dev/null +++ b/tasks/commit-builder.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +type="$(cat ~/.config/nvim/tasks/assets/conventional_commits_types.txt | fzf | awk -F' ' '{print $1 ": "}')" +emoji="$(cat ~/.config/nvim/tasks/assets/emoji_list.txt | fzf | awk -F' ' '{print $3 " "}')" +branch="$(git branch --show-current | awk -F'/' '{if ($2) print " [" $2 "] "}')" + +message="$type$branch$emoji" + +echo -n "$message" +read body + +git commit -m "$message$body"