■ DroidVim (Text Editor)

DroidVim is a Vim for Android.
Vim (Huge version), grep, diff and ctags are ready to use.
https://play.google.com/store/apps/details?id=com.droidvim

■ Note:

How to quit:

  • Type ":qa" command
  • "Double tap" > "QUIT"
  • "📲" button

Vim tutorial:

  • Type ":Vimtutor"
  • "Long press menu" > "Vim tutorial"

■ Troubleshooting:

  • If Vim freezes, use "Close window" on the long press menu.
  • DroidVim is terminated by itself in the background.
       On some devices, DroidVim running in the background may be terminated by itself because the power saving mechanism is not properly implemented.
       In this case, please turn off "Battery optimization" of DroidVim. ("Preference" > "App settings" > "Ignore Battery optimization")
  • If Git/Python cannot be run from the shell, try the following
       - Reinstall (overwrite) Git/Python
       - Enable proot (Preferences > Shell > Proot)

long lines slow down display

Vim slows down the display of long lines.
However, if there are many parentheses, such as html or json, the matchparen may slow down the display even if the lines are not that long.
In that case, try adding either of the following to your .vimrc.
" `matchparen_timeout` to be smaller (default is 300). " or make `synmaxcol` smaller (`:h matchparen`) let g:matchparen_timeout=10

" Note: updatetime is global (`:h updatetime`). set updatetime=300 augroup matchparenlight   auCursorMoved * let g:matchparen_timeout=1   auCursorHold  * let g:matchparen_timeout=300|doau matchparen CursorMoved augroup END

Screen glitches

Vim and terminal can not handle "proportional fonts". Please use "monospaced fonts".
"Preferences > Font > Font file"
monospaced fonts
All character widths must be the same or double (fixed-width). For example, 'i' and 'W' must have the same character width.
For example, try "Roboto-Mono" via followings.
https://fonts.google.com/knowledge/glossary/monospaced
https://fonts.google.com/specimen/Roboto+Mono

■ Storage access

Vim has direct access to the Android file system via shell.
Therefore, to edit files with Vim, it is necessary to understand the file system and security of Android.

Internal Storage
Built-in storage within the Android device.
   Android 10 and earlier, shell has direct access to files.
   Android 11 and later, shell can only access specific directories ([Internal storage]/Android/data/com.droidvim/files).
   See "$INTERNAL_STORAGE" for direct access via shell.
App-specific Storage
Store files only for internal processing by the app.
   Android apps run in the sandbox. Files in the sandbox cannot be accessed by other apps.
   This storage can be handled in much the same way as a general Linux file system. The DroidVim's "Home directory ($HOME)" is located in this area.
   Android 7 and later, You can use "File Manager" button (Drawer menu) to copy files to the DroidVim's "HOME directory".
External Storage
External SD card, USB memory, various cloud storages.
   Shell does not have direct access to this area.
  • Use the "Storage" button to edit / create files in storage that is not directly accessible via shell.
  • DroidVim may create a cache file and edit the cache file when accessing external storages.

$INTERNAL_STORAGE (Internal storage)

You can access to the internal storage via shell with $INTERNAL_STORAGE.
You can also use $APPEXTFILES to access [Internal storage]/Android/data/com.droidvim/files.
Android 11 or later: $INTERNAL_STORAGE and $APPEXTFILES are set to the same location.

:e $INTERNAL_STORAGE
* There is a symbolic link in Home directory. ([Home directory]/internalStorage)
  Symbolic links can be re-created using "Drawer Menu→Storage→Symbolic Links".

Use echo to display the path.
:echo $INTERNAL_STORAGE
Internal storage ($INTERNAL_STORAGE) can be accessed by other applications.

Android 11 or later
!!! IMPORTANT !!!

   Uninstalling the app will remove $INTERNAL_STORAGE ([Internal storage]/Android/data/com.droidvim/files).
   Please backup the files in $INTERNAL_STORAGE regularly.
   It is not recommended to save any files other than Vim configuration files to $INTERNAL_STORAGE.
Android 11 or later (with MANAGE_EXTERNAL_STORAGE permisson)
   DroidVim on Github supports the MANAGE_EXTERNAL_STORAGE permission.
   In this case, you can access the internal storage directly as "Android 10 and earlier".
Android 10 and earlier
   In most cases, You can access the internal storage directly as /sdcard or /storage/emulated/0.
   Storage permission is required for direct access.

■ Vimfiles and Home directory

Please read "Storage access" first.

