Last active
August 29, 2015 14:03
-
-
Save iansinnott/2cbecf87d9273a0d5918 to your computer and use it in GitHub Desktop.
Move windows around using Vim-style hotkeys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ~/.hydra/init.lua | |
-- This file requires boosh.lua, which can be found in my dotfiles: | |
-- https://github.com/iansinnott/dotfiles/tree/master/dotfiles/hydra | |
require "boosh" | |
-- The 'meta' key for window actions will be cmd+shift. | |
local meta = {"cmd", "shift"} | |
--- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- | |
-- Dropdown GUI Menu | |
--- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- | |
menu.show(function() | |
return { | |
-- Reload this file | |
{title = "Reload Config", fn = hydra.reload}, | |
-- Menu horizontal rule | |
{title = "-"}, | |
-- open a repl | |
-- the repl is a Lua prompt; type "print('hello world')" | |
{title = "Open REPL...", fn = repl.open}, | |
-- Miscellaneous Hydra commands | |
{title = "-"}, | |
{title = "About", fn = hydra.showabout}, | |
{title = "Quit Hydra", fn = os.exit}, | |
} | |
end) | |
--- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- | |
-- Window Manipulation Functions | |
--- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- | |
-- Full Screen | |
hotkey.bind(meta, "M", ext.grid.maximize_window) | |
-- Push or resize the window in a direction | |
hotkey.bind(meta, 'H', function() ext.grid.send_or_resize('left') end) | |
hotkey.bind(meta, 'J', function() ext.grid.send_or_resize('down') end) | |
hotkey.bind(meta, 'K', function() ext.grid.send_or_resize('up') end) | |
hotkey.bind(meta, 'L', function() ext.grid.send_or_resize('right') end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment