Tuesday, February 25, 2014

[How to] Customization of Linux basic tools

Customization of Linux basic tools

If like me, you like to change the look of the tools that you use every day: like the Terminal, your text editor and stuff like that... you can check some of the options that I will leave in this post.

Customizing you Shell


First of all, I personally prefer to use zsh over bash because of the many features that are included.

I didn't write my own zsh configuration, I know, how lame... But if somebody already did it and did it way better than me, I will use it :)

There are a lot of configuration files out in the wild. I really like the grml zsh rc. This config file is used when you install Arch in a machine and has a lot of interesting features. For example extended completion for man pages, files, folders... Basically anything that you can Tab on. It will show you the options that you have on the screen dynamically.
Here is an example of completion when I'm looking for a manual. The tabulation lets me navigate through selection
There is even a man page for the configuration file. You can add a lot of interesting stuff like the battery state, changing your prompt easily with installed examples...

If you want to install this you can do (please make sure that you have saved your config because this will replace it):

$ wget -O .zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc

If you are using Arch you can install it from the extra packages

# pacman -S grml-zsh-config

There is another option that I was trying not so long ago called oh-my-zsh.
You get a lot of configuration files made by the community and you can easily switch the look by editing you .zshrc file.

Make sure you check the options in the Github page.

If you prefer to use bash you can check the Arch wiki about Color Bash Prompt, so you can edit your own.

Bored of the display for ls


I saw a screenshot in a Linux community on G+ showing different colors for the ls command. Then I started to do some research about how to change the colors for different extension and came across the Solarized theme that seems to be very popular.
All the extensions showing the different colors
If you want to change all the colors for the ls command you can go to the Github page and download the theme that you want. I use the 256 theme.

Rename the file that you downloaded and put it where you want (I put it in my home):

$ mv dircolors.256dark ~/.dircolors

Then you need to execute the following command every time you launch your terminal:

$ eval `dircolors ~/.dircolors`
So the best way to do this is to edit you configuration file for your shell, .bashrc for bash, .zshrc for zsh.

BUT if you are using the grml config file for zsh you don't edit the .zshrc directly because it is too risky.
The right way to do it is to create/edit the file .zshrc.local and add the line:

eval `dircolors ~/.dircolors`

If you want to add a little extra you can try the command called ls++ (ls on steroids).

You can install it using the AUR packages or build it from source, here is the Github page.

Terminator, using zsh with GRML config file, with Solarized dircolors and ls on steroids.

Installing Solarized theme in VIM


In this last part I will show you how to install the Solarized theme in your VIM editor.

(G)VIM with the Solarized theme
The Github page of the project explains how to do it.

I installed the bundle in .vim/bundle and copied the solarized.vim file in .vim/colors. If the directories are missing just create them using mkdir.

Once you copied the file and the bundle the only thing to do is to change the colorscheme

:colorscheme solarized

If you want to do this permanently you need to create/edit the .vimrc file and put the line

colorscheme solarized


Did you like this post? Don't forget to add me to your circles in G+ or to follow me on Twitter: @RobertoXMed

Please consider donating to the Blog it will be of great help! Thank you.