Blog Entry 3 years, 2 months ago

A lazy way to start your working session

How do you usually start the coding session after booting your machine? I mostly used console with Bash, Vim, MC,... so the typical routine was firing up every single tab then typing on it. Now, I think it's time to leverage the power of laziness.

The following Bash script will initialize 3 separate terminal tabs for:

  1. Starting DB & Django server
  2. Open vim at working directory
  3. Open MC at working directory

All the three above have virtualenv activated. So, all you have to do is just something like this:

$work my_project_name

You also can get the script at my repo:

sudo service postgresql start
xfce4-terminal \
  --tab -T EDITOR -e 'env PROMPT_COMMAND="unset PROMPT_COMMAND; workon '${1}'; vim" bash' \
  --tab -T MC -e 'env PROMPT_COMMAND="unset PROMPT_COMMAND; workon '${1}'; mc" bash'
env PROMPT_COMMAND="workon '${1}'; r" bash 
Recent Reads