Ubuntu/Linux Neovim Setup for Phoenix/Elixir

Paugramming (Pau Riosa)
3 min readJan 6, 2020

Hi guys here is my ubuntu/linux setup using neovim for

Phoenix/Elixir Development

Setup Development Machine

1. sudo apt-get update
2. sudo apt-get install terminator
3. sudo apt install neovim
4. sudo apt-get update
For file searching5. sudo apt-get install rg
6. sudo apt-get install silversearcher.ag

Setup Git

1. sudo apt install git
2. git config --global push.default simple
3. git config --global user.email "<youremail>"
4. git config --global user.name "<yourname>"
5. git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Make ZSH default and install Oh-my-zsh

1. sudo apt install zsh
2. zsh --version
3. chsh -s $(which zsh) -> This will make your zsh to be your default
4. if you don't have curl, install it -> sudo apt install curl
5. sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" -> will oh-my-zsh

Clone Development Setup

1. mkdir ~/.config2. git clone https://gitlab.com/jethro.riosa/neovim-setup.git ~/.config/nvim3. ~/.config/nvim/zsh_script.sh4. source ~/.zshrc5. git clone https://github.com/k-takata/minpac.git ~/.config/nvim/pack/minpac/opt/minpac -> this will fix minpac#init errors6. in your terminator, type vim, this will show your vim editor.7. install packages -> :PackUpdate then exit editor.8. vim ~/.zshrc9. change export ZSH value to your HOME PATH
ex. export ZSH="PATH"
10. save your ~/.zshrc file and then type source ~/.zshrc

Troubleshoot

In case you encounter such errors as:
asdf not found
zsh-git-prompt not found
just do the following.
1. git clone https://github.com/asdf-vm/asdf.git ~/.asdf
2. git clone https://github.com/olivierverdier/zsh-git-prompt.git
3. source ~/.zshrc

Setup Phoenix/Elixir

1. sudo wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb
2. sudo apt-get update
3. sudo apt-get install esl-erlang
4. sudo apt-get install elixir
5. mix local.hex
6. elixir -v
7. mix archive.install hex phx_new 1.4.11

Setup NVM for NODE


1. install nvm for node -> curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
2. reopen terminal
3. nvm ls-remote and select desired version
4. nvm install v13.5.0
5. node -v to check version -> it should show v13.5.0

Setup Postgresql

1. psql -v to check if postgresql is installed
2. sudo apt-get install postgresql
3. sudo apt-get update
4. sudo update-rc.d postgresql enable or sudo systemctl enable postgresql to boot postgresql automatically
5. psql --version to check if postgresql is installed

Setup Postgres default user

1. If you want to add more Postgre features like PostGIS, you can search them:
apt-cache search postgres
2. If you want a handy GUI, you can install it:
sudo apt install pgadmin3
3. Create postgres admin user
sudo -u postgres psql postgres
4. Setup default password postgres for default user
\password postgres. Just enter postgres.
5. Create an admin user based on the the current user
sudo -u postgres createuser --superuser $USER

Install Inotify for file-watching

sudo apt-get install inotify-tools

Create Hello World Application

1. mix phx.new hello_world
2. cd hello_world
3. mix ecto.create
4. cd assets && npm install
5 mix phx.server
6 go to http://localhost:4000 and it should show Phoenix Default App Page.

Resource:

If you have any comments/suggestions, just comment down below!

Happy Coding!

--

--