Project specific keyboard shortcuts?

60 views
Skip to first unread message

Rainer Krug

unread,
Feb 3, 2022, 9:48:38 AM2/3/22
to BBEdit Talk
Hi

Is it possible, to run project / folder specific keyboard shortcuts?

In different projects I do different things regularly and would like to put these in the same keyboard shortcut.

Thanks,

Rainer

jj

unread,
Feb 3, 2022, 2:03:12 PM2/3/22
to BBEdit Talk
Hi Rainer,

This script looks for the existence of an optional .rainer.conf file in the parent directories.
If the file exists it reads it, parses it and acts in consequence.

Same logic could be applied based on project window names, document file types, document file languages, etc.

HTH

Jean Jourdain

--

    on readRainerConf(aFile)
        set vRainerConf to ".rainer.conf"
        tell application "Finder"
            set vContainer to container of file aFile
            repeat while true
                try
                    if exists file vRainerConf of vContainer then
                        set vConfFile to (file vRainerConf of vContainer) as alias
                        set vConfig to read vConfFile
                        return vConfig
                    end if
                    set vContainer to container of vContainer
                on error
                    exit repeat
                end try
            end repeat
            return missing value
        end tell
    end readRainerConf

    tell application "BBEdit"
        set vDocument to first document of first window
        if not vDocument's on disk then
            return
        end if
        -- Check for a configuration file.
        set vConfig to my readRainerConf(vDocument's file)
        -- Parse the the config and act appropriately.
        if vConfig contains "optionA" then
            set vCommand to "do A command"
        else if vConfig contains "optionB" then
            set vCommand to "do B command"
        else
            set vCommand to "do default command"
        end if
        display dialog vCommand
    end tell

Rainer Krug

unread,
Feb 4, 2022, 4:11:37 AM2/4/22
to BBEdit Talk
So no out of the box solution? Would be a nice feature to have.

Thanks for this. I am sure that this will work and I would enjoy fiddling with it for some time - but I fear it would cost me more time to implement this than to stick with what I have (which is the main reason I left emacs + org mode + gnus + ESS for R) behind - I was fiddling all the time and my setup became extremely complicated and I lost more time than I saved. Now I am using BBEdit, Apple Mail, and RStudio and do not want to jump into that rabbit hole again. But I will keep this in mind in case I need it more than a "nice to have".

Having said that, I still would like to have the option of per-project-settings, including shortcuts, in out-of-the-box BBEdit. 

Roland Küffner

unread,
Feb 11, 2022, 5:23:48 PM2/11/22
to BBEdit Talk
While not a solution to Rainers problem, I found the recently added "Go > Commands …" palette (resp. the default shortcut cmd+shift+U) a very helpful addition and usage pattern. For lesser used commands I find it much easier to type a few letters than remembering yet another dozen keyboard shortcuts.

To add also a suggestion on topic:
In BBEdit's Support Folder the current keybindings are saved in the "Setup" folder. ("Menu Shortcuts.xml" and "Not Menu Shortcuts.xml"). You could make backups for that files, adjust all shortcuts to your liking and than backup that files again. So, you could create "save files" for current shortcut settings for future use.
Of course that would mean reanaming and fumbling with setting files and opening a door that leads right down that dark tinkering abyss :-)

Roland

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/adbf1f2c-e8fd-4ac0-ac8b-5430880d6fb6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages