Ask HN: Coding on Your Phone?

25 points by noobermin ↗ HN
What are your solutions, if any, for editing code on your phone? I often have an idea on public transit that I usually have to jot done in a note but it would be useful to have a solution to edit code on the fly. I personally don't always use github/gitlab or other online repos, but tools using online repos suggestions are welcome.

38 comments

[ 3.0 ms ] story [ 73.5 ms ] thread
Write on a pen and paper, or tablet. If neither of those are available, type a quick note or record a voice memo
It looks as if https://tryapl.org/ might have put some effort into being mobile-useful. (the terse symbology was once valuable at 110 baud, and could be again if one has to use an onscreen keyboard)
I code in Vim on desktop, so that also runs fine on my phone (I use an app called Linux Deploy, but probably Termux or similar are more native solutions for the same, or perhaps there's a specific Vim app also). SwiftKey lets you select a keyboard with lots of symbols on the keys, so making < or { or | is just one long press. It's still slow and cumbersome, but it's possible and I do it when on the move and there's a small script to write

Not sure how your remark of not using hosted git ties into a solution for coding on your phone. You mean using a web IDE? I guess that'd be possible also but then you need constant connectivity

I actually assumed most replies would involve web solutions. I added the line to not preclude them in case others would find them useful even though I wouldn't use them myself (at least as a first option).
I can only code on phones/tablets/phablets with a small bluetooth keyboard. I have bad dexterity so I can't use the touchscreen keyboard very well, and no matter how much I convince myself I'll get better at using a touchscreen keyboard, I still end up fat fingering keys and making loads of typos and mistakes.
Slightly related, but one of my favorite personal achievements in high school was replicating the first year's final exam C++ project on a TI-89's Basic interpreter. Spent hours ignoring lessons in other classes while I perfected it before showing it off to my teacher. If I recall correctly, it had assembly as well, which is how Tetris and SMB clones and Phoenix, the Doom clones,... And OS shells were coded. Good times. This was over 20 years ago and that interpreter was slooooow, but functional. Assembly could do 8 shades of gray and 60 fps.

Well,.then hormones and ADD took over and I can't still can't code worth crap. but I do like reading about it on HN, so thanks.

I mean, what are you trying to write? On IOS, Pythonista is a full fledged environment for writing programs. I imagine there's similar on Android.
Vim and tmux on the server, and juicessh with hacker's keyboard on the phone. It's still not easy, there's not much real estate. But for small edits it's adequate.
I'll add another +1 for Termux on an android phone. I have a hub that lets me charge my phone and plug a real keyboard into my android device.

It (termux) is mildly annoying as you don't get to set your own username and you can't ssh into your phone (or maybe you can if you're on a rooted device.)

Also, there's no sixel support, so it's somewhat limited as a remote management platform.

But I've successfully scp'd remote files to local, then used emacs to modify the files and then scp them back. Git works fine, so you can clone, branch, commit and push if that's your workflow. Make and gcc all work fine, so you can compile other tools (prolog, scheme, node) if you need them.

Sbcl should work, but I ran into problems compiling I haven't yet resolved (not sure it isn't related to me monkeying around with local library links) so ymmv.

I know python is available via the package system, but I'm not a python person.

It IS definitely a terminal oriented experience. If you're looking for something like VSCode, this ain't it.

Carry a small laptop. Phone keyboards are atrocious enough for basic english text, let alone code.
Nah I don’t think would ever be a good idea. To learn yes but not to actually code. Sorry.
Emacs Android native build

However, it's not clear to me how to access a compiler or interpretor other than the Emacs Lisp interpretor. Termux won't install for some reason on my phone.

In theory all you need is a keyboard and a screen, the other hardware is whatever shape works, right? Coding "on the phone" sounds like a "veritable nightmare" if I'm using the stock screen and "keyboard" solution that is half the visible field. VSCode + SSH lets me code on the cloud box, whatever combination of unlocking/jailbreaking/hardware purchasing gets you that, is a solid way to go.
That's the beauty of it. I tried also dosbox on a phone. The keyboard was obscuring half the screen. For me, it was enough.

P.S. There are some BASIC ports for Android. Tiny fonts, barely readdable. Saving files in Android is like memory addressing on x86: interesting. /s

One of my top go-tos is Juno for iOS or Termux for Android
[dead]
MarkGit allows you to run JavaScript and Python code locally on your smartphone, as well as execute and get the results of various more programming languages via a remote server.
In general, Vim on an iPhone (via iSH, a-Shell, or iVim) works surprisingly well. I thought the idea was ridiculous until I gave it a proper try (even though I was already a Vim user on “real” computers), since it doesn’t really leverage the touch interface for e.g. cursor movement and scrolling.

However, Vim’s design gives you maximum expressive power per key you press - and since pressing each key on an iOS keyboard is a bit inconvenient, this design philosophy ends up working really well on a soft keyboard. Moreover, most common actions can be done without special keys (i.e. arrow keys, ctrl/meta modifiers, etc.) which I usually find awkward to use on augmented mobile keyboards. With Vim, you can get quite far using just a standard iOS with an added Esc key (all of the apps I mentioned above adds an Esc key).

If you use Vim on desktop/laptop but haven’t tried it on iOS, I’d recommend giving it an hour of trial sometime, at least if you sometimes want to edit code on the go. (Personally, I rarely do that, but I like that I can.)

I'm more on the fence of "mobile UX sux so rather just don't".

But did want to note, the AR/VR glasses space seems to be progressing[0], so perhaps with the correct peripherals for typing it might be possible to code in VR in transit in the not-too-distant future.

[0]https://www.xreal.com/air2

I edit markdown on the go for quick website updates and even that is painful. I usually finish things up and commit once I get on a computer. The files are synced with Syncthing.

It's hard to move the cursor, hard to select text, hard to input special characters, hard to manipulate files, and so on.

Instead I use that time to annotate content with my Apple Pencil on my iPad. It feels like correcting paper documents, and keeps me more focused because I can't edit anything.

Gitpod is fine for that, if you have a big enough screen on your phone. An external keyboard would also help in any mobile scenario.
(Fdroid) Termux + helix editor + lsp and compiler of choice + customized termux keys for best dx

The experience was surprisingly decent. I'm quite new to coding and this was the most "batteries included and works out of the box" solution I could wrap my head around, didn't try to scam me into paying for a subpar experience and wasn't online.

My laptop died from humidity a few years ago and I had to get some work done so I installed Termux, zsh, tmux, vim, postgres, node and Ruby on my phone. Worked really well! I would recommend an external keyboard though.
If you have an idea on public transit, how about pen and paper to write down the idea?
(comment deleted)