Git Product home page Git Product logo

Comments (8)

cknadler avatar cknadler commented on July 22, 2024

Opened a question on stack exchange and threw up a bounty.

http://apple.stackexchange.com/questions/115675

from vim-anywhere.

cknadler avatar cknadler commented on July 22, 2024

Found some great resources and made general progress.

First of all, the property list that contains this shortcut is pbs:

$ defaults read pbs
{
    NSServicesStatus =     {
        "(null) - VimAnywhere - runWorkflowAsService" =         {
            "key_equivalent" = "@^v";
        };
        "org.vim.MacVim - MacVim/New MacVim Buffer Here - newFileHere" =         {
            "enabled_context_menu" = 0;
            "enabled_services_menu" = 0;
        };
    };
}

Now, being as this is a nested property list, it isn't really easy to edit it via the command line. Even if you read the entire property as it is now, process it and modify it, writing it back becomes another problem.

Apparently, you can also do this in pure applescript (which terrifies me, but I'm going to give it a shot).

scpt way: https://discussions.apple.com/thread/4709713?tstart=0

from vim-anywhere.

cknadler avatar cknadler commented on July 22, 2024

Something like:

set theServiceName to "(null) - Print to PDF - runWorkflowAsService"
set libPrefPath to POSIX path of (path to preferences folder from user domain as text)
set PlistFile to "pbs.plist"
set PlistPath to libPrefPath & PlistFile as text
set mainPropertyItem to "NSServicesStatus"
set theKey to "key_equivalent"

tell application "System Events"

    set gp to (get property list item theServiceName of property list item mainPropertyItem of property list file PlistPath)

    tell gp
        --set value of property list item "enabled_services_menu" to true
        --set value of property list item "enabled_context_menu" to true
        set value of property list item theKey to "@^h"

    end tell

end tell

do shell script " defaults read " & quoted form of PlistPath

though I can't exactly get this to work.

from vim-anywhere.

cknadler avatar cknadler commented on July 22, 2024

New question up: http://apple.stackexchange.com/questions/115992/set-service-keyboard-shortcut-and-have-change-take-effect-programtically

from vim-anywhere.

cknadler avatar cknadler commented on July 22, 2024

Would be over the moon if anyone could figure this one out. I never could quite get it to work on OSX.

from vim-anywhere.

jgrasser avatar jgrasser commented on July 22, 2024

Enabling the shortcut via System Preferences results in this entry appearing in the Mac OS X user defaults system :

$ defaults read pbs
{
    NSServicesStatus =     {
        "(null) - VimAnywhere - runWorkflowAsService" = {
             "key_equivalent" = "@^v";
        };   
        "org.vim.MacVim - MacVim/New MacVim Buffer With Selection - openSelection" =         {
            "key_equivalent" = "@^v";
        };
    };
}

You can add this manually by running the following:

$ defaults write pbs NSServicesStatus '{     
        "(null) - VimAnywhere - runWorkflowAsService" = {
             "key_equivalent" = "@^v";
        };                                                                 
        "org.vim.MacVim - MacVim/New MacVim Buffer With Selection - openSelection" =         {
            "key_equivalent" = "@^v";
        };
  }'

Is this an acceptable solution? I am not entirely familiar with MacOSX so this answer might be incomplete, or incorrect.

from vim-anywhere.

cknadler avatar cknadler commented on July 22, 2024

Following up in #74.

from vim-anywhere.

cknadler avatar cknadler commented on July 22, 2024

Closed by #74

from vim-anywhere.

Related Issues (20)

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.