GithubHelp home page GithubHelp logo

savecopyas's People

Contributors

nickhatboecker avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

savecopyas's Issues

Current mnemonics in Main.sublime-menu do not seem to work and will trigger warnings

Hi Nick!

Your current Main.sublime-menu is

[
    {
        "caption": "File",
        "mnemonic": "f",
        "id": "file",
        "children":
        [
            {
                "caption": "Save Copy As...",
                "mnemonic": "k",
                "command": "save_copy_as"
            }
        ]
    }
]

These mnemonics do not seem to work, and will trigger loads of warnings in the Sublime console (View --> Show Console)

warning: mnemonic f not found in menu caption File
warning: mnemonic k not found in menu caption Save Copy As...

The mechanism for a Sublime Text main menu mnemonic is that (for Windows only) the main menu will take a letter from the caption (case-sensitive) and underscore it and use the letter as a shortcut to be triggered by alt.

That is, you can only choose from letters S a v e C o p y A s as your mnemonic for the command save_copy_as.

And there is no need to assign a mnemonic or even a caption to File. It's already there. You don't want to override it.

I would like to suggest the change below for Main.sublime-menu

[
    {
        "id": "file",
        "children":
        [
            {
                "caption": "Save Copy As...",
                "mnemonic": "p",
                "command": "save_copy_as"
            }
        ]
    }
]

The exact choice of the letter is up to you, of course.

For your reference, my Sublime Text version is the latest Sublime Text 3, or 3.2.2 (build 3211).

Use native OS save as dialog

Wouldn't it be better to use the OS' native "save as" dialog, instead of an input panel?
I realize that there is no API to ask the user to choose a file, but wouldn't the following suffice?

import sublime
import sublime_plugin


class SaveCopyAsCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        previous_path = self.view.file_name()
        self.view.run_command('prompt_save_as')
        self.view.retarget(previous_path or '')

    def is_enabled(self):
        return self.view.file_name() is not None

i.e. let ST show it's normal Save As prompt, then set the view back to tracking the original file path

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.