liuhewei / run-app-sublime

Run or launch external applications, system commands, customized scripts from command pallete. Just like "!xxx" in VIM.
MIT License
11 stars 8 forks source link

[Feature request] Unsaved buffers support #8

Open Kristinita opened 7 years ago

Kristinita commented 7 years ago

1. Request

It would be nice, if users can run command, if they have unsaved buffer in current view.

2. Justification

More than 20 times in a day, I wrote text in unsaved buffers via next methods:

I run AutoHotkey scripts for my unsaved buffers.

3. Settings

Part of my Run App.sublime-commands file:

{
    "caption": "Run Apps: SublimeLinterCheck",
    "command": "runapp",
    "args":{
      "app": "D:\\AutoHotkey\\SublimeLinterCheck.exe"
    }
},

4. Steps to reproduce

I open any unsaved buffer → Ctrl+Shift+P (⌘⇧p for Mac) → Run Apps: SublimeLinterCheck.

5. Expected behavior

Successful run my D:\AutoHotkey\SublimeLinterCheck.exe file.

6. Actual behavior

command: runapp {"app": "D:\\AutoHotkey\\SublimeLinterCheck.exe"}
error: Save the buffer to a local file firstly

Thanks.

liuhewei commented 7 years ago

You're right. Currently, "run app" doesn't accept buffered text as a "target". There are only three types of target now: directory, file and project. The fourth target type can be added, "buffer" for example. Code can be added here: https://github.com/liuhewei/run-app-sublime/blob/master/runapp.py#L23

Actually, I'm not using SublimeText now. So I can't handle the request. Sorry for that.