From 403ec0aeeef993b73b6ec48e91334592e8e0ce3d Mon Sep 17 00:00:00 2001 From: Adrian Valenzuela Date: Thu, 28 Sep 2023 00:33:13 -0700 Subject: [PATCH 1/3] Adds reset to index --- plugin/chronos.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/chronos.lua b/plugin/chronos.lua index 990887a..0f466b5 100644 --- a/plugin/chronos.lua +++ b/plugin/chronos.lua @@ -1,9 +1,10 @@ -print("Chronos loaded in due time") +print("Chronos loaded in just in time") local date_formats = { "%Y-%m-%d", "%Y/%m/%d", - "%d/%m/%Y", + "%m-%d-%Y", + "%m/%d/%Y", } local current_format_index = 1 @@ -27,6 +28,7 @@ function cycle_date_format() end function reset_feature() + current_format_index = 1 last_inserted_text = "" end From 25446eada5706c46ad4ab5d0c5ba5c9daaef8201 Mon Sep 17 00:00:00 2001 From: Adrian Valenzuela Date: Thu, 28 Sep 2023 00:39:11 -0700 Subject: [PATCH 2/3] Changes keymap to choose time --- plugin/chronos.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/chronos.lua b/plugin/chronos.lua index 0f466b5..06ed213 100644 --- a/plugin/chronos.lua +++ b/plugin/chronos.lua @@ -32,6 +32,6 @@ function reset_feature() last_inserted_text = "" end -vim.keymap.set("i", "", "lua cycle_date_format()", { noremap = true }) +vim.keymap.set("i", "", "lua cycle_date_format()", { noremap = true }) vim.cmd("autocmd InsertCharPre * lua reset_feature()") From 6724cd58a41edcd7a60d22dd0dfc8f2ba1c0ad45 Mon Sep 17 00:00:00 2001 From: Adrian Valenzuela Date: Thu, 28 Sep 2023 00:45:00 -0700 Subject: [PATCH 3/3] Updates readme --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9852535..6bd4c0f 100644 --- a/README.md +++ b/README.md @@ -40,18 +40,17 @@ return { ## How to use -Just hit `` repeatedly (while in insert mode) until you come across a date you like. +Just hit `` repeatedly (while in insert mode) until you come across a date you like. ## Configuration -No real configuration. Right now the function just a keymap that calls the function. -Can be overridden pretty easily. +No real configuration. A keymap that calls the function to cycle through the time. -Place something like this in your `keymaps.lua` or where ever you keep your mappings: +To override, place something like this in your `keymaps.lua` or where ever you keep your mappings: ``` -# To override just pass in the keymap of your choice. Like if it is: -vim.keymap.set("i", "", "lua cycle_date_format()", { noremap = true }) +# This changed the keymap to and enables it in normal mode +vim.keymap.set("n", "", "lua cycle_date_format()", { noremap = true }) ``` ## Why this plugin?