Since your goal is (likely) to reduce typing, you could define an alias or a simple shell script for sublime,
alias s='subl'
#or
alias sb='subl'
Or you could get fancy, and use a shell script named 's
', or 'sb
' (save in your ~/bin/
in your PATH),
#!/bin/bash
subl $*
Either one of the above results in a shortened command line,
> s myfile.c
Which is longer than your desired (by 2 characters),
> myfile.c
Or you could get really fancy, and insert a shbang (#!
) line as the first line of all of your .c
files, make the file executable, and evoke the above edit script. This would mean rewriting your makefiles to first pre-process away the shbang line, prior to compilation.
Save this as 'myfile.cs
'
#!~/bin/subl myfile.cs
#include <stdio.h>
int main() { printf("hello, world\n"); }
To demonstrate how this would work, save the following file, 'stuff.cs
'
#!/usr/bin/vi stuff.sh
//this is a file
//that you can edit with sublime
int main() { printf("hello, world\n"); }
Then run it,
./fubar.cs
The latter solution does exactly what you want, but requires considerably more typing, and pre-processing overhead.