[WIP] My First Vim Plugin: vim-genox
Lately I have been really enjoying my time with NeoVim.
If you directly want to see the repository: oxalorg/vim-genox
Check my dotfiles here
Using vim over the years, I already somewhat understand VimScript but only on the surface. I could write simple functions, commands, loops, and controls – just enough for me to figure out petty hacks using existing solution and stuff them in my vimrc.
I’ve been meaning to learn VimScript since a long time now. Recently my vimrc exceeded over 500 lines and I hate the fact that I don’t understand a lot of the wizardry going on on it.
I had a problem since the past few weeks (years actually): Publishing to my blog is unnecessarily hard, and I have always blamed this complexity to why I haven’t been blogging more frequently.
I use a static site generator called genox and currently the procedure of creating a new blog post looks like this:
- Go to my blog directory
- Create a new markdown file with proper filename
- Add YML meta tags in a correct format
- Add current date in the meta tag
- write content
- save the file go back to blog root directory
- build and deploy
I want to automate this process using vim so that I can do something like this:
- Hotkey to create a new blog post directly (with yaml metadata) in my blog directory (doesn’t matter where I am as long as I am inside neovim, maybe I want to extract some code snippet I just wrote in a different project and make a post out of it?)
- Hotkey to build and deploy (from within vim) & copy blog url to clipboard)
So I’ll be building a vim plugin for genox
.
I intend to learn VimL while building this and although I could just stuff everything in my vimrc - I am using this as an excuse to learn about creating and distributing Vim Plugins.
My inital version of the plugin can be found here: oxalorg/vim-genox
It only works on my machine and only solves a few of my problems. But I hope to include a lot more automation into it.
Now that I am understanding a bit of VimScript, maybe…
vim is the new emacs
hehe just kidding