Custom commands based on file extension

Is it possible in process-palette package or atom-shell-commands to

(i) Match the extension of current file with predefined prefix(say tex)
(i) Define multiple commands(bash based) in response to the matching extension.

process-palette or atom-shell-commands can’t do it for you alone, but you can define a command in that has access to multiple other commands and will run one of them based on the extension. If you give me a use case, with two or more commands and two or more extensions, I can give you the code to make that happen.

Just fortran and python files. I would like to bind command to some keyboard shortcut to run it one i completed the code.

Those are languages, not extensions. I know what file extension Python uses, but I don’t use Fortran. What commands do you want to run?

Let us focus on python and C languages. Python uses .py and C .C. Python uses command(python filename) and C(gcc -o filename file;./filename).

Is it possible to write all these commands in one script file that gets loaded by on startup.

You don’t want the raw command line instructions in You can, but that’s what both of the packages you’ve mentioned are there to do. You want to set up commands in one of those packages that Atom can handle natively, then use atom.commands.dispatch(). What are you calling the commands?

In fact, i do not want to install each and every package with unnecessary options(debugging, commenting etc) that increases load-time of atom. Just one script file that checks the extension of file and simply compile the document.

I have achieved the same in gedit, but its lack of project-viewer forced me to switch to atom.

My pennyworth. You can, if you wish, open any file in project folder and pass the filepath into gedit to apply the filters you have tested. I am using a similar ploy to pass filepath to external twin panel File Manager (Krusader) since the Atom default “Show in File Manager” (Nautilus) does not meet my needs. In short, consider using Atom in concert with other tools you are familiar with.

I shall prefer working in atom solo. This will advance the capability of atom much further and decrease the reliance on other packages.

Then I would try running a python script which tests file extension and then calls different methods based on extension.

It is great. Anyway where can i learn programming, if it is the right tool for current problem.

Packages are able to use activation hooks, meaning they can delay activation until a command or specific grammar is used. They are not forced to use this, but many language specific packages will.

I’m unclear about where this came from. You said that you were looking at using process-palette or atom-shell-commands. I never told you to install every package, I just asked you what you wanted to call the commands so that I could give you code for exactly what you need.