From 0c6faa074fbba157b8e2cc5b7b5e8c5c16cca9e1 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Wed, 19 Apr 2023 15:50:15 -0500 Subject: [PATCH] mark these as lua for Helix --- dotfiles/hammerspoon/default.nix | 134 ++++++++++++++++--------------- dotfiles/wezterm/default.nix | 102 +++++++++++------------ 2 files changed, 120 insertions(+), 116 deletions(-) diff --git a/dotfiles/hammerspoon/default.nix b/dotfiles/hammerspoon/default.nix index c06b667..9fb4db4 100644 --- a/dotfiles/hammerspoon/default.nix +++ b/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; } diff --git a/dotfiles/wezterm/default.nix b/dotfiles/wezterm/default.nix index 3c5fb78..793b80e 100644 --- a/dotfiles/wezterm/default.nix +++ b/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", + }, }, - }, - } - ''; + } + ''; }