Ask HN: What kind of sample Vim plugin should I build in LVSTHW?
I need advice on the third section of the book. In the third part I want to walk through writing a Vim plugin from scratch. I want it to be something significant that touches a lot of aspects of writing Vim plugins, but I don't want to just make something arbitrary that no one would ever use.
Right now I'm leaning toward writing a plugin for a language that doesn't already have one: Potion[2]. A plugin for a language can touch on syntax, folding, compilers, ft-specific mappings, and tons more.
If you have ideas for a good example plugin that's not too complex (it has to fit into one third of an already short book) but touches lots of aspects of Vimscript and isn't completely contrived, I'd love to hear them.
[Learn Vimscript the Hard Way]: http://learnvimscriptthehardway.stevelosh.com/
[Potion]: http://www.runciter.net/potion/
11 comments
[ 5.0 ms ] story [ 39.2 ms ] thread[Learn Vimscript the Hard Way]: http://learnvimscriptthehardway.stevelosh.com/
[Potion]: http://www.runciter.net/potion/
https://chrome.google.com/webstore/detail/anmdmfcnlenkjbiffg...
It also does sorting and moves the search bar to the top of the page.
* Some of the elements aren't considered for indentation, but they should be. You just have the edit the HTML syntax that comes with Vim to add them to the list.
* I was actually using Django templates, and the tags weren't being considered for indentation. I wrote a little syntax file for those based on the ERB one: https://bitbucket.org/sjl/dotfiles/src/1b6ffba66e9f/vim/bund...
I think you're correct in how many different facets you can show through a language plugin, so I vote for that.
I've often wondered why emacs seems to have these plugins and modes that make one want to learn emacs, and vim doesn't. For instance, org mode. I don't think there something inherent to emacs that makes a mode like that work better there, and I'd love to see info on how to write plugins like that.
In fact, perhaps a simple org mode clone would be a good example project; it would certainly touch a lot of vimscript.
I think part of the reason emacs has better plugins is that it has real support for talking to external processes, where Vim has a bunch of ugly hacks that barely work.
Emacs users have embraced the "do everything in Emacs" philosophy whereas Vim users tend to use a specific tool for a specific job.
It would be awesome if you were able to yank text in one case and it would paste in a different case if it was being pasted on top of exiting text.
for example if you had the code: #define USER_NAME_LEN const int userNameId; class UserName { };
if you did a search and replace for userName to replace with clientName it would update all cases correctly.