Skip to content

Commit 7c37bac

Browse files
Make all mappings dot repeatable with vim-repeat plugin. Closes #160.
1 parent 3c482ae commit 7c37bac

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

DOCS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
2. [Agenda mappings](#agenda-mappings)
1010
3. [Capture mappings](#capture-mappings)
1111
4. [Org mappings](#org-mappings)
12-
4. [Text objects](#text-objects)
12+
5. [Text objects](#text-objects)
13+
6. [Dot repeat](#dot-repeat)
1314
3. [Document Diagnostics](#document-diagnostics)
1415
4. [Autocompletion](#autocompletion)
1516
5. [Abbreviations](#abbreviations)
@@ -793,6 +794,9 @@ require('orgmode').setup({
793794
})
794795
```
795796

797+
### Dot repeat
798+
To make all mappings dot repeatable, install [vim-repeat](https://github.com/tpope/vim-repeat) plugin.
799+
796800
## Document Diagnostics
797801
Since tree-sitter parser is being used to parse the file, if there are some syntax errors,
798802
it can potentially fail to parse specific parts of document when needed. If you are using Neovim v0.6.0 which has

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ start the command `:language ` and press `<TAB>` to autocomplete possible option
239239
* Insert/Move/Refile headlines
240240
* Change tags
241241
* Toggle checkbox state
242+
* Clocking time
243+
* Remote editing from agenda view
244+
* Repeatable mapping via [vim-repeat](https://github.com/tpope/vim-repeat)
242245

243246
### Features (Detailed breakdown):
244247
* Agenda prompt:
@@ -338,7 +341,7 @@ Parsing is done via builtin tree-sitter parser and [tree-sitter-org](https://git
338341
* [ ] Improve checkbox hierarchy
339342
* [X] Support todo keyword faces
340343
* [X] Support clocking work time
341-
* [ ] Improve folding
344+
* [X] Improve folding
342345
* [X] Support exporting (via existing emacs tools)
343346
* [ ] Support archiving to specific headline
344347
* [ ] Support tables

doc/orgmode.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ CONTENTS *orgmode-content
130130
1.2.5.6. around_heading_from_root...|orgmode-around_heading_from_root|
131131
1.2.5.7. inner_subtree_from_root.....|orgmode-inner_subtree_from_root|
132132
1.2.5.8. around_subtree_from_root...|orgmode-around_subtree_from_root|
133+
1.2.6. Dot repeat.....................................|orgmode-dot_repeat|
133134
1.3. Document Diagnostics.......................|orgmode-document_diagnostics|
134135
1.4. Autocompletion...................................|orgmode-autocompletion|
135136
1.5. Abbreviations.....................................|orgmode-abbreviations|
@@ -165,6 +166,7 @@ TABLE OF CONTENT *orgmode-table_of_conten
165166
3. Capture mappings (#capture-mappings)
166167
4. Org mappings (#org-mappings)
167168
5. Text objects (#text-objects)
169+
6. Dot repeat (#dot-repeat)
168170
3. Document Diagnostics (#document-diagnostics)
169171
4. Autocompletion (#autocompletion)
170172
5. Abbreviations (#abbreviations)
@@ -1130,6 +1132,10 @@ These mappings live under `mappings.text_objects`, and can be changed like this:
11301132
})
11311133
<
11321134

1135+
DOT REPEAT *orgmode-dot_repeat*
1136+
1137+
To make all mappings dot repeatable, install vim-repeat (https://github.com/tpope/vim-repeat) plugin.
1138+
11331139
--------------------------------------------------------------------------------
11341140
DOCUMENT DIAGNOSTICS *orgmode-document_diagnostics*
11351141

lua/orgmode/init.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ local function reload(file)
8484
return instance:reload(file)
8585
end
8686

87+
---@param cmd string
88+
---@param opts string
89+
local function set_dot_repeat(cmd, opts)
90+
local repeat_action = { string.format("'%s'", cmd) }
91+
if opts then
92+
table.insert(repeat_action, string.format("'%s'", opts))
93+
end
94+
vim.cmd(
95+
string.format(
96+
[[silent! call repeat#set("\<cmd>lua require('orgmode').action(%s)\<CR>")]],
97+
table.concat(repeat_action, ',')
98+
)
99+
)
100+
end
101+
87102
---@param opts table
88103
local function action(cmd, opts)
89104
local parts = vim.split(cmd, '.', true)
@@ -103,6 +118,7 @@ local function action(cmd, opts)
103118
return require('orgmode.utils').echo_error(result)
104119
end
105120
end
121+
set_dot_repeat(cmd, opts)
106122
return result
107123
end
108124
end

0 commit comments

Comments
 (0)