Skip to content

Instantly share code, notes, and snippets.

@itsShnik
Last active July 15, 2020 04:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsShnik/795b9d51f70fd099793a548dee7b568e to your computer and use it in GitHub Desktop.
Save itsShnik/795b9d51f70fd099793a548dee7b568e to your computer and use it in GitHub Desktop.
Useful applications for Ubuntu

Setting up useful applications in Ubuntu

Vim

Install vim using the default package manager:

sudo apt install vim

However, the version in apt repositories might not contain the latest patches. To ensure that you have the latest version of vim, build it from sources.

git clone https://github.com/vim/vim.git
cd vim
make
make install

Support for clipboard and some other utilities has been removed from the default install of vim. You can verify the same using vim --version | grep clipboard. To add the support for these utilities, run

sudo apt install vim-gtk

Vimrc

You can build your own awesome vimrc with whatever configs, plugins and plugin manager suit you. I use Vundle as my plugin manager. To install Vundle:

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Put this on top of your vimrc

set nocompatible              " 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 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.


" 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

Checkout my vimrc here.

Another useful trick is to open a file at the position where you left it. Find the following lines in the file /etc/vim/vimrc

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

Uncomment the last line from the aforementioned part.

Kitty

Kitty is a GPU accelerated terminal emulator. It works faster than the default Gnone terminal, provides a lot more utility like opening images in terminal, split-windows etc. and plenty of scope for wrapping your own developments using Kittens.

Install kitty using the following command.

curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin

Create a desktop application for kitty using

# Create a symbolic link to add kitty to PATH (assuming ~/.local/bin is in
# your PATH)
ln -s ~/.local/kitty.app/bin/kitty ~/.local/bin/
# Place the kitty.desktop file somewhere it can be found by the OS
cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications
# Update the path to the kitty icon in the kitty.desktop file
sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty.desktop

Now reboot to see kitty in your desktop applications.

Configuring Kitty

Kitty can be configured according to your will. Checkout the sample config file for kitty here and kitty configuration tutorial here.

Also checkout dexpota/kitty-themes which contains iTerm2 color themes ported for Kitty.

Fusuma

Gestures are super awesome user-friendly feature. Sadly, linux distros do not support them by default. Fusuma is a great tool for gesture recognition in linux. Follow the instructions for installing Fusuma:

You must be a member of the INPUT group to read touchpad by Fusuma.

sudo gpasswd -a $USER input && shutodown -r now

That reboot is needed to assign this group.

Now, you need to install libinput-tools which contains libraries to handle input devices for gestures (like touchpad).

sudo apt install libinput-tools

Now install Ruby, since Fusuma is a Ruby gem.

sudo apt-get install ruby

Then install Fusuma

sudo gem install fusuma

To send custom commands for recognized gestures, install xdotool

sudo apt install xdotool

Configuring Fusuma

First of all, add fusuma to the list of startup applications. Open startup applications on ubuntu and click on Add. Give it a name, in the command section write fusuma -d. Reboot for changes to come in effect.

Make a config directory for Fusuma.

mkdir -p .config/fusuma

Create a config file in the config directory for fusuma.

vim config.yml

Checkout my config file for Fusuma here. Note that it is made for Ubuntu-20.04.

Slack, Typora using Snap

TBH I am not a fan of snaps particularly because the applications are containerised and therefore consume a lot more space. But more oftne than not, I succumb to the ease of working with applications installed using snap.

Here is how you can install slack using snap.

sudo snap install slack --classic

The --classic flag puts snap into classic mode and disables security confinement which is required for installing this version of slack.

To install Typora, we can use an snap image provided by Alan Zanatta.

sudo snap install typora-alanzanattadev

Bash

I use bash shell since it is easily available on linux distros and servers. I use some cusomizations for my bash shell. Follow along if you may find them useful.

Colored Prompt: By default a colored prompt is set to false in ~/.bashrc. Uncomment the last line in the following part to get a colored prompt.

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

Auto CD: It sometimes troubles me that I have to type cd .. to move a directory back or cd <dir_name> to move into a directory. Bash has a shell-option to set auto cd. Just add the following in your bashrc.

shopt -s autocd

Now you can just do .. to move a directory back and <dir_name> to move into a directory.

Other interesting shell options that you might want to set may be cdspell, dirspell and histappend.

Alias: Aliases are like hash functions. You might not want to write a long clumsy command everytime you want to do some stuff. Alias is there for rescue. You can map large clumsy commands to small strings and use them instead. To add an alias,

alias <your hash>='your command'

I like to put my aliases in a separate file ~/.bash_aliases. To source this file when bashrc is sourced, add (if not already there) the following to your bashrc.

if [ -f ~/.bash_aliases ]; then
   . ~/.bash_aliases
fi

Colored Man Pages: Reading manuals can be boring because of the monotonous color of man pages. To colorize man pages, I use the following function in my bashrc.

man() {
   LESS_TERMCAP_md=$'\e[01;31m' \
   LESS_TERMCAP_me=$'\e[0m' \
   LESS_TERMCAP_se=$'\e[0m' \
   LESS_TERMCAP_so=$'\e[01;44;33m' \
   LESS_TERMCAP_ue=$'\e[0m' \
   LESS_TERMCAP_us=$'\e[01;32m' \
   command man "$@"
}

Vi Keybindings: If you are a vim user, you would like to have vim keybindings everywhere. Well, if not everywhere, you can atleast have vi keybindings in your shell.

Create a file .inputrc in your home directory.

mkdir .inputrc

Add the following in your .inputrc to enable vi keybindings

set editing-mode vi
set keymap vi

But this doesn't show which mode are you currently in. To add a prompt for that, add the following in your ```.inputrc``

set show-mode-in-prompt on
set vi-ins-mode-string "[I] "
set vi-cmd-mode-string "[N] "

Mapping Caps Lock to Esc: You might want to map Caps Lock to Esc if you use vim regularly. Add the following to your ~/.profile file. If you do not have one already, either create one or check if you have a ~/.bash_profile.

setxkbmap -option caps:escape

Checkout my bashrc and bash_aliases.

Gnome Desktop Environment

I use Gnome as my desktop environment which is default in ubuntu distributions >= 17.04. I use gnome-tweak-tool with some gnome-shell-extensions for my desktop.

Install gnome-tweak-tool and gnome-shell-extensionsusing

sudo apt install gnome-tweak-tool

and

sudo apt install gnome-shell-extensions

then do a quick Alt + F2 and r to apply the changes.

Some useful gnome shell extensions are autohidetopbar, dash-to-dock and pixelsaver.

@itsShnik
Copy link
Author

itsShnik commented Jul 7, 2020

Here is how the kitty terminal looks

Kitty

Here is how the gnome desktop environment looks

GnomeDE

@tejasvaidhyadev
Copy link

nice
just installed kitty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment