/iVim

A vim port to iOS.

Primary LanguageC

iVim

iVim is a project that brings the vim editor to the iOS system.

Type :help ios in iVim for more detailed information.

Features

Font management

Besides some system and embedded monospace fonts, iVim allows users to import and use their own custom fonts. Also, iVim provides commands for more intuitive and efficient font management.

Extended keyboard

By introducing compact buttons, iVim covers as many keys as possible in its extended keyboard, so that you can input symbols without switching among key groups. Moreover, you can customize it to meet your own special needs.

Multistage language input

iVim adds support to multistage input languages such as Chinese or Japanese.

Sharing

Through sharing, iVim makes its editing power available to more apps. Via the share extension, iVim can import text or text files from, or export to other apps. Via the document picker, you can also import or edit files or directories in iCloud Drive or documents providers, without leaving iVim.

External hardware keyboard

iVim supports external hardware keyboards well, just connect your favorite one to the device and start typing. If you are using a standard English keyboard, you can remap the caps lock key, too.

Auto restore

After an app termination, iVim restores the last editing session automatically on launch. So you don't have to worry about data losing any more. And you can disable it in Settings.app if you prefer the old way.

How to install it

App Store

iVim is now on App Store

Source code

To download iVim and the associated frameworks, after you've cloned it, type:

 ./get_frameworks.sh

This will download precompiled frameworks for ios_system (including Python and Lua) and TeX, plus the headers required to compile iVim with Python or Lua support. Then, compile:

  1. Open iVim.xcodeproj in Xcode
  2. If you do not need Python or Lua support, edit the CFLAGS accordingly.
  3. In General > Identity of target iVim and iVimShare, change their bundle identities to your own unique ones, and select your Apple ID to sign them. As to the App Group, it requires a paid Apple ID. If yours is, change the App Group identifier for these two targets to your own; if not, just turn them off (the only difference is that you cannot share text to iVim when it is off)
  4. Connect your device via USB to your computer, and select it as the Destination of iVim
  5. Run iVim, Xcode will install it onto your device
  6. A free Apple ID may need to do this every 7 days

Modifications

This is a fork of https://github.com/terrychou/iVim The modification is that you can call shell commands (a first for iOS).

There are many limitations, obviously. The main one is that shell commands can only act (read files, create files, etc) inside iVim sandbox. The other is that you need to redirect the output: "!ls" produces nothing, "!ls > result" does. Commands sent by iVim plugins do this naturally, but it also applies to commands you write yourself.

There is only a small number of shell commands available. They come from the ios_system package. If you want to edit commands (add new commands, remove some...) you can download the source and compile it.

The most useful commands are:

  • rmdir (not available otherwise),
  • grep (to operate on log files),
  • gzip/gunzip, which lets you edit gzipped files directly.
  • curl, for editing remote files (try :e sftp://name@host/~/config )

Additional commands are available from my ports of python, lua and TeX. These only provide the commands. You will need to download the auxiliary files (python modules, TeX formats and style files) yourself, inside iVim file system.

Environment variables

In iOS, you cannot write in the ~ directory, only in ~/Documents/, ~/Library/ and ~/tmp. Most Unix programs assume the configuration files are in $HOME. To solve this, iVim redefined $HOME to ~/Documents/. You might still need to redefine environment variables (in your .vimrc) for several programs:

Here's what I have in my .vimrc:

let $PATH .= ':'.$HOME.'/../Library/bin:'.$HOME.'/bin'
let $PYTHONHOME = $HOME.'/../Library/'
let $SSH_HOME = $HOME
let $CURL_HOME = $HOME
les $SSL_CERT_FILE = $HOME.'/cacert.pem'
let $HGRCPATH = $HOME.'/.hgrc'
map <D-o> :idocuments <CR>

Giants' shoulders

iVim was inspired by and based on 3 projects:

  1. vim - the official Vim repository
  2. Vim port from Applidium
  3. VimIOS - A port of Vim to iOS 9+

Without them, iVim wouldn't begin.

Also, without violating the copyright of Vim, feel free to make modifications to meet your own needs.