Skip to content

Commit

Permalink
mark these as lua for Helix
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Apr 19, 2023
1 parent 0c40a02 commit 0c6faa0
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 116 deletions.
134 changes: 68 additions & 66 deletions dotfiles/hammerspoon/default.nix
@@ -1,81 +1,83 @@
{ pkgs, ... }: {
home.file.".hammerspoon/init.lua".text = ''
hyper = {"cmd", "alt", "ctrl", "shift"}
function resizeToCursorScreen(modifyDimensions)
local win = hs.window.focusedWindow()
local windowFrame = win:frame()
local screen = hs.mouse.getCurrentScreen()
local screenFrame = screen:frame()
modifyDimensions(windowFrame, screenFrame)
win:moveToScreen(screen)
win:setFrame(windowFrame)
end
function resizeToCursorScreenOnGrid(gridColumns, gridRows, xOffset, yOffset, width, height)
resizeToCursorScreen(function(windowFrame, screenFrame)
local segmentsW = screenFrame.w / gridColumns
local segmentsH = screenFrame.h / gridRows
windowFrame.x = screenFrame.x + xOffset * segmentsW
windowFrame.y = screenFrame.y + yOffset * segmentsH
windowFrame.w = segmentsW * width
windowFrame.h = segmentsH * height
home.file.".hammerspoon/init.lua".text =
# lua
''
hyper = {"cmd", "alt", "ctrl", "shift"}
function resizeToCursorScreen(modifyDimensions)
local win = hs.window.focusedWindow()
local windowFrame = win:frame()
local screen = hs.mouse.getCurrentScreen()
local screenFrame = screen:frame()
modifyDimensions(windowFrame, screenFrame)
win:moveToScreen(screen)
win:setFrame(windowFrame)
end
function resizeToCursorScreenOnGrid(gridColumns, gridRows, xOffset, yOffset, width, height)
resizeToCursorScreen(function(windowFrame, screenFrame)
local segmentsW = screenFrame.w / gridColumns
local segmentsH = screenFrame.h / gridRows
windowFrame.x = screenFrame.x + xOffset * segmentsW
windowFrame.y = screenFrame.y + yOffset * segmentsH
windowFrame.w = segmentsW * width
windowFrame.h = segmentsH * height
end)
end
hs.hotkey.bind(hyper, "F", function()
resizeToCursorScreen(function(windowFrame, screenFrame)
windowFrame.x = screenFrame.x
windowFrame.y = screenFrame.y
windowFrame.w = screenFrame.w
windowFrame.h = screenFrame.h
end)
end)
end
hs.hotkey.bind(hyper, "F", function()
resizeToCursorScreen(function(windowFrame, screenFrame)
windowFrame.x = screenFrame.x
windowFrame.y = screenFrame.y
windowFrame.w = screenFrame.w
windowFrame.h = screenFrame.h
end)
end)
hs.hotkey.bind(hyper, "M", function()
resizeToCursorScreenOnGrid(6, 6, 1, 1, 4, 4)
end)
hs.hotkey.bind(hyper, "M", function()
resizeToCursorScreenOnGrid(6, 6, 1, 1, 4, 4)
end)
hs.hotkey.bind(hyper, "Z", function()
resizeToCursorScreenOnGrid(6, 6, 1, 0, 4, 5)
end)
hs.hotkey.bind(hyper, "Z", function()
resizeToCursorScreenOnGrid(6, 6, 1, 0, 4, 5)
end)
hs.hotkey.bind(hyper, "S", function()
resizeToCursorScreenOnGrid(6, 6, 0, 0, 6, 4)
end)
hs.hotkey.bind(hyper, "S", function()
resizeToCursorScreenOnGrid(6, 6, 0, 0, 6, 4)
end)
hs.hotkey.bind(hyper, "T", function()
resizeToCursorScreenOnGrid(6, 6, 0, 4, 6, 2)
end)
hs.hotkey.bind(hyper, "T", function()
resizeToCursorScreenOnGrid(6, 6, 0, 4, 6, 2)
end)
hs.hotkey.bind(hyper, "Left", function()
resizeToCursorScreenOnGrid(2, 1, 0, 0, 1, 1)
end)
hs.hotkey.bind(hyper, "Left", function()
resizeToCursorScreenOnGrid(2, 1, 0, 0, 1, 1)
end)
hs.hotkey.bind(hyper, "Right", function()
resizeToCursorScreenOnGrid(2, 1, 1, 0, 1, 1)
end)
hs.hotkey.bind(hyper, "Right", function()
resizeToCursorScreenOnGrid(2, 1, 1, 0, 1, 1)
end)
hs.hotkey.bind(hyper, "Up", function()
resizeToCursorScreenOnGrid(1, 2, 0, 0, 1, 1)
end)
hs.hotkey.bind(hyper, "Up", function()
resizeToCursorScreenOnGrid(1, 2, 0, 0, 1, 1)
end)
hs.hotkey.bind(hyper, "Down", function()
resizeToCursorScreenOnGrid(1, 2, 0, 1, 1, 1)
end)
hs.hotkey.bind(hyper, "Down", function()
resizeToCursorScreenOnGrid(1, 2, 0, 1, 1, 1)
end)
hs.hotkey.bind(hyper, "C", function()
local win = hs.window.focusedWindow()
local screen = hs.mouse.getCurrentScreen()
win:centerOnScreen(screen)
end)
hs.hotkey.bind(hyper, "C", function()
local win = hs.window.focusedWindow()
local screen = hs.mouse.getCurrentScreen()
win:centerOnScreen(screen)
end)
hs.loadSpoon("ReloadConfiguration")
spoon.ReloadConfiguration:start()
'';
hs.loadSpoon("ReloadConfiguration")
spoon.ReloadConfiguration:start()
'';

home.file.".hammerspoon/Spoons".source = pkgs.hammerspoon.spoons;
}
102 changes: 52 additions & 50 deletions dotfiles/wezterm/default.nix
@@ -1,64 +1,66 @@
{ ... }: {
home.file.".config/wezterm/wezterm.lua".text = ''
local wezterm = require('wezterm');
home.file.".config/wezterm/wezterm.lua".text =
# lua
''
local wezterm = require('wezterm');
return {
-- anything in https://wezfurlong.org/wezterm/colorschemes/index.html
color_scheme = "nightfox",
window_background_opacity = 0.95,
return {
-- anything in https://wezfurlong.org/wezterm/colorschemes/index.html
color_scheme = "nightfox",
window_background_opacity = 0.95,
hide_tab_bar_if_only_one_tab = true,
hide_tab_bar_if_only_one_tab = true,
-- my Kinesis layout uses left alt as a hacked hyper key, and right alt for
-- an actual alt key everywhere. That means I want both of these to be
-- meta/esc.
send_composed_key_when_left_alt_is_pressed = false,
send_composed_key_when_right_alt_is_pressed = false,
use_dead_keys = false,
-- my Kinesis layout uses left alt as a hacked hyper key, and right alt for
-- an actual alt key everywhere. That means I want both of these to be
-- meta/esc.
send_composed_key_when_left_alt_is_pressed = false,
send_composed_key_when_right_alt_is_pressed = false,
use_dead_keys = false,
-- fonts
font = wezterm.font("JetBrains Mono"),
-- fonts
font = wezterm.font("JetBrains Mono"),
-- flare the cursor for visual bell instead of flashing the background
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = "CursorColor",
},
-- flare the cursor for visual bell instead of flashing the background
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = "CursorColor",
},
-- I never want to hear BEL, thanks
audible_bell = "Disabled",
-- I never want to hear BEL, thanks
audible_bell = "Disabled",
-- turn off the title bar (it doesn't do a lot and takes up a row or two of terminal output)
window_decorations = "RESIZE",
-- turn off the title bar (it doesn't do a lot and takes up a row or two of terminal output)
window_decorations = "RESIZE",
-- copy the "normal" stuff from wezterm in, plus customizations (noted in comments)
-- https://wezfurlong.org/wezterm/hyperlinks.html
hyperlink_rules = {
-- things that look like URLs
{
regex = "\\b\\w+://(?:[\\w.-]+)\\.[a-z]{2,15}\\S*\\b",
format = "$0",
},
-- copy the "normal" stuff from wezterm in, plus customizations (noted in comments)
-- https://wezfurlong.org/wezterm/hyperlinks.html
hyperlink_rules = {
-- things that look like URLs
{
regex = "\\b\\w+://(?:[\\w.-]+)\\.[a-z]{2,15}\\S*\\b",
format = "$0",
},
-- email addresses
{
regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b",
format = "mailto:$0",
},
-- email addresses
{
regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b",
format = "mailto:$0",
},
-- file:// URI
{
regex = "\\bfile://\\S*\\b",
format = "$0",
},
-- file:// URI
{
regex = "\\bfile://\\S*\\b",
format = "$0",
},
-- Linear task IDs
{
regex = "\\b([A-Z0-9]{3}-\\d+)\\b",
format = "https://linear.app/noredink/issue/$1",
-- Linear task IDs
{
regex = "\\b([A-Z0-9]{3}-\\d+)\\b",
format = "https://linear.app/noredink/issue/$1",
},
},
},
}
'';
}
'';
}

0 comments on commit 0c6faa0

Please sign in to comment.