Friday, March 4, 2016

terminal - Color Scheme with Vim on Android?


I am trying to get a "solarized dark" colorscheme to work with Vim on android. Vim itself runs, and the plugin itself runs, but the colorscheme comes out wrong. I am using jackpal.androidterm app (usually the first one you see if you search 'terminal' on google play). I have tried exporting nearly every terminal type, both through the app and throught a script and I have the app's colorscheme set to "solarized dark", however, the backround doesn't display properly.


Here are the Screenshots for it.


Due to limitations on new users, I pasted them in OneDrive. (They were packed in a document due to an odd bug when uploading with Dolphin.)


Also, It is worth noting that solarized "works" on the Android Terminal when TERM=xterm-256color. However, the limited solarized colorset has too little contrast and is just plain ugly. In addition, both systems have the same plugins and .vimrc:


(~/.vimrc)


syntax on
set number
set ruler


set nocompatible " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
call vundle#begin('~/some/path/here')


" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

Plugin 'altercation/vim-colors-solarized'
Plugin 'bronson/vim-trailing-whitespace'

" Unite
" " depend on vimproc
" " ------------- VERY IMPORTANT ------------
" " you have to go to .vim/plugin/vimproc.vim and do a ./make

" " -----------------------------------------
Plugin 'Shougo/vimproc.vim'
Plugin 'Shougo/unite.vim'

Plugin 'rking/ag.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'junegunn/vim-easy-align'
" All of your Plugins must be added before the following line
call vundle#end() " required

" filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
filetype plugin on
" "
" " Brief help
" " :PluginList - lists configured plugins
" " :PluginInstall - installs plugins; append `!` to update or just
" :PluginUpdate
" " :PluginSearch foo - searches for foo; append `!` to refresh local cache
" " :PluginClean - confirms removal of unused plugins; append `!` to

" auto-approve removal
" "
" " see :h vundle for more details or wiki for FAQ
" " Put your non-Plugin stuff after this line

" -- solarized personal conf
set background=dark
try
colorscheme solarized
catch

endtry

" Highlight 80th column
if (exists('+colorcolumn'))
set colorcolumn=80
highlight ColorColumn ctermbg=9
endif


" bindings for unite--------------------------------------------------


let g:unite_source_history_yank_enable = 1
try
let g:unite_source_rec_async_command='ag --nocolor --nogroup -g ""'
call unite#filters#matcher_default#use(['matcher_fuzzy'])
catch
endtry
" search a file in the filetree
nnoremap :split :Unite -start-insert file_rec/async
" reset not it is normally

:nnoremap r (unite_restart)

" Bindings for Ag ------------------------------------------------------------
" --- type ° to search the word in all files in the current dir
nmap ° :Ag =expand("")
nnoremap / :Ag

" Easy align interactive--------------------------------------------------
vnoremap :EasyAlign

Answer




As per the screenshot of the desired color scheme, I can confirm that you can have such color scheme in Android. This is a rather indirect way but works fairly well.


Rather than using a terminal emulator I'm using an SSH client having color schemes. Three useful apps I found are JuiceSSH, Serverauditor and Reflection for Unix. I tested the first two apps.


Why SSH client you may ask? Because I stumbled across one of them and this question struck me as well. Anyhow, we need to host a simple and easy SSH server on your Android device.


I prefer Servers Ultimate Pro(paid) but you may use SSH Server(free) too. Both offered by same developer, though feel free to use any server app that can setup SSH server.


Instructions




  1. Open any of these server apps and make an SSH server with credentials. It's extremely easy so no instructions are required here. However, you may take a look at this answer(Method #3) for basic know-how.


    A thing to note that free version will make your server available on all network interfaces (including cellular network) which one won't prefer for some reasons. That's why I use the paid version as it can limit it to 127.0.0.1 or Wi-Fi easily.





  2. Install and launch JuiceSSH and enter SSH server details:



    • Addresss: 127.0.0.1 (Only for Pro app, for free app the IP will be listed)

    • Identity → New → type Username and Password you created in step 1.

    • Port: you entered in step 1.


    Save it.



  3. Tap the new entry in connections and select Accept to accept server fingerprints.



  4. Solarized dark is available under its Settings → Theme/Colors.


    A look of this app in the said theme:


    Solarized dark on JuiceSSH


    (Click image to see larger variant.)




  5. If you want more options in color scheme then try Serverauditor(Solarized default) app. Its options are straightforward, but it did not work in my device on 127.0.0.1 (no error, just blank toast).


    You may try it running on said address; could be device specific problem on my side. Otherwise, either use the cellular IP or if you're connected to Wifi/hotspot then use that one.


    A look of Serverauditor in Solarized dark theme:



    Serverauditor in Solarized dark theme


    (Click image to see larger variant.)






About JuiceSSH



The all in one terminal client for Android including SSH, Local Shell, Mosh and Telnet support.


Features:




  • Full colour terminal / ssh client

  • Popup keyboard with all those normally hard to find characters

  • Use the volume keys to quickly change font size

  • External keyboard support

  • Local Android terminal support

  • Dark, Light, 80's hacker, Molokai, Solarized Dark and Solarized Light terminal color themes ...



About Serverauditor




Serverauditor is the most innovative SSH client ever designed for a mobile device. With Serverauditor you can easily manage UNIX/Linux servers from your Android device on the go.



  • XTerm, VT100 and vanilla terminal types support

  • SSH key and password authentication

  • Built-in RSA/DSA key generator

  • Multiple SSH connections to the same host

  • Bluetooth keyboard support

  • Associate volume button or shaking gesture with actions, e.g Ctrl-Z or session closing

  • 8 awesome color schemes and adjustable font size

  • Automatic UNIX/Linux OS recognition, e.g Ubuntu, Fedora, CentOS, Mac OS X etc ...






Perhaps all of this can be avoided if only we can have a Terminal app with color schemes. Do let me know, otherwise this solution should be enough. :)


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...