If you want to change Vim settings, create Vimfiles (.vimrc, .vim) in the Home directory ($HOME).
You can also edit .vimrc with "Long press menu -> Edit .vimrc".
.vimrc         configuration file           :h vimrc                
.vim/autoload automatically loaded scripts :h autoload-functions    
.vim/colors   color scheme files           :h colorscheme          
.vim/doc       documentation                 :h write-local-help      
.vim/ftplugin filetype plugins             :h write-filetype-plugin
.vim/pack     packages                     :h packadd              
.vim/plugin   plugin scripts               :h write-plugin          
.vim/syntax   syntax files                 :h mysyntaxfile          

You can create directories and copy files with commands via Vim.
  1. :!mkdir -p $HOME/.vim/colors
  2. :!cp /path/to/your_colorscheme.vim $HOME/.vim/colors

There are several more convenient ways to copy files to DroidVim's "HOME directory".

!!! IMPORTANT !!!
  • Uninstalling DroidVim will delete all files in $HOME.
  • (Android 11 and later) Uninstalling DroidVim will delete all files in $INTERNAL_STORAGE ([Internal storage]/Android/data/com.droidvim/files).
Please backup your files regularly.

File manager

 "Android 7 and later"

You can use "File Manager" button (Drawer menu) to copy the files.
You can also use a file manager app that supports Android Storage Access Framework.

Vimfiles location

You can use Vimfiles (.vimrc or .vim) in internal storage.
"$INTERNAL_STORAGE"

$VIM

You can change the location of Vimfiles by setting the environment variable $VIM. (:h $VIM)

"Preferences > Shell > Initial commands"
export VIM=$INTERNAL_STORAGE/path/to/vimfiles bash -vim.app

Symbolic link

Symbolic link:
  1. :!rm $HOME/.vimrc
       (Delete $HOME/.vimrc)
  2. :!ln -s $INTERNAL_STORAGE/path/to/.vimrc $HOME/.vimrc
  3. :!rm -rf $HOME/.vim
       (Delete $HOME/.vim)
  4. :!ln -s $INTERNAL_STORAGE/path/to/.vim $HOME/.vim

Backup/Restore

You can backup or restore the files in the home directory ($HOME) by using Backup/Restore command.
 "Drawer Menu > Storage > Backup/Restore"

Backup/Restore has the following restrictions.
  • Backup/Restore only copies files with new timestamp.
  • Backup/Restore does not copy symbolic links.
  • No mirroring.

■ Tips:

Move the cursor

  • Swipe left or right in the lower half of the screen to move the cursor to the left or right
  • The [○] button swaps the top/bottom, left/right directions.
       It also synchronizes with the state of the [Ctrl] button. ([ESC] button to cancel)

HTML and Link.

  • Open the URL under the cursor.
       - gx (:h gx)
  • Open HTML file in browser.
       - "Menu" -> "Share" -> \"File\"
       - Type :ShareIntent file

Colorscheme

DroidVim supports a 256 color terminal scheme.
:colorscheme term256
"Vimfiles"

Plugins

"Vimfiles"
You can install the VimScript plugin to "$HOME/.vim/plugin" directory.
See followings:
  • :h plugin
  • :h runtimepath.
You can also use packadd. ("$HOME/.vim/packadd")
  • :h packages.

Windows/samba

If you want to edit the file shared by Windows/samba, try using the following application. (Android 8 and later)

zip, tar

Zip and tar files can be extracted using unzip or busybox tar.

shell script

If you want to run a shell script in the home directory on Android 10 or later, enable "Preference > shell > proot".

root

Since DroidVim is running on the terminal emulator, root access is possible by installing the su command.
In a rooted environment, the vi command should also be available. We recommended using vi with shell or Ctrl+z.
  1. :shell or Ctrl-Z
  2. su
  3. vi

You can also use DroidVim's vim binary by running the suvim command.
  1. :shell or Ctrl-Z
  2. suvim
  3. use exit to exit root

Android 10 and later

If you get an error with the su command, execute :TerminalMode on Vim.
When you restart DroidVim, DroidVim will start up in "Terminal emulator mode", so execute su or suvim.
If you have problems with bash, use :TerminalMode sh.
When you exit DroidVim, DroidVim will start up in "normal mode".
You can also use it by turning off [Settings] > [Shell] > [proot].

■ Text input mode

By default it is set to "Direct input" (alphanumeric characters only) for normal mode commands.
Switch to the normal input by the following method.
  • "🔤" button (function bar)
  • One-line text box
  • <C-^>
  • Vim script
  • IME shortcuts

One-line text box

When you start one-line text box (double tap at the bottom of the screen), you can use the usual input equivalent to a normal Android application.
It is convenient to change "Preferences" -> "🔤 button" to "One-line text box".

Vim Script(control via Vim)

