Last Updated: February 25, 2016
·
1.954K
· hauleth

Start working in a second and save time for beer

As I'm Rails/Sinatra programmer in most cases beginning of work is:

  • running terminal
  • run $ cd workspace/some_awesome_as_usual_project
  • run $ gvim .
  • sometimes run also $ gvim some_file.rb

But why do not shorten this? Just copy this to your RC file:

alias  e="$EDITOR"
project() {
  cd $1 && e .
}

Now only thing you need is to:

  • run $ project workspace/some_awesome_as_usual_project
  • start hacking

You can also improve this to, i.e.:

  • add $WORKSPACE variable that will contain your workspace path and change to cd $WORKSPACE/$1
  • fetching Git repo adding git fetch
  • displaying Gil log
  • or something else useful in your hacker work

Enjoy your saved time with some beer :)

6 Responses
Add your response

I suggest to save even more time with alias pj=project
(Yes 10 ms per time, it's a lot of beer).

over 1 year ago ·

@gahtune My goal is to write tool that will read some config file inside that dir and run processes needed in development mode like Guard, DB process or something like that (maybe in screen processes).

over 1 year ago ·

@hauleth In brief you want to make your own IDE ;) It sounds simple, and hard at the same time.
You can do a kind of initscript to be called. But what will happen if you run two times your project command, the originally simple script will need to handle a lot of cases (DB already up, ...)
And if you go like you suggest with a config file, you will need to design a general interface for a broad number of type of processes.

over 1 year ago ·

@gahtune not IDE. A tool like Rake or Capistrano that will only manage projects and run required apps/daemons. No editor or something like that. You should use editor of your choice (I use Vim and I'm happy).

over 1 year ago ·

@hauleth A tools who manage projects and environment, it's an IDE (Integrated Developpement Environment). The fact that you want to use vim or another editor doesn't change the definition ! It will be a cool IDE. Keep me up to date when you finish this project.

over 1 year ago ·

@hauleth, check out https://github.com/tmuxinator/tmuxinator .. it allows u to run commands on a different screen like rails server and guard though a config file... :)

over 1 year ago ·