Sublime Forum

[Solved] Control click to open with default application

#1

Hi everyone,

I’m new here so please, told me if this is not the place for the question/has been answered already (couldn’t find it myself)

So, the problem is easy but I think the solution is not: I mostly use Markdown and plain text for code in ST3 projects. During my work, I need to open multiple non text files, especially images, HTML and pdf.

Now I’m using right-click + Open with Default Application for pdf and HTML. Images open directly in ST3 with a click. Is not the slowest thing in the world but I’ve been looking for a way to open those with double click or CTRL-click (I think this is better for current ST3 behavior). Until now forums and Google have been a great place to look for ST3 related answers, but I can’t find a way for this. I’m afraid that the negative result of my search is that is not even possible.

Can someone guide me to some configuration, package?

Thanks in advance!

0 Likes

#2

If you use the Open with Default Application plugin, you can alter your mousemap and add an extra binding, for example:

	{
		"button": "button2", "modifiers": ["ctrl", "super"],
		"press_command": "open_default_for_current_view"
	},

that would open directly the file with that combination.

1 Like

#3

So fast! :smiley:

I’ve tried to apply your suggestion, but probably I’m doing something wrong.

As I’ve no *mousemap file, I’ve saved your code at

INSTALL_PATH/Sublime/User/Default (Linux).sublime-mousemap

and restart ST.

After some mouse, key combinations, have no success at all. I’ve tried to save it also at settings file and keymap, with no success.

What I’m missing?

0 Likes

#4

The mousemap should be at ~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-mousemap, you should add the binding there. I tried it with a markdown file and it works, but not with pictures. I don’t know with pdf files.

1 Like

#5

Hi again friend!

The path and file you suggest are the ones I’m using. I wrongly write here my path, as is symlinked. Sorry about the confusion.

Anyway, I’ve checked that your code is in the file but I’m not able to make it work.

Finally, I’ve installed and configured the package non-text-files and it just works

Thank for you rhelp mg979! :smiley:

P.D.1:I’ve to edit title as solved or something? How I can give you some “community points”?

P.D.2: If anyone is interested just adding the following to my settings

"open_externally_patterns": [
    "*.jpg",
    "*.jpeg",
    "*.png",
    "*.gif",
    "*.zip",
    "*.pdf",
    "*.html"
]

make the pdf open in a single click.

0 Likes