A few months ago, I detailed my process to set up a Pixelbook to encode. It was not easy neither simple nor direct, but in the end it worked: it had all the power and flexibility of Linux, access to my favorite code editor (Code VS) and, of course, the elegant web browsing experience that Chromebooks are. known by.
Around the same time, I tried to set up an iPad for coding. I failed miserably. I love using the iPad to write and other creative work. It's super portable, has a great battery life, an excellent screen, and limited multitasking keeps me focused. Unfortunately, it is very bad for complex tasks and intentionally paralyzed for software development.
But now I am older and wiser, and after all a Saturday of banging my head against the wall, I am pleased to report that I can use a $ 799 tablet to write software. Will I ever use it for this purpose? Maybe! But we will get to that.
Feel free to follow my steps if you also want to code on the iPad. I can not promise it's a worthwhile destination, but I learned a lot on my way there.
Chapter 1: the trip starts lowering my expectations
As everyone knows, Apple is dying of fear that someone can execute arbitrary code on one of their pristine iOS devices. It makes a bit of sense: the restrictions of iOS and the App Store are the reason why an iPad of years ago is much more responsive and error-free than a MacBook Pro of the same age.
But it makes software development almost impossible. It is ironic because the iPad is excellent for creators in many ways, such as drawing, design and music. Under the hood is the same Unix kernel that makes macOS excellent for programmers.
Anyway, you know all this.
And I was very excited to see that CodeSandbox has a Vim mode. Vim key combinations are my preferred way to navigate the text, and it's especially important on the iPad where you do not need a mouse to get help. Moving the cursor, highlighting text, deleting words or lines, moving lines and jumping large distances in a file, all require only a couple of keystrokes in Vim. Contrast that with the iPad alternative: seconds spent poking at the screen with your clumsy finger, hoping that iOS discerns your intention.
Basically, everything was fine. CodeSandbox was all I needed, and my iPad was suddenly an ultra-useful webdev box, at least to build the kind of little experiments I gravitate towards.
Except there was a problem: the iPad does not have an Escape key.
Chapter 2: How does the despair feel?
See, in Vim, there are different "modes". There is the default mode in which you use the keyboard to navigate through your document. There is the selection mode, where you use those same navigation keys to select text. And, what is more important, there is an insert mode, where you use your keyboard to type. Since you need to exit the insert mode to move the cursor again, you need some type of command to exit the insert mode. By default, that command is connected to the Escape key.
Many Vim users (like me, for example) map a combination of deluxe keys like "jj" to make insertion mode easier, but CodeSandbox is not really Vim. It simply emulates some of Vim's default key combinations. Then I need an escape key. And the iPad does not even know what that means.
I'm serious! At first, I thought this was just a problem with Apple's own smart keyboard cover, which has no function row or escape key. So I took out a normal Bluetooth keyboard and connected it to the iPad. I got stuck on the Escape key and … nothing. In the world of iOS, there is no escape.
I searched the StackExchange and several GitHub problems in a state of desperation. Yes, there are ways to emulate an Escape key with "Ctrl + [," but that does not give me anything in this case. I'm stuck in insert mode for the rest of my life.
CodeSandbox, you brought me so close!
In fact, based on the rapid iteration of CodeSandbox, I would not be surprised if they solved this problem in the near future.
But in the meantime: what should a child do?
Chapter 3: Well, let's test the cloud again
The first time I tried to configure an iPad for coding, I went straight to the cloud. But the cloud is not a magical place where all your dreams come true. Setting up a devbox in Digital Ocean or Google Cloud requires some knowledge of Linux and SSH, and there is no graphical user interface GUI to fall back on when your command line skills fail.
Why was this so difficult before?
Strangely, the remnants of the scattered knowledge of my last attempt to configure a devbox cloud were all I needed to make everything work quickly. I paid the basic $ 5 box in Digital Ocean, put in a clean installation of Ubuntu and provided an SSH key that I generated in the Panic & # 39; s Prompt application, an SSH terminal emulator for iOS. Why was this so difficult before?
After SSHing in my Digital Ocean box, I started adding the tools I need. I installed Neovim (a modern Vim alternative) and found someone's .config file for Neovim on GitHub and copied it. Then I installed nodejs, thread, npm, plot, rust, gcc … all the good things I crave. Because the "language server" aspect of the VS Code is open source, I can get many of the tips and errors that I trust a lot in coding in Neovim, even though it lacks all the rules and whistles of the GUI of VS Code.
It's hard for me to describe how I did all these things, aside from a liberal sudo apt-get install application, copy and paste shell scripts, and read error messages carefully. For the most part, they are only years of trial and error in the command line. I imagine that if you get stuck on something, I will do everything possible to help. Have you tried modifying your $ PATH?
But soon, I felt frustrated: a very small fraction of my "coding" work is writing code. I spend most of my time reading the documentation and other people's code to try to discover how anything works. After a couple of minutes of browsing through StackOverflow, I receive a notification from Prompt, warning me that my SSH session is about to disconnect due to inactivity.
The reason why iOS is so nice and responsive is because it practically does not require multitasking unless you work with several audio applications at the same time. Prompt does everything he can to stay alive, but iOS always kills him in the end.
Chapter 4: UDP saves the day
Then I looked for a solution in Google and discovered Mosh. Basically, Mosh is a UDP protocol to use a terminal from an intermittent connection. It connects via SSH as usual, but then that connection is transferred to Mosh to keep it "alive" during idle time. Prompt does not support Mosh, so I paid another $ 20 for another terminal emulator application, called Blink, and configured Mosh. It took a bit of trial and error to run the Mosh server in my Ubuntu mailbox and correctly enter my login information in Blink, but once I did it, it works very well.
I can leave the terminal for days, and as soon as I open Blink I have all sessions open since the last time. For command line warriors, this is not a huge feat. They know all about "reconnecting" to sessions or whatever they do. But for me, it's a great achievement.
In fact, somehow, I prefer my iPad / Blink / Ocean digital configuration to the coding on my Mac. I can not do everything my Mac does, for example, using windows or graphics, outside of a web browser, it's not possible, but I have the joy of knowing that I'm not ruining my Mac with all the strange command-line software that I install from the Internet. If my configuration breaks irreparably, it's just a couple of clicks to clean up my Ubuntu box and start over.
Also, while my Ocean Digital box is much slower than my MacBook Pro, it has an incredibly fast Internet connection. All I want to do to clone or install npm feels much more agile in this cloud, thanks to its minimal latency and its huge internet pipe.
Oh, and in case you're wondering: Blink supports the "Ctrl + [" command to emulate the escape. You can also assign your Caps Lock key to escape if you want to be really crazy (traditionally mapping Caps Lock to Ctrl, which also supports Blink). But, fortunately, my Neovim configuration maps "jj" to escape when it's in insert mode, so I'm golden on that front.
CodeSandbox.io includes its own console interface.
I think that my first job in this new coding configuration will be to write an extraction request for CodeSandbox to support the escape method "jj".
It is a real pickle in which I have found.