Changing default editor in Ubuntu

When I opened visudo file in Linux it opened in default editor i.e joe. So by running only one command I will change the default editor in Linux.

sudo update-alternatives --config editor

The output of the above command will show all the editors presents in your system and you will select only one editor as default.

Powerline Plugin

Powerline is a plug-in to display informational and beautiful statusline for vim, tmux and shell prompt for bash, zsh.


Installation:

Install python-pip and git: Run the following command in a terminal:

sudo apt-get install python-pip git

Then run the given below command to install Powerline plugin:

su -c 'pip install git+git://github.com/Lokaltog/powerline'

Installing fonts for Powerline:

wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
mkdir -p ~/.fonts/ && mv PowerlineSymbols.otf ~/.fonts/
fc-cache -vf ~/.fonts
mkdir -p ~/.config/fontconfig/conf.d/ && mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/

Usage:

    • Vim statusline:
      Add following to your ~/.vimrc or /etc/vim/vimrc:

      set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
      
      " Always show statusline
      set laststatus=2
      
      " Use 256 colours (Use this setting only if your terminal supports 256 colours)
      set t_Co=256

vim

  • Bash prompt:
    Add the following line to your ~/.bashrc or /etc/bash.bashrc:

    if [ -f /usr/local/lib/python2.7/dist-packages/powerline/bindings/bash/powerline.sh ]; then
        source /usr/local/lib/python2.7/dist-packages/powerline/bindings/bash/powerline.sh
    fi

    bash

  • Zsh prompt:
    Add the following line to your ~/.zshrc or /etc/zsh/zshrc:

    if [[ -r /usr/local/lib/python2.7/dist-packages/powerline/bindings/zsh/powerline.zsh ]]; then
        source /usr/local/lib/python2.7/dist-packages/powerline/bindings/zsh/powerline.zsh
    fi
  • Tmux statusline:
    Add the following line to your ~/.tmux.conf:

    source /usr/local/lib/python2.7/dist-packages/powerline/bindings/tmux/powerline.conf
    set-option -g default-terminal "screen-256color"

    tmux