lundi 21 janvier 2013

The expr command

The expr command is used to evaluate an expression and output the corresponding value. It could be used for example to use the terminal as a calculator:

    $ expr 80 - 25
    $ expr 80 / 25
Note that there is a space between the different arguments, otherwise the expression might not be evaluated properly.
It can be used as well for string operations and boolean operations

    $ expr length "abc"
    $ expr 1 "&" 0

vendredi 18 janvier 2013

Working with multiple files in vim

There is a couple of useful commands that can be used to work with multiple files as tabs. I've mentioned them in a stackoverflow answer:

  • Open a file in another tab

    :tabe filepath
  • save the current session in order to be able to open the same set of files again

    :mksession session_name.vim
  •  navigate between different tabs

    gt: next tab
    gT: previous tab
  • close all tabs at once

  • open a saved session

    vim -S session_name.vim