New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass file type to "Send Selection" commands #2156
Comments
I thought I remembered an Issue or Pull Request to pass certain information like this to commands using environment variables, but I can't find it. |
@codebrainz might be thinking of templates commands where environment variables and set, but custom commands do not seem to do so. I tend to prefer the command arguments approach over the environment variables since no existing command will understand the |
A better solution would be to add an option in build menu to reload the document after a command execution ( |
Build commands are intended to operate off saved files and the output is parsed for error messages, not to replace the contents. Prettification is something that the custom commands are intended to handle as they get the contents of the buffer or selection (not a saved file) and replace them in the buffer with the command output, exactly what you want because it doesn't overwrite your file until you are satisfied with it and hit save. All it needs is, as was originally requested, the ability to pass some filetype information to the command so the correct prettifying is applied. If the command doesn't do that or if you want to choose between different commands, a script can do it based on the filetype passed to it. |
How can I use "Send selection to" based on file type? At this time I'm have multiple shortcuts, for example:
prettify json CTRL+1 -->
prettier --parser json
prettify css CTRL+2 -->
prettier --parser css
compact json CTRL+3 -->
minify --type json
compact css CTRL+4 -->
minify --type css
etc...
My idea is to have:
prettify CTRL+1 -->
prettier --parser %e
compact CTRL+2 -->
minify --type %e
where %e is the type of file.
Is there any existing solution?
The text was updated successfully, but these errors were encountered: