-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmarkdown-plus.txt
More file actions
1347 lines (1008 loc) · 42.7 KB
/
markdown-plus.txt
File metadata and controls
1347 lines (1008 loc) · 42.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
*markdown-plus.txt* Enhanced Markdown editing for Neovim Last change: 2025 January 19
==============================================================================
Table of Contents *markdown-plus-table-of-contents*
1. Introduction |markdown-plus-introduction|
- Features |markdown-plus-introduction-features|
2. Installation |markdown-plus-installation|
- lazy.nvim |markdown-plus-installation-lazy.nvim|
- Configuration |markdown-plus-installation-configuration|
3. Usage |markdown-plus-usage|
- Headers |markdown-plus-usage-headers|
- Lists |markdown-plus-usage-lists|
- Formatting |markdown-plus-usage-formatting|
- Links |markdown-plus-usage-links|
- Quotes |markdown-plus-usage-quotes|
- Tables |markdown-plus-usage-tables|
4. Configuration |markdown-plus-configuration|
- Keymaps |markdown-plus-configuration-keymaps|
- Options |markdown-plus-configuration-options|
5. Commands |markdown-plus-commands|
6. API |markdown-plus-api|
7. Troubleshooting |markdown-plus-troubleshooting|
8. Contributing |markdown-plus-contributing|
9. License |markdown-plus-license|
==============================================================================
1. Introduction *markdown-plus-introduction*
markdown-plus.nvim is a comprehensive plugin that enhances Markdown editing in
Neovim with intelligent formatting, list management, header manipulation, and
table of contents generation. It provides context-aware keymaps that work
seamlessly within lists while preserving normal Vim behavior elsewhere.
The plugin is designed to be lightweight, fast, and integrate naturally with
your existing Neovim workflow.
Note: While originally designed for Markdown, this plugin can be configured to
work with any filetype. See |markdown-plus-configuration-filetypes| for details.
FEATURES *markdown-plus-introduction-features*
- Smart list management:
- Auto-continuation with proper markers and indentation
- Intelligent renumbering for ordered and letter-based lists
- Support for multiple list types (unordered, ordered, letter-based, parenthesized)
- Context-aware Tab/Shift-Tab for indentation
- Automatic empty item removal
- Smart backspace to remove list markers
- Header operations:
- Quick header level promotion/demotion
- Set specific header levels (H1-H4)
- Navigate between headers with ]] and [[
- Generate and update Table of Contents (TOC) with GitHub-style anchors
- TOC duplicate prevention with HTML comment markers
- Navigate to headers from TOC
- Text formatting:
- Toggle bold, italic, strikethrough, and inline code
- Convert selected rows to code block
- Smart formatting that respects word boundaries
- Clear all formatting from selected text
- Works in both normal and visual mode
- Links & References:
- Insert and edit markdown links
- Convert text selection to links
- Auto-convert bare URLs to markdown links
- Convert between inline and reference-style links
- Smart reference ID generation and reuse
- Open links with native Neovim (gx)
- Quotes Management:
- Toggle blockquote on current line or visual selection
- Table Support (Phase 1):
- Create tables interactively with custom dimensions
- Auto-format and align table columns
- Normalize malformed tables
- Row operations (insert, delete, duplicate)
- Column operations (insert, delete, duplicate)
- Insert mode navigation with Alt+hjkl (circular wrapping)
- Alignment support (left, center, right)
- Smart cursor positioning after operations
- Context-aware keymaps:
- List operations only active within lists
- Proper fallback to default Vim behavior
- Insert mode operations that respect context
==============================================================================
2. Installation *markdown-plus-installation*
LAZY.NVIM *markdown-plus-installation-lazy.nvim*
Basic installation for markdown files:
>lua
{
'yousefhadder/markdown-plus.nvim',
ft = 'markdown',
opts = {
-- See configuration section for available options
},
}
<
Installation for multiple filetypes:
>lua
{
'yousefhadder/markdown-plus.nvim',
ft = { 'markdown', 'text', 'txt' },
config = function()
require('markdown-plus').setup({
filetypes = { 'markdown', 'text', 'txt' },
})
end,
}
<
CONFIGURATION *markdown-plus-installation-configuration*
Basic configuration with custom keymaps:
>lua
{
'yousefhadder/markdown-plus.nvim',
ft = 'markdown',
config = function()
require('markdown-plus').setup({
enabled = true,
features = {
list_management = true,
text_formatting = true,
headers_toc = true,
links = true,
quotes = true,
code_block = true,
table = true,
},
})
end,
}
<
==============================================================================
3. Usage *markdown-plus-usage*
HEADERS *markdown-plus-usage-headers*
Headers are lines starting with one or more `#` symbols.
PROMOTE/DEMOTE ~
Place your cursor on a header line and use:
- `<leader>h+` to promote (decrease level, add `#`)
- `<leader>h-` to demote (increase level, remove `#`)
Example:
>
### Header -> ## Header (promoted with <leader>h+)
## Another Header -> ### Another (demoted with <leader>h-)
<
You can also set a specific header level directly:
- `<leader>h1` to convert to H1 (# Header)
- `<leader>h2` to convert to H2 (## Header)
- `<leader>h3` to convert to H3 (### Header)
- `<leader>h4` to convert to H4 (#### Header)
- `<leader>h5` to convert to H5 (##### Header)
- `<leader>h6` to convert to H6 (###### Header)
NAVIGATE HEADERS ~
Jump between headers quickly:
- `]]` to jump to next header
- `[[` to jump to previous header
TABLE OF CONTENTS ~
Generate a TOC with `<leader>ht`. The TOC will be wrapped in HTML comment
markers to prevent duplicates:
>markdown
<!-- TOC -->
## Table of Contents
- [Introduction](#introduction)
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Configuration](#configuration)
<!-- /TOC -->
<
The HTML markers (`<!-- TOC -->` and `<!-- /TOC -->`) are invisible in
rendered Markdown but provide clear boundaries. If you try to generate a TOC
when one already exists, you'll see: "TOC already exists. Use <leader>hu to
update it."
Update the TOC with `<leader>hu` when you've added or modified headers.
Follow TOC links with `gd` when cursor is on a link to jump to that header.
TOC WINDOW (NAVIGABLE) ~
*markdown-plus-toc-window*
Open an interactive Table of Contents window to browse and navigate your
document structure:
>vim
:Toc " Open TOC in vertical split
:Toch " Open TOC in horizontal split
:Toct " Open TOC in new tab
<leader>hT " Default keymap to toggle TOC
<
Features:
- Progressive disclosure: Shows H1-H2 initially, expand on demand
- Fold/unfold: `l` to expand, `h` to collapse or jump to parent
- Color-coded levels: Each header level has distinct color
- Visual markers: ▶ (collapsed), ▼ (expanded)
- Jump to headers: Press <Enter> on any header
- Help popup: Press ? for keyboard shortcuts
- Toggle on/off: No duplicate windows
- Auto-sizing: Window adapts to content width
Keymaps (inside TOC):
l Expand header to show children
h Collapse header or jump to parent
<Enter> Jump to header in source buffer
q Close TOC window
? Show help popup
Configuration:
initial_depth: Set initial display depth (default: 2)
>lua
require('markdown-plus').setup({
toc = {
initial_depth = 3, -- Show H1-H3 initially
}
})
<
LISTS *markdown-plus-usage-lists*
markdown-plus.nvim provides intelligent list management with context-aware
behavior for multiple list types:
- Unordered: `-`, `*`, `+`
- Ordered: `1.`, `2.`, `3.`
- Letter-based: `a.`, `b.`, `c.` and `A.`, `B.`, `C.`
- Parenthesized: `1)`, `2)` and `a)`, `b)` and `A)`, `B)`
All list types support checkboxes (e.g., `- [ ]`, `1. [x]`, `a. [ ]`).
CHECKBOX TOGGLING ~
Toggle checkboxes with `<leader>mx` in normal/visual mode or `<C-t>` in insert
mode:
>markdown
- Regular item Press <leader>mx → - [ ] Regular item
- [ ] Unchecked Press <leader>mx → - [x] Unchecked
- [x] Checked Press <leader>mx → - [ ] Checked
Works with all list types:
1. Item → 1. [ ] Item → 1. [x] Item
a. Task → a. [ ] Task → a. [x] Task
Visual mode - select lines and press <leader>mx to toggle multiple items
Insert mode - press <C-t> to toggle without leaving insert mode
<
AUTO-CONTINUATION ~
Press `<CR>` in insert mode or `o`/`O` in normal mode on a list item to
create a new item:
>markdown
- First item
- Second item| -> - Second item
- |
1. First item
2. Second item| -> 2. Second item
3. |
a. First letter
b. Second letter| -> b. Second letter
c. |
<
Empty items are automatically removed when you press `<CR>` again:
>markdown
- Item one
- | -> - Item one
|
<
Note: In insert mode, `<CR>` is context-aware - it only creates new list
items when you're actually in a list. Outside of lists, it behaves normally.
INDENTATION ~
Use `<Tab>` and `<S-Tab>` in insert mode to indent/dedent list items.
All list types maintain their marker style when indented:
>markdown
- Item
- Sub-item| <Tab> - Item
- Another - Sub-item
- |
- Another
<
Outside of lists, `<Tab>` and `<S-Tab>` insert/remove indentation normally.
RENUMBERING ~
Ordered and letter-based lists are automatically renumbered as you edit.
Manual renumbering is available with `<leader>mr`.
The renumbering system intelligently handles:
- Nested lists: Each nesting level maintains independent numbering
- Blank lines: Lists separated by blank lines restart numbering from 1/a/A
- Mixed depths: Works correctly at any nesting depth
Example of nested list renumbering:
>markdown
1. A
1. B
2. C
2. D
1. E <- Correctly restarts at 1 (not 3)
2. F
<
Example of blank line separation:
>markdown
1. First list
2. Second item
1. New list <- Restarts at 1 after blank line
2. Second item
<
SMART BACKSPACE ~
The `<BS>` key in insert mode is context-aware:
- In empty list items: removes the list marker
- Otherwise: deletes character normally
FORMATTING *markdown-plus-usage-formatting*
All formatting commands work in both normal and visual mode. Use `<leader>m`
prefix for formatting operations.
BOLD ~
Toggle bold with `<leader>mb`:
>markdown
This is text -> This is *bold text*
This is *bold text* -> This is text
<
ITALIC ~
Toggle italic with `<leader>mi`:
>markdown
This is text -> This is *italic text*
This is *italic text* -> This is text
<
STRIKETHROUGH ~
Toggle strikethrough with `<leader>ms`:
>markdown
This is text -> This is ~~text~~
This is ~~text~~ -> This is text
<
CODE ~
Toggle inline code with `<leader>mc`:
>markdown
This is code -> This is `code`
This is `code` -> This is code
<
CODE BLOCK ~
Convert selected rows to a code block with `<leader>mw`:
1. Enter visual block mode with `V`.
2. Select the rows you want to convert.
3. Press `<leader>mw`.
4. Enter the language for the code block when prompted (e.g., txt).
>markdown
This is some text
and more text
<
After following the steps above, the selected text will become:
>markdown
```txt
This is some text
and more text
```
<
CLEAR FORMATTING ~
Remove all formatting with `<leader>mC`:
>markdown
Formatted text -> This is some text
<
LINKS *markdown-plus-usage-links*
markdown-plus.nvim provides comprehensive link management with support for
both inline and reference-style links.
INSERT NEW LINK ~
Press `<leader>ml` in normal mode to insert a new link:
>markdown
Cursor here| -> [GitHub](https://github.com)|
<
You'll be prompted for:
1. Link text (e.g., "GitHub")
2. URL (e.g., "https://github.com")
CONVERT SELECTION TO LINK ~
Select text in visual mode and press `<leader>ml`:
>markdown
Visit my website -> Visit [my website](https://example.com)
^^^^^^^^^^
(selected)
<
You'll be prompted for the URL only.
EDIT EXISTING LINK ~
Place cursor anywhere on a link and press `<leader>me`:
>markdown
[Old Text](https://old-url.com)
Press <leader>me:
1. Link text: Old Text (edit or press Enter)
2. URL: https://old-url.com (edit or press Enter)
Result: [New Text](https://new-url.com)
<
Works with both inline links `[text](url)` and reference links `[text][ref]`.
OPEN LINKS IN BROWSER ~
Use Neovim's native `gx` command to open links:
>markdown
[Google](https://google.com) <- Press gx here
https://example.com <- Also works on bare URLs
<
The `gx` command will open the URL in your default browser.
AUTO-CONVERT URL TO LINK ~
Place cursor on a bare URL and press `<leader>ma`:
>markdown
https://github.com/user/repo
Press <leader>ma:
Link text (empty for URL): GitHub Repo
Result: [GitHub Repo](https://github.com/user/repo)
<
Leave the text prompt empty to use the URL as link text.
REFERENCE-STYLE LINKS ~
Convert inline link to reference-style with `<leader>mR`:
>markdown
[Documentation](https://docs.example.com)
Press <leader>mR:
Result:
[Documentation][documentation]
... (at end of document)
[documentation]: https://docs.example.com
<
The reference ID is auto-generated from the link text (lowercase, hyphens,
alphanumeric only).
Convert reference link to inline with `<leader>mI`:
>markdown
[My Link][myref]
[myref]: https://myref.com
Press <leader>mI on the link:
Result: [My Link](https://myref.com)
<
REFERENCE REUSE ~
When converting links with the same text and URL to reference-style, the
plugin automatically reuses the existing reference:
>markdown
Check out [GitHub](https://github.com) for code.
Visit [GitHub](https://github.com) to see projects.
Press <leader>mR on both:
Result:
Check out [GitHub][github] for code.
Visit [GitHub][github] to see projects.
[github]: https://github.com <- Only one definition
<
Links with different text create separate references even with same URL:
>markdown
[dotfiles](https://github.com/yousefhadder/dotfiles)
[My Dotfiles](https://github.com/yousefhadder/dotfiles)
Press <leader>mR on both:
Result:
[dotfiles][dotfiles]
[My Dotfiles][my-dotfiles]
[dotfiles]: https://github.com/yousefhadder/dotfiles
[my-dotfiles]: https://github.com/yousefhadder/dotfiles
<
QUOTES *markdown-plus-usage-quotes*
Toggle blockquote on current line or visual selection with `<leader>mq`.
NORMAL MODE ~
Place cursor on a line and press `<leader>mq`:
>markdown
This is a normal line -> > This is a normal line
> This is a quoted line -> This is a normal line
<
VISUAL MODE ~
Select multiple lines in visual mode and press `<leader>mq`:
>markdown
Normal line 1
Normal line 2
->
> Normal line 1
> Normal line 2
<
TABLES *markdown-plus-usage-tables*
Table support provides comprehensive features for creating, formatting, and
manipulating markdown tables.
CREATE TABLES ~
Create a new table interactively with `<leader>tc`. You'll be prompted for:
1. Number of rows (excluding header)
2. Number of columns
Example result:
>markdown
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| | | |
| | | |
<
FORMAT AND NORMALIZE ~
Format tables with `<leader>tf` to auto-align columns:
>markdown
| Name | Age | City | | Name | Age | City |
|---|---|---| -> |-------|-----|------|
| Alice | 25 | NYC | | Alice | 25 | NYC |
| Bob | 30 | LA | | Bob | 30 | LA |
<
Normalize malformed tables with `<leader>tn`:
>markdown
| Header 1 | Header 2 | Header 1 | Header 2 |
|---|--- -> |----------|----------|
Missing | pipes | Missing | pipes |
<
ROW OPERATIONS ~
Insert rows:
- `<leader>tir` - Insert row below current row
- `<leader>tiR` - Insert row above current row
Delete rows:
- `<leader>tdr` - Delete current row (protects header/separator)
Duplicate rows:
- `<leader>tyr` - Duplicate current row below
Example:
>markdown
| Name | Age |
|-------|-----|
| Alice | 25 | <- Press <leader>tir
| Bob | 30 |
Result:
| Name | Age |
|-------|-----|
| Alice | 25 |
| | | <- New empty row
| Bob | 30 |
<
COLUMN OPERATIONS ~
Insert columns:
- `<leader>tic` - Insert column to the right
- `<leader>tiC` - Insert column to the left
Delete columns:
- `<leader>tdc` - Delete current column (protects last column)
Duplicate columns:
- `<leader>tyc` - Duplicate current column to the right
Example:
>markdown
| Name | Age | | Name | Age | |
|-------|-----| -> |-------|-----|-----|
| Alice | 25 | | Alice | 25 | |
^ <leader>tic pressed here
<
ALIGNMENT SUPPORT ~
Tables support three alignment types in separator row:
- Left-aligned (default): `:---`
- Center-aligned: `:---:`
- Right-aligned: `---:`
Example:
>markdown
| Left | Center | Right |
|:-----|:------:|------:|
| A | B | C |
| D | E | F |
<
Formatting operations preserve alignment markers.
INSERT MODE NAVIGATION ~
Navigate table cells in insert mode using Alt+hjkl:
- `<A-h>` - Move to cell on the left
- `<A-l>` - Move to cell on the right
- `<A-j>` - Move to cell below
- `<A-k>` - Move to cell above
Navigation wraps around (circular):
- Moving right at last column wraps to first column
- Moving left at first column wraps to last column
- Moving down at last row wraps to header row
- Moving up at header row wraps to last data row
Example:
>markdown
| Name | Age | City |
|-------|-----|----------|
| Alice | 25 | New York | <- cursor here
| Bob | 30 | LA |
Press <A-l> to move right:
| Name | Age | City |
|-------|-----|----------|
| Alice | 25 | New York |
| Bob | 30 | LA | <- cursor moves here
^
<
When not in a table, navigation keys fall back to arrow keys.
TABLE FEATURES ~
Smart cursor positioning:
After all operations, cursor is automatically positioned in the most
logical cell (first cell of new/modified row/column).
Header protection:
Cannot delete header row or separator row. Operations maintain table
structure integrity.
Minimum constraints:
- Cannot delete the last column
- Cannot delete the only data row
- Always maintains: header + separator + at least one data row
==============================================================================
4. Configuration *markdown-plus-configuration*
KEYMAPS *markdown-plus-configuration-keymaps*
Keymaps are automatically set up when the plugin loads (for configured filetypes).
You can disable all defaults with `keymaps.enabled = false` and use provided
`<Plug>` mappings to define custom keymaps (see below).
Default keymaps:
>lua
{
keymaps = {
-- Header operations
promote_header = '<leader>h+', -- Promote (increase level)
demote_header = '<leader>h-', -- Demote (decrease level)
generate_toc = '<leader>ht', -- Generate TOC
update_toc = '<leader>hu', -- Update TOC
open_toc_window = '<leader>hT', -- Toggle TOC window
next_header = ']]', -- Jump to next header
prev_header = '[[', -- Jump to previous header
set_h1 = '<leader>h1', -- Convert to H1
set_h2 = '<leader>h2', -- Convert to H2
set_h3 = '<leader>h3', -- Convert to H3
set_h4 = '<leader>h4', -- Convert to H4
set_h5 = '<leader>h5', -- Convert to H5
set_h6 = '<leader>h6', -- Convert to H6
-- List operations (Insert mode)
auto_continue = '<CR>', -- Auto-continue lists or split content
continue_content = '<A-CR>', -- Continue content on next line
indent_list = '<Tab>', -- Indent list item
dedent_list = '<S-Tab>', -- Dedent list item
smart_backspace = '<BS>', -- Smart backspace
-- List operations (Normal mode)
new_item_below = 'o', -- New list item below
new_item_above = 'O', -- New list item above
renumber_lists = '<leader>mr', -- Manual renumber
toggle_checkbox = '<leader>mx', -- Toggle checkbox (normal/visual)
debug_lists = '<leader>md', -- Debug: show list groups
-- List operations (Insert mode - checkbox)
toggle_checkbox_insert = '<C-t>', -- Toggle checkbox in insert mode
-- Formatting operations (normal + visual)
toggle_bold = '<leader>mb',
toggle_italic = '<leader>mi',
toggle_strikethrough = '<leader>ms',
toggle_code = '<leader>mc',
convert_to_code_block = '<leader>mw', -- Convert selection to code block
clear_formatting = '<leader>mC',
-- Link operations
insert_link = '<leader>ml', -- Insert/convert to link
edit_link = '<leader>me', -- Edit link under cursor
auto_link_url = '<leader>ma', -- Convert URL to link
to_reference = '<leader>mR', -- Convert to reference-style
to_inline = '<leader>mI', -- Convert to inline
follow_link = 'gd', -- Follow TOC link
open_link = 'gx', -- Open link in browser (native)
-- Quotes operations
toggle_quote = '<leader>mq', -- Toggle blockquote
-- Table operations (Normal mode)
table_create = '<leader>tc', -- Create table interactively
table_format = '<leader>tf', -- Format table
table_normalize = '<leader>tn', -- Normalize malformed table
table_insert_row_below = '<leader>tir', -- Insert row below
table_insert_row_above = '<leader>tiR', -- Insert row above
table_delete_row = '<leader>tdr', -- Delete current row
table_duplicate_row = '<leader>tyr', -- Duplicate current row
table_insert_column_right = '<leader>tic', -- Insert column right
table_insert_column_left = '<leader>tiC', -- Insert column left
table_delete_column = '<leader>tdc', -- Delete current column
table_duplicate_column = '<leader>tyc', -- Duplicate current column
table_toggle_alignment = '<leader>ta', -- Toggle cell alignment
table_clear_cell = '<leader>tx', -- Clear cell content
table_move_column_left = '<leader>tmh', -- Move column left
table_move_column_right = '<leader>tml', -- Move column right
table_move_row_up = '<leader>tmk', -- Move row up
table_move_row_down = '<leader>tmj', -- Move row down
table_transpose = '<leader>tt', -- Transpose table
table_sort_ascending = '<leader>tsa', -- Sort by column (ascending)
table_sort_descending = '<leader>tsd', -- Sort by column (descending)
table_to_csv = '<leader>tvx', -- Convert table to CSV
csv_to_table = '<leader>tvi', -- Convert CSV to table
-- Table operations (Insert mode)
table_move_left = '<A-h>', -- Move to cell left (wraps)
table_move_right = '<A-l>', -- Move to cell right (wraps)
table_move_down = '<A-j>', -- Move to cell down (wraps)
table_move_up = '<A-k>', -- Move to cell up (wraps)
}
}
<
OPTIONS *markdown-plus-configuration-options*
The plugin can be configured through the setup function:
>lua
require('markdown-plus').setup({
enabled = true, -- Enable/disable the plugin
features = {
list_management = true, -- List auto-continuation, indentation, etc.
table = true, -- Table support features
text_formatting = true, -- Bold, italic, strikethrough, code
headers_toc = true, -- Header manipulation and TOC generation
links = true, -- Link management and references
quotes = true, -- Blockquote (>) management
code_block = true, -- Convert selected text to code blocks
},
toc = { -- TOC window configuration
initial_depth = 2,
},
table = { -- Table sub-configuration
auto_format = true,
default_alignment = 'left', -- 'left' | 'center' | 'right'
confirm_destructive = true, -- Confirm before transpose/sort operations
keymaps = {
enabled = true,
prefix = '<leader>t',
insert_mode_navigation = true, -- Alt+hjkl navigation in insert mode
},
},
keymaps = {
enabled = true, -- Enable/disable default keymaps
},
filetypes = { 'markdown' }, -- Filetypes to enable the plugin for
})
<
Alternative: vim.g Configuration *markdown-plus-configuration-vim-g*
For Vimscript compatibility or if you prefer not to call setup(), you can
configure the plugin using |vim.g.markdown_plus|:
Using a table (Lua): ~
>lua?
vim.g.markdown_plus = {
enabled = true,
features = {
list_management = true,
text_formatting = false,
quotes = true,
},
keymaps = {
enabled = false,
},
filetypes = { 'markdown', 'text' },
}
<
Using a table (Vimscript): ~
>vim
let g:markdown_plus = #{
\ enabled: v:true,
\ features: #{
\ list_management: v:true,
\ text_formatting: v:false,
\ quotes: v:true
\ },
\ keymaps: #{
\ enabled: v:false
\ },
\ filetypes: ['markdown', 'text']
\ }
<
Using a function (dynamic configuration): ~
>lua
vim.g.markdown_plus = function()
return {
enabled = vim.fn.has('nvim-0.10') == 1,
features = {
text_formatting = not vim.g.vscode, -- Disable in VSCode
quotes = true,
},
}
end
<
Configuration Priority ~
When both |vim.g.markdown_plus| and setup() are used, they are merged with
the following priority:
1. Default configuration (lowest priority)
2. vim.g.markdown_plus configuration
3. setup(opts) parameter (highest priority)
Example:
>lua
vim.g.markdown_plus = {
features = { list_management = false },
}
require('markdown-plus').setup({
features = { list_management = true }, -- Overrides vim.g
})
-- Result: list_management will be true
<
This allows you to set global defaults with vim.g and override specific
settings with setup() for certain filetypes or conditions.
*markdown-plus-configuration-filetypes*
The plugin can be enabled for any filetype, not just markdown. This is useful
for plain text files, note-taking formats, or any text-based format where you
want markdown-style formatting.
Example: Enable for markdown and plain text files ~
>lua
require('markdown-plus').setup({
filetypes = { 'markdown', 'text', 'txt' },
})
<
Example: Enable for custom note-taking setup ~
>lua
require('markdown-plus').setup({
filetypes = { 'markdown', 'note', 'org', 'wiki' },
})
<
Important: Make sure your plugin manager also loads the plugin for these
filetypes. For lazy.nvim:
>lua
{
'yousefhadder/markdown-plus.nvim',
ft = { 'markdown', 'text', 'txt' }, -- Match your filetypes config
config = function()
require('markdown-plus').setup({