Skip to content

Instantly share code, notes, and snippets.

@tj
Created September 5, 2012 04:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tj/3630787 to your computer and use it in GitHub Desktop.
Save tj/3630787 to your computer and use it in GitHub Desktop.
nshell profile
/**
* Module dependencies.
*/
var path = require('path')
// prompt
exports.PS1 = function(){
var dir = path.basename(process.cwd())
return ' λ ' + dir + ': '
}
// misc
shell.alias('ll', 'ls -la')
shell.alias('copy', 'pbcopy')
shell.alias('paste', 'pbpaste')
// editor
shell.alias('m', 'mate')
// make
shell.alias('mt', 'make test')
shell.alias('mc', 'make clean')
// npm
shell.alias('ni', 'npm install')
shell.alias('np', 'npm publish')
// burl
shell.alias('GET', 'burl GET')
shell.alias('HEAD', 'burl -I')
shell.alias('POST', 'burl POST')
shell.alias('PUT', 'burl PUT')
shell.alias('PATCH', 'burl PATCH')
shell.alias('DELETE', 'burl DELETE')
shell.alias('DEL', 'burl DELETE')
shell.alias('OPTIONS', 'burl OPTIONS')
// git
shell.alias('gd', "git diff | mate")
shell.alias('ga', "git add")
shell.alias('gs', "git summary")
shell.alias('gbd', "git branch -D")
shell.alias('gst', "git status")
shell.alias('gc', "git commit -m")
shell.alias('gca', "git commit -a -m")
shell.alias('gm', "git merge --no-ff")
shell.alias('gpt', "git push --tags")
shell.alias('gp', "git push")
shell.alias('gpr', "git pull-request")
shell.alias('grh', "git reset --hard")
shell.alias('gb', "git branch")
shell.alias('gcob', "git checkout -b")
shell.alias('gco', "git checkout")
shell.alias('gba', "git branch -a")
shell.alias('gcp', "git cherry-pick")
shell.alias('gl', "git log --pretty', 'format:%Cgreen%h%Creset %an - %s' --graph")
shell.alias('docs', "rm -fr /tmp/docs && cp -fr docs /tmp/docs && git checkout gh-pages && cp -fr /tmp/docs/* .")
shell.alias('gpom', "git pull origin master")
shell.alias('gcd', 'cd "`git rev-parse --show-toplevel`"')
@juliangruber
Copy link

shell is not defined

@drudge
Copy link

drudge commented Sep 5, 2012

What do you think of something like:

var basename = require('path').basename
  , host = require('os').hostname().split('.')[0];


exports.PS1 = function(){
  var cwd = process.cwd();
  var dir = process.env.HOME == cwd? '~' : basename(cwd);
  return host + ': \033[35m' + dir + '\033[m> ';
};

@tj
Copy link
Author

tj commented Sep 5, 2012

@juliangruber I had a bug you have to use master for now (cant remember if I even published to npm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment