Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Does anybody have ideas about using emacs/ vim key binding for Preview.app to browser pdf files and how?

share|improve this question
1  
What exact keybindings are you looking for? To browse PDF files you can already easily use ⌥↑ or ⌥↓, for example. –  slhck Jan 4 '13 at 9:46

3 Answers 3

up vote 1 down vote accepted

You can edit the "Up" and "Down" keyboard shortcuts by going to System Preferences / Keyboard / Application Shortcuts, add a new shortcut for Preview.app. I've mapped Option-J to down, Option-K to up. It won't let you map just J and K, for some reason. But at least you can now browse a PDF without leaving the home row.

share|improve this answer
    
This is a great tip! If only there was a way to get it to scroll smoothly. I always lose track of where I was when going a full page down. –  sjy May 22 '14 at 11:37
    
@sjy, I couldn't apply this solution. What should I type as a "Menu Title" when setting the shortcuts for "Down" and "Up"? –  moonnoon Jun 19 at 20:44

As @tty suggested, using Karabiner is brilliant. I made some extra rules. You can navigate using HJKL and zoom using FDER. Read the file for more info.

Here is my private.xml:

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>PREVIEW</appname>
    <equal>com.apple.preview</equal>
  </appdef>

  <item>
    <name>Vi Navigation in Preview</name>
    <identifier>private.preview.vinav</identifier>
    <only>PREVIEW</only>
    <uielementrole_not>AXTextField, AXTextArea</uielementrole_not>
    <modifier_only>
        ModifierFlag::NONE,
        ModifierFlag::SHIFT_L | ModifierFlag::NONE,
        ModifierFlag::SHIFT_R | ModifierFlag::NONE,
    </modifier_only>
    <appendix>Navigate using the HJKL keys</appendix>
    <autogen>__KeyToKey__ KeyCode::J, KeyCode::CURSOR_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::K, KeyCode::CURSOR_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::H, KeyCode::CURSOR_LEFT</autogen>
    <autogen>__KeyToKey__ KeyCode::L, KeyCode::CURSOR_RIGHT</autogen>
  </item>

  <item>
    <name>Vi Zoom in Preview</name>
    <identifier>private.preview.vizoom</identifier>
    <only>PREVIEW</only>
    <uielementrole_not>AXTextField, AXTextArea</uielementrole_not>
    <modifier_only>
        ModifierFlag::NONE,
        ModifierFlag::SHIFT_L | ModifierFlag::NONE,
        ModifierFlag::SHIFT_R | ModifierFlag::NONE,
    </modifier_only>
    <appendix>Zoom using E/R: out/in</appendix>
    <appendix>Zoom to fit: F</appendix>
    <appendix>Zoom to 100%: D</appendix>
    <autogen>__KeyToKey__ KeyCode::F, KeyCode::KEYPAD_9, VK_COMMAND</autogen>
    <autogen>__KeyToKey__ KeyCode::D, KeyCode::KEYPAD_0, VK_COMMAND</autogen>
    <autogen>__KeyToKey__ KeyCode::R, KeyCode::KEYPAD_PLUS, VK_COMMAND</autogen>
    <autogen>__KeyToKey__ KeyCode::E, KeyCode::KEYPAD_MINUS, VK_COMMAND</autogen>
  </item>
</root>
share|improve this answer

Use this

Very excellent!!!

I found it recently.

https://pqrs.org/macosx/keyremap4macbook/index.html.en

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

2  
Answers on Ask Different need to be more than just a link. It's okay to include a link, but please also show how the recommended product can actually be used to solve the problem described in the question. The more specific an answer is in regards of the question, the more useful it is for others. –  patrix Jan 23 '14 at 7:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.