local M = { 'monaqa/dial.nvim' } ---Create a right hand side for `dial` key maps. ---@param cmd string: name of a function from `dial.map`. ---@param suffix? string: keys to add after `dial`s mapping. ---@return function local dial_cmd = function(cmd, suffix) suffix = suffix or '' return function() return require('dial.map')[cmd]() .. suffix end end ---Make a new augent that cycles over the given elements. ---@param elements string[]: the elements to cycle. ---@return table: @see `dial.types.Augend` local cyclic_augend = function(elements) return require('dial.augend').constant.new { elements = elements, word = true, cyclic = true } end M.keys = { { '', dial_cmd('inc_normal'), expr = true, desc = ' Increment' }, { '', dial_cmd('dec_normal'), expr = true, desc = ' Decrement' }, { '', dial_cmd('inc_visual', 'gv'), expr = true, desc = ' Increment', mode = 'v' }, { '', dial_cmd('dec_visual', 'gv'), expr = true, desc = ' Decrement', mode = 'v' }, { 'g', dial_cmd('inc_gvisual', 'gv'), expr = true, desc = ' Increment', mode = 'v' }, { 'g', dial_cmd('dec_gvisual', 'gv'), expr = true, desc = ' Decrement', mode = 'v' }, } M.config = function() local augend = require('dial.augend') require('dial.config').augends:register_group { default = { augend.integer.alias.decimal_int, augend.integer.alias.hex, augend.integer.alias.binary, augend.constant.alias.bool, augend.semver.alias.semver, augend.date.alias['%Y-%m-%d'], augend.date.alias['%d/%m/%Y'], augend.date.alias['%d.%m.%Y'], cyclic_augend { 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' }, cyclic_augend { 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' }, cyclic_augend { 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su' }, } } end return M