Hacker News new | ask | show | jobs
by fragmede 4234 days ago
> what it would take to rewrite Vim from scratch

Time, mainly. Computers these days are fast enough, and have enough storage space that writing Vim will be mostly straight forwards.

The first thing to do, as is for all software, is to make a spec and a roadmap. The doesn't have to be anything too serious, hell, you don't even have to write it out if you don't want to - this is your project after all. (But writing thing down is highly recommended.)

Your spec and roadmap, whether just a notion in your head, or a multi-page written out document with pictures and graphs, should talk about every single feature you want, then break those down into milestones and then break those down into smaller and smaller steps, until they're small enough that you can just start coding (or start googling for the right library)

> What things would I need to teach myself?

Well, you say you know Python and C++. Both are valid choices to write HunnypotVim in; it's your project, so pick one or the other (or a combination of both if you're feeling masochistic). Whatever you chose, you'll need to teach yourself various libraries and their API for your chosen language.

Next, you'll have to decide if you want to make a terminal program, or if you'd rather write a GVim style GUI editor. If you chose a terminal program, you'll need to learn ncurses; a GUI program will need a GUI toolkit, such as QT. Ncurses will have the 'getch' single-character input reader that you'll need in order to reimplement Vim.

You'll also need to learn how to parse command line arguments and file IO.

I'd probably start with a trivial command line argument parser, then move onto basic fileIO before starting in on the ncurses frontend development. Implement normal mode, then hjkl movement keys, finish up with a basic insert mode, and you've got your basic Vim clone!

Additional features left as an exercise for the reader ;)

My email's in my profile if you'd like to discuss this further.

Good luck, and happy coding!

2 comments

I was thinking of writing the core in C++ (or even Haskell - I just realised that I haven't even considered it!) and using Python as the main scripting language, sorta like it is in Blender.
Why not just contribute to Yi[0]? Yi has seen a lot of development activity lately, and I'm sure your contributions would be welcome.

0: https://github.com/yi-editor/yi

Ooh, ooh, real Haskell!

Thanks a ton, although I might still go ahead with my original plan.

Did you mean Qt?

QT == QuickTime