Modifying MarkdownTableMd Plugin
844 words | 5 minutes

That day becoming worst as ever. I am just fasting. Trying to read the simple plugin to create markdown table in Lua.

Modifying MarkdownTableMd

I got this plugin is just very simple, so I am gonna to try it. I just put the file in lua directory of neovim runtime, making some table without prefix, and then type :lua Markdown<tab> it will show the list of function available. Just to make sure, because of this plugin algorythm, you must have empty space in beginning and ending of the table.

Modifying Separator

The first problem when I try this plugin is when I am inserting character \|, the table got separated eventhough the github documentation says that the character \| will be rendered as normal pipe. I must change the regex and then correct the position of pipe when string.find is used.

Modifying Insert Column

Inspired by another plugin, I want to implementing insert column to the right side of the table, after wandering around, because of the modification \|, I must change initiation of the variable of i_col from 2 to 1. I wonder it pretty useful, and then changing input column to | is also working as expected. The feature like ToogleAlign also work as expected.

Modifying Swap Feature

This the most annoying moment of myself. After wandering around why col_2 variable become nil, I am then just sleeping. After waking up, I am trying to repairing the code. Trying to initialize variable outside function, and the debug is showing variable that I initialized.

I realized that if variable is set to local then it only can be called from inside of the function. My setup is expect that the variable is outside scope of function. The solution is pretty simple just remove local at initialization and it work like a charm. After I am just making new snippet for markdown just using iabbrev.

Making Snippet

I am just trying snipMate and well yeah the snippet for markdown is pretty simple, so I make my own using iabbrev. I am making it for fromtmatter, image, and link that copied by browser inspired from snipMate. The frontmatter part rather bit tricky. I am finally resolved it to become multiline for easy formatting.

Modifying MKDX

Another awesome plugin that make me interested in markdown editing is amkdx. The feature that I want to implementing is just :

  1. Automatic Numbering
  2. Changing state of checklist
  3. Toggle Checklist
  4. Indent and Unindent on numbered and normal list
  5. o and shift-o that can also be used for automatic nimbering.
  6. Toggle kbd tag

After wandering around, I am trying to remove many bloated code as possible. I am then know that algorythm is detect line as list, checkbox, and checklist using regex that has length almost 5 line. What a sick of code, but yeah, I know that how hard programming look alike that.

I also remove the detection of cursor_hl and index at Enterhandler. Well yeah eventhough it doesn’t work as expected, I am still bit proud of it. I am also remove indexing. On the normal when numbered list got indent more than 4, it doesn’t work as expected. Then, after modifying it then it works as like that. The caveat of this is make shift-o event also becoming worst. I am still like it though. Indent and Unindent still work as expected so I am no vomplaint for it.

I remove the fold code from o and shift-o event since I doesn’t need folding feature. Yeah, then the error suddenly got removed. I removed code in the plugin directory to ftplugin directory, with name markdown on the front, then the code is loaded on the markdown file only as expected. I am really proud of it. After I am sleeping and doesn’t productive at all.

Modifying Color Scheme

I am trying to move all configured markdown to one of my profile in linux. After that I configured my alacritty and neovim color scheme. Inspired by this project, I am trying to change the color scheme with program that I make in Lua language, yeah it work as expected. After knowing that lua need dependency to listing a file in one directory. I want to switch my language to bash, yeah because my algorythm for changing color is very simple not look a like pywal by dylanaraps haha:).

That is for it for me, well I cann’t remove my old bad habit fastly, so In the noon, I am go to bad website again haha. I open terabox app and got interested event, but because the storage is limited time, so I am begin to ignore it again. Yeah I am doing fasting again today haha. Well yeaah one post for three days haha. Hope I can write something like this again. I am very lonely here haha.