Trix & Graphix

Forcing vim to remember the cursor position

In some VIM installations this awesome editor does not remember the last cursor position in the former edition of a file. Of course, this can be a pain. Here is a small tip to solve this problem. You only need to copy this code into your .vimrc file

" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")

\| exe "normal g'\"" | endif

Customizing the Unix prompt

This is a very fast post about the prompt (basically this is an auto-remainder for myself xD).

The appearance of the prompt in an Unix terminal is determined by the environment variable PS1. You can (you have to) modify it if you want to change the prompt. It is easy to take a look at the current value of variable: just type in an open terminal
echo $PS1
and here is it. The prompt that I'm currently using is this one:
PS1='$(tput setaf 1)\u@\h $(tput setaf 2)\w> $(tput setaf 0)'
There are a number of commands very useful to depict important information. In my example \h shows the name of the host, whereas \u is the user and \w is the current working path. The commands tput setaf change the color. Take a look to the man pages of tput and terminfo to learn more.

Of course there are many more options. Here there is a more complete reference in this respect. By the way, it is a good idea to modify this variable in the .bash_profile file in your home directory :)