Vim working natively on Android phones

來源:互聯網
上載者:User

標籤:

Introduction

I own a HTC Dream. While one may discuss about its usability as a phone, it makes a great portable internet access machine. I have installed a debian chroot on that machine and used to boot it when I wanted to edit some stuff on the go - it has vim, git, svn and anything else you may need. It was, however, tiring to enable it each and every time I wanted to edit something, and it used up some memory that only could be freed by rebooting.

So I‘ve grabbed the NDK and built Vim for Android

Screenshot

Warning

This only works for rooted phones. I have only tested it on G1 a.k.a. HTC Dream.

Download

Grab this archive with Vim 7.3 for Android.

Install using computer and adb
adb push vim-android.tar.gz /sdcardadb shell# su# cd /# tar -zxf /sdcard/vim-android.tar.gz# ^D

After this step, you should have a vim binary in /data/local/bin/vim - the directory should be in your $PATH, but you can ensure by typing:

# echo $PATH
Install using your phone only

Connect to your phone‘s shell using ConnectBot, Better Terminal or other software. Then type as following:

$ su# cd /# wget -O - http://gdr.geekhood.net/gdrwpl/heavy/vim-android.tar.gz | tar -zxf -
Details

Vim is built using NDK. This means it doesn‘t link statically to libc or any libraries that are already present. The only library it has built-in is ncurses.

All vim-specific files are placed in /data/local/usr/share. It‘s equipped in syntax highlighting for vim and shell files and some scripts I found in Ubuntu‘s vim distribution. More scripts can be installed to /data/local/usr/share/vim. The default vimrc file can also be found in that directory. The package also has a terminfo database stolen from Ubuntu - it‘s needed for color display. It‘s placed in /data/local/usr/share/terminfo

The list of options can be viewed here: vim --version output. Mouse support is available if you apply my patch to ConnectBot (vote for its inclusion into mainline!)

The binary size is about 1.3 MB.

Source

Put the content of the source pack in the sources/ directory of Android NDK. Chdir to that directory and issue ndk-build to produce Vim binary in libs/armeabi/vim.

The actual sources are in jni/ directory. NCurses is to be found in jni/ncurses/

Vim‘s auto/config.h and other automatically generated files are generated by ./configure running on ubuntu and tweaked manually. Similar thing is done to ncurses‘ curses.priv.h.

Simply relacing the source files with newer vim and rebuilding should do the trick of upgrading to the latest version. Adding new files to Android.mk may also be needed.

Vim working natively on Android phones

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.