If you want to switch to the normal input automatically when enter the insert mode, add the following settings to your .vimrc.
" Toggle one-line text input let g:imctrl_normal=56 let g:imctrl_insert=50
" Toggle input mode let g:imctrl_normal=53 let g:imctrl_insert=50
You can also use <C-^>. (:h iminsert :h i_CTRL-^)

Non-English language with Gboard

If you want to input non-English language characters using Gboard, try using the following settings.
  1. Set Gboard's "Language" to only two, English and the language you want to use.
  2. Long press space key → Choose "English".
  3. Set DroidVim's "Preferences" → "functionbar" → "🔤" button to "<C-^>"
  4. Add the following settings to .vimrc and restart.
" Execute "Language Switch" when the input mode is switched by `iminsert` let g:imactivate_language_switch = 61
After that, use "🔤" button in insert mode to switch between alphanumeric characters and non-English language characters.
※ This method is not useful if you need more than two languages.

If a physical keyboard is connected, use <C-^> or <C-6>. You can also use "IME shortcuts".
  1. DroidVim's "Preferences" → "Text Input Mode" → Set "IME Shortcut Action" to "<C-^>"
※ Unless there is a problem, do not use "[Shift] + [Space]".

Option details

imctrl_insert               When entering the insert mode
imctrl_normal               When exiting the insert mode
imactivate_insert           When entering the insert mode (iminsert=2)
imactivate_normal           When exiting the insert mode (iminsert=2)
imactivate_language_switch When entering/exiting the insert mode (iminsert=2)

The operation differs depending on the IME being used. Please set appropriately by referring to “Setting value details” in the next section.

Setting value details

You can change the text input mode from Vim script.
:ATEMod 72

0 Do nothing
50 Normal input
51 Direct input : password
52 Direct input : URI
53 Direct input : Default
54 Direct input : Raw
55 Toggle "Normal input"/"Input mode at startup" See Preferences
56 One-line text box
61 Language switch (Shift+Space) If you are using IME for which "language switch" command is not enabled, the same process as pressing the space key is performed.
62 Language switch (Alt+Space)  If you are using IME for which "language switch" command is not enabled, the same process as pressing the space key is performed.
63 <C-^> For iminsert
70 Hide softkeyboard
71 Show softkeyboard
72 Toggle Softkeyboard

Physical keyboard

The terminal emulator can also control the input mode.
If you want to control the input mode from the physical keyboard, try setting "Preferences" → "Text input mode" → "IME shortcuts" appropriately.

Android Shortcuts

Layout switch   [Ctrl]+[Space]   If multiple layouts are available.
Language switch [Shift]+[Space] If IME can use multiple languages.
IME switch       [Meta]+[Space]   If multiple IMEs are available.
[Meta] means [Windows] key or [Command] key
(Android 7 and up)

■ Extra contents (in-app purchase):

Extra contents

Add the following packages required by some plugins.
  • Git, curl - Version Control System.
  • Python - Programming Language.
Others
  • Markdown to html plugin (Experimental)

Donation

With one donation, you can use extra contents on all your devices, and you do not need a donation for updates.
If you add a new device, Google Play may not yet reflect your billing status.
In that case, proceed with the flow until the "Google Play's in-app billing dialog" appears. (No need to buy)
When the "Google Play's in-app billing dialog" is displayed, Google Play will acquire the data from the server and the latest billing status will be reflected.

python (pip)

Python on DroidVim does not support numpy/scipy.
This is because the developer of numpy/scipy has not built the library file for Android.

busybox-setup

When extra contents is installed on a specific device (e.g. Samsung devices), some commands (e.g. "ls") may not work.
In such a case, please use "busybox-setup sysbin".
  1. :shell or Ctrl-z
  2. busybox-setup sysbin

If problems still occur, initialize and setting commands.

Initialize

  1. busybox-setup clean
  2. busybox-setup

Setting commands

  1. For example, if ls does not work, execute busybox-setup sysbin ls or busybox-setup ls.
  2. If there is a command which does not work, do the same thing.

Option          
all               Add all busybox commands. (busybox-setup all)
{command}         Add specified busybox command. (e.g. busybox-setup ls)
sysbin            Use all commands of your device preferentially. (busybox-setup sysbin)
sysbin {command}  Use specified command of your device preferentially. (e.g. busybox-setup sysbin ls)
clean             Clear all additional commands. (busybox-setup clean)
If you run without options, the standard installation will be performed.

■ Network permissions

DroidVim uses network permissions for the following purposes:
  • Extra contents
  • HTML file preview
  • Help
  • Crash report
If you don't like it, build DroidVim yourself from source code or stop using DroidVim.

■ Source code:

DroidVim is an open source project.
https://github.com/shiftrot/droidvim

■ Contact:

<< Prev  |  PageTop