microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.08k stars 29.21k forks source link

A way to open a file in hex editor from Terminal #206101

Open ppseprus opened 8 months ago

ppseprus commented 8 months ago

Is there a way to open a file in VSCode directly in hex editor?

me@macos $ code --hex ./a_random_file.ext

lramos15 commented 8 months ago

You can set a file extension to be opened by default with the hex editor.

That's this setting workbench.editorAssociations

ppseprus commented 8 months ago

I was considering random scenarios where file extensions might not be known ahead of time.

Then again, I guess I can still used xxd for those purposes...

lramos15 commented 8 months ago

@ppseprus There is also a setting to open all binary files as hex. Basically the only case we don't support is non binary files that you also don't know the extension for

connor4312 commented 8 months ago

A CLI option in VS Code itself to specify an edit to use when opening a requested file would make sense to me (e.g. alias hex="code --use-editor=hexEditor.hexedit"). Perhaps we transfer this as a feature request?

ppseprus commented 8 months ago

Yeah! That would be great! :)

hsfzxjy commented 8 months ago

I would like to PR for this.

connor4312 commented 8 months ago

Sure, PR welcome