Hacker News new | past | comments | ask | show | jobs | submit login
Vim ported to iOS (applidium.com)
288 points by stevelosh on Jan 19, 2012 | hide | past | favorite | 127 comments

Vim is for coding. How does this work out on the iPad?

Does one edit remote files locally, and compile/run remotely? (the benefit is the editing feels instant - no keystroke latency.)

Or has Apple let up on the "no coding for you!" iPad/iPhone terms? (I thought they would eventually, once their dev environment is firmly established - and they'll have to, if/when they adopt iOS on their {lap,/desk}tops - but maybe today is not yet that day. iOS devices sell macs as dev machines)

> Vim is for coding.

Yes, and a lot more. I use Vim for all my text editing.

I used vim to write my latest blog post. It would have been (and will be) awesome to do that on my iPad instead.

Vim is for coding. How does this work out on the iPad?

With a bluetooth keyboard and a charging dock or a stand, iPad is a great platform for Vim coding.

Does one edit remote files locally, and compile/run remotely? (the benefit is the editing feels instant - no keystroke latency.)

With Dropbox support this would be possible.

Or has Apple let up on the "no coding for you!" iPad/iPhone terms?

There is no such term. The term used to be that you cannot bundle a compiler with your app, but even that has been lifted recently with Lua interpreter embedded in many games.

> With a bluetooth keyboard and a charging dock or a stand, iPad is a great platform for Vim coding.

So, when your iPad is a laptop Vim is great!

My point is that with this and iSSH, iPad + a keyboard could be a serious alternative to a traditional laptop for many types of programming tasks.

Can even connect to an Amazon instance or similar. There was a submission a while back about someone who did this for a month (IIRC), but the editor was on the remote machine.

Any free alternatives to iSSH? I don't feel like paying 10$ just to try it out.

This isn't free, but it is a bit cheaper in my opinion it's miles better, http://www.panic.com/blog/2011/04/introducing-prompt-ssh-for...

If I remember correctly, iSSH hasn't been updated for quite some time now. Though I might be wrong.

An upcoming version, that fixes font rendering problems, is mentioned here:


This made the rounds somewhere a while back, but I didn't see a link to a discussion on HN when I searched


That's it, thanks. The HN discussion: http://news.ycombinator.com/item?id=3186476 (submitting it takes you to its previous submission)

Interesting that they actually exit on ":q", which is prohibited by the iOS Human Interface Guidelines: http://developer.apple.com/library/ios/#documentation/UserEx...

Also, ":Explore" and then "-", "-", "-"... works to browse the file system, or at least the parts allowed by the app sandbox

I think they're called "guidelines" for a reason, and nowhere in them is the word "prohibited" used.

Except that in the vast majority of cases, not following them really hurts your chances of getting into the App Store.

Try to find a few other apps on the App Store that you can exit from within the app, to get a sense of just how much of a "guideline" this really is.

I can see two likely scenarios why this got passed:

1. The reviewer has never used vim. As someone unfamiliar with vim, it never occurred to them to type :q, and thus they never saw that behavior.

2. The reviewer has used vim before, and knows how it works. With that familiarity, the reviewer understood that :q quitting the app was the behavior that users would expect.

This may be the one-in-a-million chance to disregard that guideline. A big rule in interface design is to do what users expect. In Vi/Vim, this means quitting on :q. Assuming that this is non-standard enough that Apple would go find somebody who knows Vim to handle the review, that person would (and obviously did) know this.

How many apps need an exit button? Just because you look around the App Store and don't see a bunch of apps with exit buttons doesn't mean it's because they aren't allowed. It never even crossed my mind to put an exit button in my apps because it's not a use case for my apps. I'm sure it's the same with a majority of the other apps.

Waze has a "Switch Off" command, although that seems to make sense since it's a way to stop running GPS.

Maybe they got a pass since ":q" is a basic Vim command. People are going to type it - what should they do instead? Nothing?

Especially as the guideline is clearly there so as not to give users the misleading impression that the app's crashed. That's obviously not the case when a vim user is using the expected command to close the program.

Guidelines here mean the "vims" ( see what I did there ) and fancies of Apple.

Shakes head

Emacs a mountain of a mole-hill, that one.

... and the one feature they don't list: iCloud .vimrc sync!

Hi. Indeed, iCloud syncing will be awesome. I did not add it to this release yet though. If anyone wants to contribute, patches are welcome!

No kidding? If I just edit $HOME/.vimrc, it will start syncing? Or do I need to do something special?

If it can sync .vimrc, could it also sync a directory over iCloud? That would be amazing. I'm a die-hard Emacs user, but this would be enough for me to use Vim for at least some work.

I've been wanting vim support on the iPhone for a while.

I actually think it's a big thing that would work well on the iPhone. The whole point of vim is that, with only a few keys, you can navigate anywhere you want extremely quickly. Most of the limitations of the iPhone are things like "can't see many keys at once", and "hard to go to specific lines by dragging your finger around the screen", etc. Vim on the iPhone can fix all that.

Haven't seen this app though, off to play with it. Hope they did a good job :)

What's the biggest advantage over SSHing to your server? Is the interface optimized?

I mean, you're almost never offline these days, so local storage can't be it, right?

I suggest mapping 'jj' to ESC rather than '\'

Small tip - I use "jk" instead of "jj" for ESC.

I always thought the difference was personal preference, but there is actually 1 good reason to use "jk". If you get used to pressing "jk" all the time, you'll probably end up using it in Normal mode as well as insert mode. "jj" will move up 2 rows in Normal mode, while "jk" doesn't do anything. Therefore you can use "jk" as a reflex every time you get to the keyboard, and it won't screw you up.

ctrl-c, to avoid any of that stuff. 'jk' will move you one row down, and one row up.

Yes, except ctrl-c moves you off home row, which I wanted to avoid.

Also, technically, ctrl-c is not the same as escape - it also sends a cancel signal. I actually have no idea what the practical difference is, I just know that some commands treat it differently.

It doesn't check for abbreviations and doesn't trigger InsertLeave, which essentially means that any pending command is aborted, but you're totally right about not leaving the home row.

I just right now remapped caps-lock to control and use CTRL-[ to escape instead.

There's no "ctrl" key on the iOS keyboard, though.

Latency. And for those who aren't 'almost always online.'

Even if you're online, the connection may have much more latency than you want to deal with. Depending on what you're doing a split second of latency can mean a lot.

Unfortunately, imap jj <Esc> in the .vimrc doesn't seem to work. :(

I did `:imap al <Esc>`. So then you can simultaneously press A and L to leave insert mode. Very easy on the iPad.

Oh, that's super smart! I might consider adding this as the default in the next release. Thanks!!!

Nice work. It would be nice to add a few extra keys like you were suggesting like "tab", "ctrl" and "escape". Maybe slide them down from the top when you swipe the edges.

Another comment, this looks great for editing a fresh file on the run, but it would be nice to ssh into a server with existing files.

Great effort!

I'm confused, how does one use the esc key without a keyboard?

As explained on the splashscreen, they've remapped that to backslash. I suspect it'd be much more useful with a BT keyboard - lack of ctrl and tab for a start.

The font is pretty ugly too - I can't easily tell the difference between q and g.

However, it is a neat hack, if not very usable.

This commit [1] seems to indicate that it's possible to change the font.

However, I can't actually figure out a way to do so; ":set guifont" doesn't appear to work.

[1]: https://github.com/applidium/Vim/commit/be572d759e857de58453...

Hi :-) I added font support pretty much at the last minute. Here's an example of something that should work ":set guifont=Courier:h14"

It doesn't seem retina optimized. The font is horrendous on my iPhone 4.

Actually it is (or it should be. Just file a bug if it doesn't work for you). By default anti-aliasing is disabled, but you can toggle it on.

They remapped backslash to esc. Kind of a pain since you have to go through 2 keyboards to get to it, but it works.

How are you supposed to code without backslashes? Are they anticipating never needing to escape anything?

How exactly would going through 2 keyboards to switch modes work in a practical situation?

That's why you'd edit .vimrc to rebind the functionality provided by escape to 'jj' or 'jk' or something of the nature.

The correct way to do it is to attach a toolbar to the top of the keyboard that contains any special keys or commands that one needs, such as "Esc".

This would be awesome for vim. Not just for the escape key, but also for other often used keys. I love the virtual keyboard in Codea for example.

How about file management? Anyone know how files are stored/accessed?

Dropbox support would be nice. Its the only reasonable semi-'filesystem' option

Looks like you need to send them across through iTunes.

It can only edit files in $HOME, it says.


:e /etc/passwd

It's read only, but still, omgwtf.

You can also poke around the file system with a combination of :cd and :Explore

:dir doesn't seem to work.

This could be because :dir is not a vim command.

I'll check this out app out. I've tried using the touch screen keyboard on an ipad thru ssh and using vim. it was unbearable, to say the least.

i ended up getting an asus transformer prime that has a keyboard dock and the keys can be rebound to your like (esc, ctrl, etc) and it's the closest to the "real thing" experience i have found on a tablet

Yet another emacs/vim article, and I always look for an excuse to get excited but never can.

It seems that the speed at which I think/code is much slower than the speed at which I type. So I can't imagine that I would benefit from skills in emacs/vim-fu.

Is this preconception valid, or can anyone debunk?

VIM is not only about typing. It's about editing, which involves making a small change in one place, then navigating somewhere else, and making another different small change etc. This is where VIM is unbeatable, because of ridiculously many fast ways to navigate and edit intelligently (in a very small amount of keystrokes). You don't have to type 120 WPM do be faster in VIM, but if you are a fast touch typist, you can get insanely fast in VIM.

Besides once you can edit faster, it's surprising how your "speed of thinking" also improves dramatically :D.

Agreed. Navigation through a file without using the mouse or arrow keys greatly speeds up misc. edits in a large tree of files.

Other upsides are the ability to delete text without the backspace or delete key, and to perform more complicated operations on a file, such as full regex search-and-replace, macros, and so on.

Really what it boils down to is a powerful text editor that lets you keep your hands on the keyboard at all times- which of course is not appropriate for all tasks, but very useful for many.

This is a huge deal, and you've done a great job expressing it. I definitely find that I think faster as a result of being a vim user / being in vim. Since most of the actual editing gets thrown to muscle memory, all I have to do is think 'gosh it'd be nice if that refactoring happened' and it does, while I'm on to thinking through the next step.

I'm constantly mortified at how rarely my co-workers/employees use vim macros. I make vim do the hard parts for me.

It's not so much about the speed at which you think as about how quickly you can execute the changes once you've thought of them. I find it discouraging to have to fight my editor once I've thought of the change I want to make. Also debugging speed counts too. I find there are a number of "oh I should tweak that changes" which don't really require much thought.

This is a circular argument (or some sort of thing like that), but if you ever find yourself at a *nix command line prompt and need to edit a file, you can be certain that vim will be available. Basic familiarity with it can be helpful.

Personally, I used to write a ton of perl inside Vim as a student, but these days I'm in VS all the time, and only use Vim like I would use Notepad - when I want to do quick edits in a file that isn't worth the heavy handed-ness that is starting my IDE.

I'm like you - I spend more time thinking about my problems, and typing them isn't usually a hindrance. If I find that my typing/keyboard navigation speed is holding me back, it's a sign that I designed myself into a corner where I have to write a ton of boilerplate/repetitive code.

> but if you ever find yourself at a nix command line prompt and need to edit a file, you can be certain that vim will be available. Basic familiarity with it can be helpful.

True, but I've been getting by for the last 20 years with little more than 'i', 'x' and ':wq' (or ':q!') for changing system settings. The point of mastering vim as an efficient code editor is far beyond what you need to get your nix settings sorted.

If you're willing to spend $99, viemu is a wonderful vim emulator for Visual Studio.

For a little more you can get it for SSMS, too. What's really fun is highlighting stuff with visual mode and just hitting F5. Need to run a subquery? Get the cursor somewhere in there and vi( F5. And macros sure help with repetitive sql constructs.

What port of Vim do you use under Windows ?

At my work we get Vim for free with your dev enlistment. It's 7.3.46, and the version that works inside cmd.exe.

Once you get used to a good editor (Vim or, for me, Emacs) you don't have to think about how to edit a file, even you're doing something relatively complicated: it becomes a natural, almost instinctive action. This not only increases the speed you enter text or navigate, but also reduces the friction when actually entering your thoughts into the computer.

The less time you spend typing, or thinking about typing, the more time you have to think about coding.

Wow, the only thing missing now is Git / Github.

Definitely. Unfortunately Git is GPL, and given the trouble we went through with VLC we decided not to work on that feature. It's definitely sad though.

Would libgit2 improve this situation for you? It comes with a linking exception which should keep you on the safe side.

Sadly, most of the network stuff is not or only partially implemented yet, such as clone and push. They have an example for 'fetch', though.

Oh, I wasn't aware of this. Actually yes, it might :-) Thanks for the pointer!

Apple don't allow any GPL software on iOS.

Other way around - the app store does not allow distributing the source along with the app. So, strictly speaking, publishing GPL software in the App Store is in violation of the GPL.

If you - as a rights holder - are okay with having the source downloadable at another location, you can definitely publish GPL software using the App Store. Case in point: Battle for Wesnoth.

You do not have to distribute the source code of a GPL application with the binary. You merely have to make it available. For example, I have an Ubuntu Linux install CD with lots of GPL binaries and no source. It's perfectly legal for that binary-only CD to be distributed.

AFAIR from the VLC case, software distributed on the AppStore has extra restrictions on the user (You can only use it for personal reasons, you can only install (use?) it on 5 (or so) machines, etc.) GPL software cannot be distributed under these extra clauses.

If you are the sole programmer & copyright holder, then you are free to relicence/release your work under some other licence that is OK with these.

However if you are incorporating other GPL software (like in the VLC case) then you do not hold the copyright on that software, so the person who does have copyright on it is letting you distribute the software so long as you agree to certain terms. You cannot distribute someone else's GPL software on the Apple App Store because you would not be meeting the GPL requirements of "do not place any other restrictions on the software".

I delibrately phrased it as "Apple doesn't allow GPL" because this is not a technical problem, but a legal/contractual/business problem. Apple could choose to allow GPL. They do not. Microsoft, who called the GPL cancer, allow GPL Apps on Windows.

Okay, thanks for the detailed explanation and the reasoning behind that sentence. Yes, Apple did not take any special action to support GPL in the app store.

Personally, I find it surprising that Apple, which leveraged open source to a huge effect and took stewardship of some high-profile OS projects (webkit, llvm/clang, CUPS), but allows other companies to position themselves as "open source friendly" alternatives. Especially as one of those companies is Microsoft.

Apple did not take any special action to support GPL in the app store.

You do not need to take any special action with any operating system to get it to support the GPL. What Apple have done is done special action (lots of EULA/contracts/etc.) that explicitly disallow the GPL.

The reason (I think) Apple are explicitly disallowing the GPL is because it would be incompatible with the DRM type systems that Apple use. It's more a case of 'If Apple distribute GPL software on their App Store, they might have to give away the DRM keys and allow anyone to run any programme on their iPhone'. That situation is something Apple don't want.

GPL programmes are still allowed on OSX obviously, and I think some of Microsoft's mobile and/or app store thingie explicitly ban GPL as well.

Yes, you do (sometimes) have to take special action to support the GPL. For example, Ruby recently changed its license to allow the bundling of readline 6 with MRI. This was a distribution problem as well.

Show me the places where Apple EULA "explicitly" disallows the GPL (and not just includes things that are incompatible with the GPL). There certainly is GPLed Software in the app store, even with a notice included (see Battle of Wesnoth). If it was explicitly forbidden, that would not happen.

My interpretation is that Apple just doesn't care. The want Apple-signed code on their devices and if your license doesn't allow signed code, they won't help you. This by itself is sad and I would very much hope for that to be different, but not "explicitly disallowing".

I think MS were the ones that explicitly mentioned the GPL.

Apple do not explicitly mention it, however they have chosen to add extra restrictions to their licence, which goes above and beyond a normal "Download software from this web host". Explicit clauses that make the GPL incompatible are the same as "explicitly banning GPL apps".

The GPL is a massively popular licence, I believe Apple would have considered it. They appear to have rejected it.

You merely have to make it available.

Also, you don't have to make it available forever, I think the GPL says you only have to do it for 3 years. So you don't have to worry about someone in 50 years demanding some source code.

Does the App Store explicitly disallow bundling the source code inside the app? What if you added a .zip with the source into the app, and on app startup you copy the .zip out of the Application directory into the app's Document folder, which is accessible via iTunes (as long as you set the appropriate flag in the app descriptor plist to enable document sharing)

Bundling of source code with binaries is not required under the GPL. You can have it on your website. However the App Store EULA etc. are incompatible with the GPL (cf. http://news.ycombinator.com/item?id=3489115)

Interestingly, there seems to be an exception for open source licenses in http://www.apple.com/legal/itunes/appstore/dev/stdeula/ (I assume this is the relevant appstore eula); look at the end of:

"You may not copy (except as expressly permitted by this license and the Usage Rules), decompile, reverse engineer, disassemble, attempt to derive the source code of, modify, or create derivative works of the Licensed Application, any updates, or any part thereof (except as and only to the extent any foregoing restriction is prohibited by applicable law or to the extent as may be permitted by the licensing terms governing use of any open sourced components included with the Licensed Application)"

I assume this is what makes the LGPL okay to use? (LGPL explicitly requires allowing reverse engineering of the entire application, even the non-LGPL parts)

(I don't know much about iOS development, so will take your word that this is the standard licence that software on the AppStore goes to the customer under)

There are numerous parts of that licence that are incompatible with the GPL and other Free Software/Open Source licences:


This license does not allow You to use the Licensed Application on any iPod touch or iPhone that You do not own or control, and You may not distribute or make the Licensed Application available over a network where it could be used by multiple devices at the same time. You may not rent, lease, lend, sell, redistribute or sublicense the Licensed Application.

If $COMPANY (e.g. Canonical gives me a Linux kernel) gives me a piece of GPL software, I am allowed to install that on numerous devices, I am allowed to sell that software myself and keep all the money myself, I am allowed to install that software on my friend's computer. All of these actions are prohibited by that Apple Licence, and hence in order for Apple to give/sell me a GPL programme they would have to change that.

Apple have chosen to get around this situation by not giving me any GPL licenced software.

I don't think so. But as always, someone has to try and get it through app store review.

Awesome news! I was searching on Cydia the other day to see if there was a vim package available... but I'm definitely happy to see this.

There is, though. I don't understand... personally I've been using a combo of iSSH into my own iphone. ~/ is located at /private/var/mobile and there's no latency (you ARE connecting to localhost). Git and vim installed means that basically, you can be self sufficient from your iPad/iPhone, without even needing an additional workstation to SSH into. Hell, even Python and Ruby can be installed on the jailbroken iphone. It's basically a portable POSIX-compatible system, after you install all the necessary packages (network-cmds for ping, for example) you're all set.

FTR, that was one of the first things I ported in 2007: I cannot imagine having a device without a fully working distribution of vim.

"Unfortunately, without an escape key it’s not possible to leave insert mode. That’s why by default the backslash key (‘\’) is mapped to the ‘Esc’ key. You’re free to overwrite this setting by unmapping the backslash key."

from http://applidium.com/en/applications/vim/support/

You'd think this would be a great use for a custom gesture. Actually, having various gestures available as mappable objects would be pretty cool...

Definitely :-) Just add this as a feature request on GitHub. I was considering adding this, but I wasn't sure if other people would like it.

That's great for browsing but I can't picture coding in an editor where I need to stop and look for common command keys. At the moment vim is efficient because [esc]10dd or something but it's just not viable without a keyboard. For reviewing code or making quick edits however this could be incredible.

I wonder if it supports plugins.

    nnoremap jk <esc>

It's hard to believe there are people who regularly use vim and still use escape.

Why? It's quite convenient for my left-hand pinky on nearly every keyboard that I use, and I've picked up the habit of doing periodic `jk` movements as I'm examining some code. I tried the `jk` combination that some people recommend, but it doesn't work for me.

I've never used a keyboard where escape was convenient to press. I personally use inoremap so 'jk' only does something in insert mode, I hit jk repeatedly all the time in normal mode while I'm thinking.

Remapping caps lock to function as escape is pretty useful here.

I actually prefer kj myself, as it's a little faster to go from outside to inside fingers.

Shouldn't that be inoremap?

If you don't feel like downloading it, here's a web-based live demo --


As the docs say, if you want to leave insert-mode, you have to use the '\' key since there's no ESC.

I was always using "Prompt" to connect to an ssh server and then use vim there with an external keyboard. But that's a nice touch.

I've only got a WiFi iPad and I'm offline quite a bit, so this is cool.

I rather do like this. nothings beat a full-vim experience

Does anyone know what they keyboard skin/layout is on their splash page screenshots? Its definitely not stock.

I think you have to slide two fingers to opposite sides of the screen for they keyboard to split. (At least that is what was showed in the iOS 5 videos, I don't have an iPad)

Are you referring to the Split Keyboard available in iOS 5?

Does anyone know how this will go down after what happened with Applidium's attempt to port VLC?

IIRC, the decision to pull VLC from the App Store was made by one of the VLC developers.

Apple pulled it due to it being copyright infringement. The VLC author released their code under the GPL licence, and Apple do not distribute software on the AppStore in a way that meets the GPL, and hence they were in breech of the licence and could not distribute it.

VLC, unlike Vim, is GPL software, which Apple ddi not allow on the AppStore/iOS. So can't see the same thing happening here.

I cannot wait for the port of NativeClient

ahahahahahahahahaha. This is hilarious. The author of vi says:

"It was really hard to do because you've got to remember that I was trying to make it usable over a 300 baud modem. That's also the reason you have all these funny commands. It just barely worked to use a screen editor over a modem. It was just barely fast enough. A 1200 baud modem was an upgrade. 1200 baud now is pretty slow.

9600 baud is faster than you can read. 1200 baud is way slower. So the editor was optimized so that you could edit and feel productive when it was painting slower than you could think. Now that computers are so much faster than you can think, nobody understands this anymore.

The people doing Emacs were sitting in labs at MIT with what were essentially fibre-channel links to the host, in contemporary terms. They were working on a PDP-10, which was a huge machine by comparison, with infinitely fast screens.

So they could have funny commands with the screen shimmering and all that, and meanwhile, I'm sitting at home in sort of World War II surplus housing at Berkeley with a modem and a terminal that can just barely get the cursor off the bottom line.

It was a world that is now extinct. People don't know that vi was written for a world that doesn't exist anymore - unless you decide to get a satellite phone and use it to connect to the Net at 2400 baud, in which case you'll realize that the Net is not usable at 2400 baud. It used to be perfectly usable at 1200 baud. But these days you can't use the Web at 2400 baud because the ads are 24KB."

source: http://www.theregister.co.uk/2003/09/11/bill_joys_greatest_g...

In other words, the PRIMARY design constraint with VI was how long it took to update a screen. All these keyboard modes and so on are about getting as little over the wire as possible while still having a full screenful to look at locally.

Sure, this idiom actually is very useful on a locally-running vi too (not to mention vi over an ssh), the keyboard commands are a powerful way to interface with the text.

But the idea of porting this to a machine that 1) will run vi locally (not on the remote machine through an SSH session), and 2) has no keyboard

is so funny it hurts! Still, A for Effort.

vi != vim

I guess running a terminal locally causes some pain too?

no, not at all. In fact I administer my own computer with vi (meaning vim), from a local terminal instance.

But the fact remains that porting an app like that to a touchscreen device meant to hide systems administration (as iOS does) is getting so far BOTH from the history of vi AND its most prevalent current usage.

That doesn't mean it's not very cool. I just thought it would be interesting to reflect on the background.

I guess what some people say about a bluetooth keyboard...almost makes this somehow useful. Still, that keyboard is not always going to be there.

One could use Prompt and the vi/m or whatever server she chooses.

I imagine _intuitive_ navigation through the FILE SYSTEM will come shortly.

Does this make any sense without plugging an external keyboard?

It makes more sense than many other editors, since you get a ton of functionality without modifier keys thanks to the modal interface, but it's still way better with a bluetooth keyboard.

Even just syntax highlighting and being able to use split windows makes it very useful for things like code review or just browsing code on an iPad.

You don't need an external keyboard to type effectively on the iPad. It comes with practice.

My wrists went in a week. How on earth did you manage?

Just like with a standard keyboard you need to get yourself in a decent ergonomic position before doing prolonged iPad typing. The temptation is a lot stronger on the iPad to fudge a little on the positioning which can very quickly be disastrous.

Namely: 90 degree angle on the elbow joint while making sure you don't slant your wrists up to reach the keys.

So does RSI.


And no, it doesn't.

Pretty epic. Nothing more.

I think I'm crying.

Vim is an editor. What is there to edit in an ipad?

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