Best Coding Setup on Your Phone
Tags: android, coding, termux, beginners
Published: 2022-02-14 12:44:06

I tried lots of coding editors and this is the 👌best Coding Setup i came up with.

features: 
- Its faster (unlike most code editors which starts lagging when file size gets bigger).
- Its efficient.
- It has Auto Suggestions
- Support almost all languages including Nodejs, python, Go, lua, Kotlin ...
- Basically a fully functioning VSCode
- You can customise each feature according to you.

---

## What are we Using ?
We are using Termux as our command line and NeoVim a terminal based text editor making it faster than any other code Editor.

We'll start with Termux :
- Installation
- Installing essential packages
- Making You Terminal look like 10x 
- Links to learn and Explore about Termux 

NeoVim :
- About NeoVim 
- basic Commands and Links to learn it from
- Upgrading NeoVim (`nvim`) with cool😎 plugins
- Links to learn and Explore about nvim

![screenshot](https://user-images.githubusercontent.com/63791262/153744309-0378645a-5ada-4cea-8c54-c6bec87cc4bf.jpg)

## [1] 🐧[Termux](https://github.com/termux/termux-app) :

Those who don't know what's Termux.
> Termux is a free and open source terminal emulator for Android which allows for running a Linux environment on an Android device.🤖

For more search on google.🤭
#### 🌟Some basic commands :

- `ls`- list files in current directory (folder)
- `ls -al` - list all files with all details 
- `pwd` - print current path 
- `cd` - change directory 
- `apt` - for installing packages 
- `pkg` - this command also installs packages but meanwhile it also updates package-repo lists (don't use this command outside termux)

---

### [1.1] Installing Termux :
Download and Install termux latest version (currently: `0.118.0`) from F-droid link below.
[Termux F-droid link](https://f-droid.org/en/packages/com.termux)

> *(if you have installed from playstore uninstall it)*.
**From Termux Devlopers:**
![Playstore termux depreciation](https://media.discordapp.net/attachments/906985861525155880/942332924819279892/IMG_20220213_134426.jpg)

---

### [1.2] Installing essential packages : 
Install essential packages like `nodejs`,`git`,`python`,... using `pkg` command

we're about to  use NeoVim so we'll also install `neovim`

```bash
pkg install git nodejs python neovim
```

---

### [1.3] Making your Terminal look like 10x

![screenshot](https://media.discordapp.net/attachments/906985861525155880/942368866720419860/IMG_20220213_160641.jpg)

#### [1.3.1] Install zsh (Z Shell) 
A shell similar to bash but more Customisable.

install by running :
```bash
apt install zsh
```
#### [1.3.2] Install ohmyzsh
[OhMyZsh](https://github.com/ohmyzsh/ohmyzsh) is a framework for managing your zsh configuration.

Install it by pasting : (👇script by ohmyzsh devs) [TRUSTED]
```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```

> it will prompt: 
`Do you want to change default shell to zsh?`
press `y`

#### [1.3.3] Installing powerlevel10k (p10k)
[powerlevel10k](https://github.com/romkatv/powerlevel10k) is one of the best theme for zsh.

run the following to save this theme in zsh theme folder :
(👇script by powerlevel10k devlopers) [TRUSTED]
```bash
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
```
you won't notice any changes ✅ 

#### [1.3.4] setting p10k as your zsh Theme
run: 👉`nvim ~/.zshrc`👈 to open zsh configuration file in neovim

basic help to use nvim :
- `i` : "enter edit/insert mode"
- `<esc>` : "back to normal mode"
- `:wq` : "save and exit"
- `:q` : "exit"
- `:!q` : "force exit"

edit `~/.zshrc` and add `ZSH_THEME="powerlevel10k/powerlevel10k"` just like this :
![.zshrc](https://media.discordapp.net/attachments/906985861525155880/942381869645844480/IMG_20220213_165756.jpg)

now close/end your termux session using `exit` command or `ctrl+d`
Open your termux again and answer all the questions correctly/desired/recommend.✍️

don't worry if you choose wrong option or you ever want to configure your p10k theme.You can run `p10k configure` anytime.✨🎊🥳🎉

if you don't like  this Theme you there are many built-in themes lists here : [ohmyzsh Themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes)

#### [1.3.5] Some Zsh plugins
Basically go and search on Google and install it.
![screenshot](https://media.discordapp.net/attachments/906985861525155880/942407594759319562/IMG_20220213_183717.jpg)
Screenshot of Plugins I'm using right now.

> btw if you find any cool plugins you should definitely share it with me🤗. just name it in the comments.

---

### [1.4] Links to learn and Explore about Termux 

#### [1.4.1] learn to use bash 
Bash in 100 seconds: [https://youtu.be/I4EWvMFj37g](https://youtu.be/I4EWvMFj37g)
Beginner's Guide: [https://youtu.be/oxuRxtrO2Ag](https://youtu.be/oxuRxtrO2Ag)
😅 Yes you can google it and learn from anywhere possible.

#### [1.4.2] Customizing your Termux
Termux wiki: [https://wiki.termux.com](https://wiki.termux.com)
This termux wiki isn't so big you should probably read it and its worth reading.

Termux Discord Server: [https://discord.gg/HXpF69X](https://discord.gg/HXpF69X)
You can always ask for help here if you can't find on google.

---

## [2] NeoVim
### [2.1] About NeoVim 
> Neovim is a community driven open source project and a forked version of the Vim text editor built to make Vim easier to maintain for its core developers.🤖

Basically NeoVim is Vim Patched by NeoVim Community Devlopers
Although almost all commands are same as Vim so while googling you should use `vim` instead of NeoVim to get more search results.

Those who don't know what's Vim better watch this video right now : [VIM in 100 second](https://youtu.be/-txKSRn0qeA)

> Now you should ask why NeoVim not Vim ?
well its not much of a difference you can use VIM instead but NeoVim has better GUI. so I'm going with NeoVim.

---

### [2.2] Basics nvim commands 
Don't worry 😅 bore you with bunch of commands. just some basics its same as we discussed earlier. 

basic help to use nvim :
- `i` : "enter edit/insert mode"
- `<esc>` : "back to normal mode"
- `:wq` : "save and exit"
- `:q` : "exit"
- `:!q` : "force exit"

just these and ☺️ this crash course: [VIM Crash course](https://youtu.be/IiwGbcd8S7I)
by one of my favourite Youtuber: Ben Awad

---

### [2.3] Upgrading NeoVim (`nvim`) with cool😎 plugins
we'll add some cool Neovim plugins to upgrade its UI and basically we'll make it look like VSCode.

We'll use one of the most popular vim plugin Manager: [vim-plug](https://github.com/junegunn/vim-plug)

#### [2.3.1] Installing `vim-plug`
run the following : (👇 script by vim-plug devs) [TRUSTED]
```bash
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
```
For more about `vim-plug` visit its git-repo : [vim-plug](https://github.com/junegunn/vim-plug)

#### [2.3.2] How to add Plugins
you have to create `~/.config/nvim/init.vim` run :
```bash
mkdir ~/.config/
mkdir ~/.config/nvim
touch ~/.config/nvim/init.vim
```
Now you can add Plugins simply by adding plugin git-repo link/name in between `call plug#begin()` and `call plug#end()` like this : 
![init.vim](https://media.discordapp.net/attachments/906985861525155880/942414130588045373/IMG_20220213_190257.jpg)

#### [2.3.3] Installing CoC 
To make nvim smart as VSCode
![GIF](https://user-images.githubusercontent.com/251450/55285193-400a9000-53b9-11e9-8cff-ffe4983c5947.gif)

Plug this 👇 in your `~/.config/nvim/init.vim` using nvim : `nvim ~/.config/nvim/init.vim`
```vim
" Use release branch (recommend)
Plug 'neoclide/coc.nvim', {'branch': 'release'}
```
save and quit and open nvim again : `nvim`
run in nvim: `:PlugInstall`
and run: `:CocInstall coc-json coc-tsserver` 

you might need to install some CoC-plugins/packages based on language you are coding. You can Google it🤘.

#### [2.3.4] More configurations
Here you have two choices you can either copy my vim.init file and your nvim will be like mine or You can follow [ben Awad](https://youtu.be/gnupOrSEikQ) and customise accordingly.


**Using My nvim configurations** : [My init.vim](https://gist.github.com/RajnishAnand/30b26d1772c0a22a32475d2bba8613bf)
you can copy paste or run this and everything will be installed: 
```bash
cd ~/.config/nvim
curl -o init.vim https://gist.githubusercontent.com/RajnishAnand/30b26d1772c0a22a32475d2bba8613bf/raw/e2b1664485f3f731b176d8c6e155b1035f1bba4d/init.vim 
cd -
nvim +PlugInstall

```
Now you can `ctrl+t` to toggle : 
![NERDTree](https://user-images.githubusercontent.com/63791262/149628121-02eef553-9b6e-4f52-a2ea-c6a1c344e9be.jpg)
vs-code like file viewer side by side

press `?` to toggle NERDTree Help:
![NERDTree HELP](https://media.discordapp.net/attachments/906985861525155880/942425457410859018/IMG_20220213_195158.jpg)

you should definitely check each plugins to check its features.

---

### [2.4] Links to learn and Explore about nvim
Learn vim while Playing (PC users only): 
[https://vim-adventures.com/](https://vim-adventures.com/) 
Neovim Official Docs:
[https://neovim.io/doc/user/](https://neovim.io/doc/user/)

And like always how stupid it might look you can google it. 😅

---
## 🎉🎉🥳🎊 THE END 🎊🥳🎉🎉
---