3a708b3e87ac

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 15 Jan 2014 17:54:40 -0500
parents 791da81abb65 (current diff) dca331c6bf8f (diff)
children 6f514cfd3988
branches/tags (none)
files keymando/keymandorc.rb

Changes

--- a/bin/sort-scala-imports	Wed Jan 15 17:54:29 2014 -0500
+++ b/bin/sort-scala-imports	Wed Jan 15 17:54:40 2014 -0500
@@ -18,42 +18,78 @@
 class ImportGroup(object):
     def __init__(self, line):
         self.main_line = line.rstrip()
+        self.prefix = None
         self.guts = []
 
+    def set_line(self):
+        """Set the main_line and guts for the given prefix and guts.
+
+        If the import will fit into 100 chars, the short group syntax will be
+        used.  Otherwise the longer one will be used.
+
+        """
+        prefix = self.prefix
+        guts = self.guts
+
+        if not prefix:
+            # This is just a single-line, single-item import, so we don't need
+            # to do any setup.
+            return
+
+        single = '%s{%s%s%s}' % (prefix,
+                                 bracket_padding,
+                                 ', '.join(guts),
+                                 bracket_padding)
+        if len(single) > 100:
+            self.main_line = prefix + '{'
+            self.guts = guts
+            self.guts.sort(key=lambda s: s.lower())
+        else:
+            self.main_line = single
+            self.guts = []
+
     def slurp(self):
         global l, bracket_padding
 
+        line = self.main_line
         if self.main_line.endswith('}'):
             # This is a line like: import foo.{ a, b, c }
             if bracket_padding is None:
-                if self.main_line[self.main_line.index("{") + 1] == " ":
+                if line[line.index("{") + 1] == " ":
                     bracket_padding = " "
                 else:
                     bracket_padding = ""
 
-            prefix, rest = self.main_line.split('{', 1)
+            prefix, rest = line.split('{', 1)
 
             guts = [item.strip() for item in
                     re.split(", +| +|,", rest.strip('{}, '))]
-            guts.sort(key=lambda s: s.lower())
+
+            self.prefix = prefix
+            self.guts = guts
 
-            self.main_line = '%s{%s%s%s}' % (prefix,
-                                             bracket_padding,
-                                             ', '.join(guts),
-                                             bracket_padding)
             l = next_line()
-        elif self.main_line.endswith('{'):
+        elif line.endswith('{'):
+            # This is the first line of a multi-line set
+            prefix = line.rstrip('{')
+            guts = []
             while True:
                 l = next_line()
                 if l.rstrip().endswith('}'):
                     l = next_line()
                     break
                 else:
-                    self.guts.append(l.strip().rstrip(','))
+                    guts.append(l.strip().rstrip(','))
+
+            self.prefix = prefix
+            self.guts = guts
         else:
+            # Just a normal single import line, pass it on.
             l = next_line()
 
     def spit(self):
+        self.set_line()
+
         sys.stdout.write(self.main_line + '\n')
 
         if self.guts:
@@ -71,6 +107,9 @@
     ig.slurp()
     imports.append(ig)
 
+if bracket_padding is None:
+    bracket_padding = " "
+
 imports.sort(key=lambda ig: ig.key())
 
 for i in imports:
--- a/keymando/keymandorc.rb	Wed Jan 15 17:54:29 2014 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-# Basic -----------------------------------------------------------------------
-start_at_login
-
-disable "Remote Desktop Connection"
-disable /VirtualBox/
-
-map "<Ctrl-m>", "<Cmd-Shift-/>"
-# map "<Ctrl-Shift-R>", lambda { reload() }
-
-# Application Switching -------------------------------------------------------
-map "<Ctrl-Shift-K>", lambda { activate('Firefox') }
-map "<Ctrl-Shift-P>", lambda { activate('Pixelmator') }
-map "<Ctrl-Shift-H>", lambda { activate('Pixen') }
-map "<Ctrl-Shift-O>", lambda { activate('Rdio') }
-map "<Ctrl-Shift-Y>", lambda { activate('Twitter') }
-
-map "<Ctrl-Shift-J>" do
-    activate('iTerm')
-    send('<Cmd-Option-2>')
-end
-map "<Ctrl-Shift-M>" do
-    activate('iTerm')
-    send('<Cmd-Option-1>')
-    send('<Ctrl-f>')
-    send('2')
-end
-map "<Ctrl-Shift-I>" do
-    activate('iTerm')
-    send('<Cmd-Option-1><Ctrl-f>1')
-end
-
-# Refresh ---------------------------------------------------------------------
-
-map "<Ctrl-Shift-R>" do
-  activate('Firefox')
-  send("<Cmd-r>")
-  send("<Cmd-Tab>")
-end
-
-# Leader ----------------------------------------------------------------------
-# map "<Ctrl-,>" do
-#     input()
-# end
-
-# Abbreviations ---------------------------------------------------------------
-
-# abbrev 'ldis' do
-#   send('ಠ_ಠ')
-# end
--- a/keyremap4macbook/private.xml	Wed Jan 15 17:54:29 2014 -0500
+++ b/keyremap4macbook/private.xml	Wed Jan 15 17:54:40 2014 -0500
@@ -1115,6 +1115,67 @@
 
             </item>
         </item>
+        <item>
+            <name>F-Zero</name>
+            <appendix>This mode makes the F key (yes, the vanilla F key) enter a separate mode when held.</appendix>
+            <appendix>It's useful to add another layer to your keyboard with a super-easy key.</appendix>
+
+            <identifier>f_zero.enable</identifier>
+
+            <autogen>--KeyOverlaidModifier-- KeyCode::F, KeyCode::VK_MODIFIER_EXTRA2, KeyCode::F</autogen>
+            <autogen>__KeyToKey__ KeyCode::H, ModifierFlag::EXTRA2, KeyCode::CURSOR_LEFT</autogen>
+            <autogen>__KeyToKey__ KeyCode::J, ModifierFlag::EXTRA2, KeyCode::CURSOR_DOWN</autogen>
+            <autogen>__KeyToKey__ KeyCode::K, ModifierFlag::EXTRA2, KeyCode::CURSOR_UP</autogen>
+            <autogen>__KeyToKey__ KeyCode::L, ModifierFlag::EXTRA2, KeyCode::CURSOR_RIGHT</autogen>
+
+            <autogen>__KeyToKey__ KeyCode::A, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::A</autogen>
+            <autogen>__KeyToKey__ KeyCode::B, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::B</autogen>
+            <autogen>__KeyToKey__ KeyCode::C, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::C</autogen>
+            <!-- <autogen>__KeyToKey__ KeyCode::D, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::D</autogen> -->
+            <autogen>__KeyToKey__ KeyCode::E, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::E</autogen>
+            <autogen>__KeyToKey__ KeyCode::F, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::F</autogen>
+            <autogen>__KeyToKey__ KeyCode::G, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::G</autogen>
+            <!-- <autogen>__KeyToKey__ KeyCode::H, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::H</autogen> -->
+            <autogen>__KeyToKey__ KeyCode::I, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::I</autogen>
+            <!-- <autogen>__KeyToKey__ KeyCode::J, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::J</autogen> -->
+            <!-- <autogen>__KeyToKey__ KeyCode::K, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::K</autogen> -->
+            <!-- <autogen>__KeyToKey__ KeyCode::L, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::L</autogen> -->
+            <autogen>__KeyToKey__ KeyCode::M, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::M</autogen>
+            <autogen>__KeyToKey__ KeyCode::N, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::N</autogen>
+            <autogen>__KeyToKey__ KeyCode::O, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::O</autogen>
+            <autogen>__KeyToKey__ KeyCode::P, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::P</autogen>
+            <autogen>__KeyToKey__ KeyCode::Q, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::Q</autogen>
+            <autogen>__KeyToKey__ KeyCode::R, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::R</autogen>
+            <autogen>__KeyToKey__ KeyCode::S, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::S</autogen>
+            <autogen>__KeyToKey__ KeyCode::T, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::T</autogen>
+            <autogen>__KeyToKey__ KeyCode::U, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::U</autogen>
+            <autogen>__KeyToKey__ KeyCode::V, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::V</autogen>
+            <autogen>__KeyToKey__ KeyCode::W, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::W</autogen>
+            <autogen>__KeyToKey__ KeyCode::X, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::X</autogen>
+            <autogen>__KeyToKey__ KeyCode::Y, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::Y</autogen>
+            <autogen>__KeyToKey__ KeyCode::Z, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::Z</autogen>
+
+            <autogen>__KeyToKey__ KeyCode::SPACE, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::SPACE</autogen>
+            <autogen>__KeyToKey__ KeyCode::DELETE, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::DELETE</autogen>
+            <autogen>__KeyToKey__ KeyCode::RETURN, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::RETURN</autogen>
+            <autogen>__KeyToKey__ KeyCode::TAB, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::TAB</autogen>
+            <autogen>__KeyToKey__ KeyCode::BACKSLASH, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::BACKSLASH</autogen>
+            <autogen>__KeyToKey__ KeyCode::COMMA, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::COMMA</autogen>
+            <autogen>__KeyToKey__ KeyCode::DOT, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::DOT</autogen>
+            <autogen>__KeyToKey__ KeyCode::SEMICOLON, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::SEMICOLON</autogen>
+            <autogen>__KeyToKey__ KeyCode::BRACKET_LEFT, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::BRACKET_LEFT</autogen>
+            <autogen>__KeyToKey__ KeyCode::BRACKET_RIGHT, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::BRACKET_RIGHT</autogen>
+            <autogen>__KeyToKey__ KeyCode::QUOTE, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::QUOTE</autogen>
+            <autogen>__KeyToKey__ KeyCode::SHIFT_R, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::KEY_0, ModifierFlag::SHIFT_L</autogen>
+            <autogen>__KeyToKey__ KeyCode::SHIFT_L, ModifierFlag::EXTRA2, KeyCode::F, KeyCode::KEY_9, ModifierFlag::SHIFT_L</autogen>
+
+            <!-- <autogen>__KeyOverlaidModifier__ KeyCode::D, ModifierFlag::EXTRA2, KeyCode::VK_MODIFIER_EXTRA1, KeyCode::D</autogen> -->
+            <!-- <autogen>__KeyToKey__ KeyCode::H, ModifierFlag::EXTRA1, KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L</autogen> -->
+            <!-- <autogen>__KeyToKey__ KeyCode::J, ModifierFlag::EXTRA1, KeyCode::CURSOR_DOWN, ModifierFlag::OPTION_L</autogen> -->
+            <!-- <autogen>__KeyToKey__ KeyCode::K, ModifierFlag::EXTRA1, KeyCode::CURSOR_UP, ModifierFlag::OPTION_L</autogen> -->
+            <!-- <autogen>__KeyToKey__ KeyCode::L, ModifierFlag::EXTRA1, KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_L</autogen> -->
+
+        </item>
     </list>
 </root>