Created
September 12, 2024 06:23
-
-
Save shanehull/d5bdb0dbb162ab4d88d3e2da3ec69388 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- **User command to insert a decision template at the current line** -- | |
vim.api.nvim_create_user_command("Decision", function() | |
local template = [[ | |
**Mental/physical state:** | |
- [ ] Energized | |
- [ ] Focused | |
- [ ] Relaxed | |
- [ ] Confident | |
- [ ] Tired | |
- [ ] Accepting | |
- [ ] Accommodating | |
- [ ] Anxious | |
- [ ] Resigned | |
- [ ] Frustrated | |
- [ ] Angry | |
**Decision opportunity:** | |
**Variables:** | |
**Alternatives:** | |
**The decision:** | |
**Expected outcome and probabilities:** | |
**Additional context:** | |
]] | |
-- Get the current cursor position | |
local row, col = unpack(vim.api.nvim_win_get_cursor(0)) | |
-- Insert the template at the current line | |
vim.api.nvim_buf_set_lines(0, row, row, false, vim.split(template, "\n")) | |
end, {}) | |
-- **Keymap to run the 'Decision' user command** -- | |
vim.api.nvim_set_keymap("n", "<leader>D", ":Decision<CR>", { desc = "New decision template" }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment