Hacker News new | past | comments | ask | show | jobs | submit login
Vim-Mario: Mario on Vim (github.com/rbtnn)
241 points by tambourine_man 32 days ago | hide | past | favorite | 71 comments



This is art.

Did expect a much longer (and less clear) source code. A really inspiring project, thanks!

Of course, there is emacs-nes (a full NES emulator in emacs lisp).


Decided to try Doom Emacs a few days ago as a long-time Vim user.

Man...

Any comparison between the two is completely besides the point. Vim is a great text editor that one can extend. Emacs is a computing environment that happens to revolve around text. The tools are simply in different categories altogether.


As a long-time (decades) vi user, I decided once to force myself to use Emacs for a full year just to see what people liked about it. I have to tell you - I was so relieved when my year was up and I could go back to vi. I never "felt" emacs no matter how much time I spent using it.


VI is a text editing language, and the VIM and NeoVIM implementations are terrific.

Emacs is a text editing platform, but its text editing language is good for writing only. Not good for editing, not good for copying or moving code, not good for navigating, not good for working with brackets or parenthesis despite the lisp language being almost native to Emacs.

My recent exploration into org-mode introduced me to Evil. It's 95% of the VI language, in an amazing text editing platform. I'm currently only using Emacs for org-mode right now, but suddenly new worlds are opening. For instance, I've been looking for a good tool to navigate CSV files from the CLI (or any other keyboard-controlled environment) for over two decades. I'm not yet explored the possibilities with Emacs, but I'm told they are good. Then possibly browsing simple websites, such as HN and Wikipedia, maybe a better Git interface, maybe a good Telegram / Slack / IRC combined messenger, maybe a good email reader.

Suggestions welcome!


> Not good for editing

I knew Emacs wasn't the editor for me when I found out that there isn't, by default, a way to quickly duplicate a line. Of course, the emacs community says that adding this feature is a simple matter of defining a macro in your emacs config file. Very different mindset.


Of course there is a way to duplicate a line in Emacs by default. Like in vi, you compose simple commands.

Let's see:

  ; Duplicates the current line
  S-C-backspace C-[y y]

  ; Duplicates the current line
  C-[a k k y y]

  ; Duplicates the current line
  C-[a SPC n w y y]

  ; Duplicates the current line
  C-[a SPC n] ESC w C-y
Repeat duplicating until it looks like enough:

  ; Duplicate again until happy
  C-[y y y...]

  ; Duplicate again until happy
  C-x z z z...
Duplicate 3 lines instead of 1:

  ; Duplicate this line and the next two
  C-[a u] 3 C-[k y y]
Duplicate 10 times:

  ; Duplicate the current line 10 times
  C-[a k k] C-x ( C-y C-x ) C-u 10 C-x e

  ; Duplicate the current line 10 times
  C-[a SPC n w] C-x ( C-y C-x ) C-u 10 C-x e

  ; Duplicate the current line 10 times
  S-C-backspace C-x ( C-y C-x ) C-u 10 C-x e
Remove duplicate lines instead:

  ; Select region, then
  M-x delete-duplicate-lines


Thank you very much!


A huge part of why I've come to like it is because I use the Doom configuration that comes with sane and very usable defaults out of the box. A Vim user can hit the ground running with it.

I don't think I could've persisted long enough had I tried using a vanilla GNU Emacs.


I hit a wall, then hit the ground, then got up but now I seem to be hobbling along fine enough with my attempt to use Doom. It’s just that there’s no simple intro to the emacs paradigm so I find myself almost constantly confused when something doesn’t go as expected. It’s been... a month or two now? I do like the spacebar leader key though.


> Not good for editing, not good for copying or moving code, not good for navigating, not good for working with brackets or parenthesis

Hmm. OK, I wonder why. For me M-h selects a a paragraph. Repeated M-h selects further. M-w copies it. S-M-{ or S-M-} to jump by paras.

M-s . for symbol lookup. In that family you can do highlight regexp or line.

M-s o - get an overview of every line that matches what you want ('occurs')

etc. etc.

Macros, registers (using these to store large chunks of text, basically class templates). etc.


Thank you. I would love nothing more that to be proven wrong! Some common things that I do in VIM:

  * Copy or cut everything between these quotes / parenthesis / brackets.
  * Delete up until the next X character. Now delete up until the next X character again.
  * Cut these rows then paste them over there.
  * Change all instances of "foo" to "bar".
  * Show all lines with (or without) "foo".
  * Reformat a line like so, now do it to the 351 line following it.
  * Reindent this section of text.
  * Go to the beginning of this if() / method / loop.
  * Go the the file where this Python / PHP class is defined.
  * In markdown files, open this hyperlink
  * Search for the first occurrence of this token in this method.
  * Search for the next occurrence of this word (actually learned to do this today, for the most part)
These were just example off the top of my head in a few seconds, none of which had an easy answer in Emacs. Sure, I could spend ten minutes each to look for how to do each one. I probably did that during the Clinton administration with VIM, before one could just google their problems away. But in VIM, each one has an easy answer and most are actually built right into VIM with no customization necessary. In Emacs, I could implement that stuff but then I'll be implementing everything else I need.

So I use Evil!


Hmm. This is tricky and I'm not sure I completely get your requirements, but let me try. Other emacs dudes will need to step in. In the following no customisation needed as I don't use elisp.

  Copy or cut everything between these quotes / parenthesis / brackets.
Don't know. Never needed to. Trivial with a macro

  Delete up until the next X character. Now delete up until the next X character again.
Never used it but https://www.gnu.org/software/emacs/manual/html_node/emacs/Ot... M-z char - Kill through the next occurrence of char (zap-to-char).

  Cut these rows then paste them over there.
Well, select rows, kill, move to new place, yank. Not sure what else you want.

  Change all instances of "foo" to "bar".
M-S-% - query replace (and variations such as regexp)

  Show all lines with (or without) "foo".
Erm can only do with, but as in original post, M-s o (occurs)

  Reformat a line like so, now do it to the 351 line following it.
Not sure your requirements but command align-regexp works for me. Don't know what else you want.

  Reindent this section of text.
Depends on mode, but select text then TAB key.

  Go to the beginning of this if() / method / loop.
Don't know. Perhaps Search reverse for { char?

  Go the the file where this Python / PHP class is defined.
Mode specific. I'd be pretty sure that kind of functionality doesn't come built into vim. I use Omnisharp which does similar but it's an external package.

  In markdown files, open this hyperlink
mode specific. Presumably also in Vim?

  Search for the first occurrence of this token in this method.
Just search forward. That may not be quite what you want, maybe.

  Search for the next occurrence of this word (actually learned to do this today, for the most part)
M-s . when on symbol. Subsequently C-s search forward, C-r searches reverse (backward).

But I'm not trying to change your mind, use what suits best.

Edit: M-S h is highlight-regexp which highlights all matches in the buffer in colour (does depend one some mode stuff, but works in most modes).


  > But I'm not trying to change your mind, use what suits best.
Quite the opposite, I very much appreciate the engagement. You have likely saved me a few hours as I do intend to learn how to use Emacs properly.

Some of the things I see that I was not clear about, but I do not need to belabour and now I've got some great headstarts on the rest. You are correct, some of the functionality mentioned are in fact provided in VIM via plugins.

Thank you.


That's a lovely reply! The problem with emacs is there is just too much, and the chaff obscures the wheat. It frustrates me too, as there's some really good stuff there that I don't know about.

Suggest grabbing the emacs book https://www.oreilly.com/library/view/learning-gnu-emacs/0596... and/or the emacs manual from https://www.gnu.org/software/emacs/manual/ (free pdf) and go through them. They will repay the time!

Good luck and remember any pro emacs user will trip themselves up to help newbies learn!


Thanks for the book suggestions. Emacs is a way of life!

  > Good luck and remember any pro emacs user will trip
  > themselves up to help newbies learn!
I've noticed this. The Emacs community is one of the most welcoming tech communities that I've seen, and have helped accelerate my learning curve tremendously. Thank you.


A couple more - look at C-x 3 (split screen vertically) the issue command follow-mode. You can have several vertical views next to each other, all shiowiing a contiguous view of your code - very nice! a bit flaky sometimes but incredibly useful.

C-x 2 - split window horizontally - bloody useful.

Get used to macros if you haven't already.

Issue part of a command then ? for help eg. M-s ? gives you a family of stuff inc the aforementioned occurs command.

Look up registers. Dead handy. Also look at (IIRC) Bookmark+ (?) which allows you to save your desktop config then reloads it next time you start up.


Thank you! Almost everything that you mention look very useful for my use cases. In fact, my monitor sits in portrait mode, so I do use horizontal splits in other programs as well.


I was a knowledgeable emacs user and felt the same thing when I finally started using vi. Emacs is like carrying around a foreign OS to do text editing. Vi is a tool that has been designed to blend into the system.


Vi is the editor of the Unix programming environment (among other things the shell). Emacs is a shell, that introduces a different kind of programming environment. The OS is still Unix, it's wrong to say that it is it's own thing, but you relate to it differently, but neither is inherintly "better" fit for *nix in the abstract, it's just that the shell is more popular since it was historicall the default UI.


That's probably the best succinct summary of the differences I've seen. You've definitely got a better mental model of Emacs than I did when I first started using it. Welcome to the Emacs party! I hope you like it here. :)

I like thinking of Emacs as a running Lisp REPL that fires off different functions depending on what key I press. If you haven't seen this already yet, run `C-h k` (describe-key) which will tell you the Emacs Lisp function behind a particular keystroke. You can then call that function directly with `M-: (emacs-function-here) RET`.


I got really far in reading the comments in response to this before I realized Doom Emacs wasn't an implementation of the video game in emacs lisp.


Haha!

In think they called it that way because you do use the space key very often. Much like in the game.


This.

Exactly what I thought when I switched from Vim to Emacs a few days ago. They are not comparable, I was mind blown when discovering Emacs. Of course the first thing I installed was Evil, but they are two entirely different beasts indeed!

Enjoy your emacs journey mate ;)


You too! I already see myself sticking with it. Not that I'd delete my .vimrc though. That is still the preferred choice to just 'quickly edit this file here'.


> Emacs is a computing environment that happens to revolve around text.

And it’s usually embedded in another computing environment that happens to revolve around text called UNIX. If only the scripting language of the latter was as elegant as Lisp...


I've always found Vimscript (and Elisp, for that matter) to be an extremely unpleasant language to do anything in - which makes this all the more impressive. Like building a house out of toothpicks and wasabi.


nice try


Soon on StackOverflow: How to exit Mario on Vim? For anyone unfamiliar: https://stackoverflow.blog/2017/05/23/stack-overflow-helping...


Next, the people who train ML models to play Mario will attempt to generalize their approach to train their models to exit vim.

"I'm sorry Mario, but the princess is in another buffer that has been edited since last write (add ! to override)."


Hilarious !


The same author appears to have also implemented Puyo Puyo in Vim, and it looks a bit more sophisticated.

https://github.com/rbtnn/vim-puyo

Very cool.


The art looks a bit like Mario on Atari 2600.

https://www.youtube.com/watch?v=o5igUFICNB0&feature=emb_titl...


With all this talk about Nintendo and their ruthless lawyers, how does something like the PokeAPI stay up?


Here I am avoiding Vim like a plague and using nano, people write Mario in it. Amazing stuff.


https://vim-adventures.com/

This helped me pick up the basics. Vim isn’t that scary, really. It’s very possible to learn 90% of the editor in a few months.

Fwiw, what really made me learn Vim properly was doing a project (not a work project) solely in Vim, from start to finish (with multiple languages involved).

If you’re editing text regularly, Vim (or indeed Emacs) will be much nicer use than nano.


I don't really think playing a game with hjkl for movement is necessarily all that helpful. Moving around in a more conventional editor can often be done by relying on key repeat and holding down cursors. I still sometimes do that even in vim if feeling lazy. hjkl are far better learnt individually in the same manner as any other keystroke. And most movement is done with keystrokes targeted to get where I want to go quickly.


Yeah, just use vimtutor!!


Emacs has malyon-mode to play IF games.


Now give us chess in Vim.


How to I shoot a fireball?


To be fair, the original Mario Bros. [0] didn't have fireballs either. You're probably thinking of Super Mario Bros.[1] which introduced a ridiculous number of new features and concepts.

[0] https://en.wikipedia.org/wiki/Mario_Bros. [1] https://en.wikipedia.org/wiki/Super_Mario_Bros.


It's-a Vim, Mario!


C&D from Nintendo in 3... 2... 1...


For anyone who doesn’t know, Nintendo last year (or the year before) sent a C&D to a really cool fan made Mario Battle Royale game. Then this year they released a game in a similar vein this year. While it’s their right, Nintendo has a history of being EXTREMELY litigious and hostile to their fan-base, almost Disney-like. And yet, in spite of that they’re probably still the video game company with the greatest customer goodwill, mainly based on the Mario, Zelda and Pokemon series, if I had to guess (although technically Pokemon is a joint venture between Nintendo and a few other companies).


I was a Nintendo fanboy during the Iwata era. IIRC he owned a majority of their stock, so pleasing investors meant pleasing him. And that seemed to involve very cautiously dipping their toes in micro-transactions (eg. Rusty’s Real Deal Baseball), and maybe generally being fairly customer friendly in a few other areas.



exiting vim with just q is heresy!


I tend to exit with :x but if I open a file and make changes but decide not to save I don’t think there’s another option than :q!


ZQ? Works in vis.


This is awesome though Nintendo loves to sue people and this is on github...


Nintendo lawyers incoming. People never learn


> Nintendo lawyers incoming. People never learn

The last commit is from 6 years ago so, it has been up for 6 years, why do you think Nintendo will suddenly take action now?


The minute Nintendo finds out about something, they act aggressively. They fiercely defend their IP.

Compare that to Sega, which loves and almost endorses fan content. Look at the Sonic fandom for instance. They have their own original content, games, music, etc.

Nintendo crushes use of their IP.


Nintendo is strange about it, though. They usually only C&D projects bring their IP to other platforms (discounting emulation for a bit since emulation doesn’t directly infringe). They have allowed numerous ROM hacks to exist completely unimpeded. If Mario Royale had been a combination ROM hack and LUA script/custom emulator, it’d probably still be around. I’m honestly surprised I haven’t heard much about them going after the SM64 ports.


What about the Ocarina of Time rom hack, "Missing Link" [1,2]? That added entirely new worlds and dungeons, but was a rom hack. You could supposedly play it on real Nintendo 64 Disk Drive hardware.

Nintendo shut that down.

(I've been trying to find a copy...)

[1] https://youtu.be/dNmlYJ5bpl8

[2] https://youtu.be/n6hdlxgDixE


I’d chalk that up to getting fairly mainstream press. Like I said, I’m surprised they haven’t gone after the SM64 ports as well.

Also, I think “Dawn & Dusk” was the hack that was ported to 64DD, not Missing Link.


The SM64 ports were reverse engineered. I'd be curious what grounds Nintendo had to stop them.


It probably helps that, like with several authorized source ports, a separately-acquired copy of the original game assets are required. I’d imagine some of the enhanced ports (that provide upgraded models and textures) would be more legally shaky, and there must be some other good reason why they wouldn’t go after them.


I find it amusing to imagine Nintendo trying to shut down this game. Like I get that legally they have the right to protect their IP, but realistically, what are they worried about? That this game is a threat to sales of their actual game? Or that people would think this is a legitimate Mario game and get a bad impression of Mario and never buy any of their other games? Both scenarios seem hilarious.


One of those 2 companies is one of the most successful and profitable companies in Japan. The other is almost always on the verge of bankruptcy.


Well, because it's now at the top of hacker news?


Let them come. Asshole companies shouldn't discourage people from building cool things. Until the C&D arrives, the author ought to express themselves in defiance of Nintendo.



Lol what a funny joke. It's really hard to exit vim, guys! Heh, I've never heard that one


It was intended to be a pun on the addictiveness of gaming, but point taken.


No worries. If it helps I thought it was funny <3


What's the point of something like this, which is a very poor imitation of Mario, being labeled as "Mario in Vim"? Just marketability? If you used non-IP infringing assets, maybe no one would pay any attention to a link like this: "2D sidescroller implemented in Vim"?

I'd just like to see the merit of something like this judged based not on nostalgia or fandom, but on its own individual novelty. You'd also sidestep all the people being downvoted for calling out IP infringement.


> What's the point of something like this

What's the point of anything? Someone made something and wanted to share it.

Just let people enjoy making nonsense. The whole reason almost everyone on this site even got into coding was because of the excitement of making something of your own.


I agree with you and disagree with the downvotes you're getting. If this wasn't "Mario" it wouldn't likely get attention which arguably means all the attention is piggybacking off if Nintendo's famous ip and not anything having to do with putting it in VIM. If making a platformer in VIM was the interesting part then it should be interested with or without Mario.

I see this same or similar issues with almost all copied IP. The author could have and arguably should have made something original. I find it so sad to see a fan spend 10,50,100,1000 hours making something with IP that doesn't belong to them so it can be taken away/banned/taken down when instead they could have made their own characters and it would be 100% theirs. It just seems like such a waste and a tragedy. The only exception would be if the work was a commentary or parody of the original IP but 99% of the time that's not the case.


Have you never built something for fun in your spare time? The author just likes mario, they're not trying to sell you a product. You're reading far too much in to this.

The interesting creative output here was making a platformer work in vim, if they wanted to design their own original game as well they probably would have used a more traditional development platform.


I bet you're fun at parties...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: