feat(wezterm): add module for wezterm

Enable it for `homix`
This commit is contained in:
reo101 2023-02-21 23:31:38 +02:00
parent 0fac8b394e
commit bd2df72ebc
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
7 changed files with 217 additions and 30 deletions

View file

@ -5,4 +5,5 @@
# List your module files here
# my-module = import ./my-module.nix;
reo101-shell = import ./reo101-shell.nix;
reo101-wezterm = import ./reo101-wezterm;
}

View file

@ -0,0 +1,47 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.reo101.wezterm;
in
{
imports =
[
];
options =
{
reo101.wezterm = {
enable = mkEnableOption "reo101 wezterm setup";
extraConfig = mkOption {
type = types.str;
description = "Extra zsh config";
default = ''
'';
};
};
};
config =
mkIf cfg.enable {
home.packages = with pkgs;
builtins.concatLists [
[
wezterm
(nerdfonts.override { fonts = [ "FiraCode" ]; })
]
];
programs.wezterm = {
enable = true;
extraConfig = builtins.concatStringsSep "\n" [
(builtins.readFile ./wezterm.lua)
cfg.extraConfig
];
};
};
meta = {
maintainers = with lib.maintainers; [ reo101 ];
};
}

View file

@ -0,0 +1,128 @@
local M = {}
local wezterm = require("wezterm")
----------
-- Font --
----------
M.font = wezterm.font("FiraCode Nerd Font Mono")
------------------
-- Font options --
------------------
M.harfbuzz_features = {
"liga",
"cv02",
"cv19",
"cv25",
"cv26",
"cv28",
"cv30",
"cv32",
"ss02",
"ss03",
"ss05",
"ss07",
"ss09",
"zero",
}
--------------------
-- Font rendering --
--------------------
M.freetype_render_target = "Light"
------------------
-- Cursor style --
------------------
-- M.default_cursor_style = "BlinkingBar"
--------------------
-- Window options --
--------------------
-- M.window_background_opacity = 0.2
M.text_background_opacity = 1.0
-- M.window_background_image = "/home/reo101/.local/share/bg/ide_bg.jpeg"
M.window_decorations = "NONE"
M.window_close_confirmation = "NeverPrompt"
M.use_resize_increments = false
M.enable_scroll_bar = false
M.adjust_window_size_when_changing_font_size = false
M.window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
}
-------------
-- Tab bar --
-------------
M.enable_tab_bar = false
--------------
-- Keybinds --
--------------
local function keybind(mods, key, action)
if type(action) == "table" then
action = wezterm.action(action)
end
return {
mods = mods,
key = key,
action = action,
}
end
M.disable_default_key_bindings = true
M.keys = {
---------------
-- Clipboard --
---------------
keybind("ALT", "c", { CopyTo = "Clipboard" }),
keybind("ALT", "v", { PasteFrom = "Clipboard" }),
---------------
-- Font size --
---------------
keybind("ALT|SHIFT", "UpArrow", "IncreaseFontSize"),
keybind("ALT|SHIFT", "DownArrow", "DecreaseFontSize"),
------------
-- Scroll --
------------
keybind("ALT", "u", { ScrollByPage = -1 }),
keybind("ALT", "d", { ScrollByPage = 1 }),
------------
-- Reload --
------------
keybind("CTRL|SHIFT", "r", "ReloadConfiguration"),
}
-----------
-- Links --
-----------
M.hyperlink_rules = {
-- Linkify things that look like URLs
-- This is actually the default if you don't specify any hyperlink_rules
{
regex = "\\b\\w+://(?:[\\w.-]+)\\.[a-z]{2,15}\\S*\\b",
format = "$0",
},
-- linkify email addresses
{
regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b",
format = "mailto:$0",
},
-- file:// URI
{
regex = "\\bfile://\\S*\\b",
format = "$0",
},
}
return M