From 4983fb551ece9f3788987e50be650a262155c362 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Mon, 19 Dec 2022 22:02:48 +0100 Subject: [PATCH] Switch from kitty to wezterm --- home/config/nvim/nifoc/statusline.fnl | 25 +++++++++++------ home/config/nvim/plugins/nvim-lint.fnl | 2 +- home/config/wezterm/config.fnl | 37 +++++++++++++++++++++++++ home/hosts/Styx.nix | 2 +- home/programs/fish.nix | 21 ++++++++------ home/programs/wezterm.nix | 38 ++++++++++++++++++++++++++ system/darwin/fonts.nix | 11 ++++++-- 7 files changed, 114 insertions(+), 22 deletions(-) create mode 100644 home/config/wezterm/config.fnl create mode 100644 home/programs/wezterm.nix diff --git a/home/config/nvim/nifoc/statusline.fnl b/home/config/nvim/nifoc/statusline.fnl index 39e716c0..589b1b2 100644 --- a/home/config/nvim/nifoc/statusline.fnl +++ b/home/config/nvim/nifoc/statusline.fnl @@ -325,19 +325,28 @@ (set mod.scrollbar {:init (fn [self] (set self.current-line (get-current-line)) (set self.total-lines (get-total-lines))) - :static {:scrollbar-icons ["🭶" - "🭷" - "🭸" - "🭹" - "🭺" - "🭻"]} + :static {:scrollbar-icons-block ["▁" + "▂" + "▃" + "▄" + "▅" + "▆" + "▇" + "█"] + :scrollbar-icons-line ["🭶" + "🭷" + "🭸" + "🭹" + "🭺" + "🭻"]} :provider (fn [self] (let [i (+ (math.floor (* (/ (- self.current-line 1) self.total-lines) - (length self.scrollbar-icons))) + (length self.scrollbar-icons-block))) 1) - new-scrollbar (. self :scrollbar-icons + new-scrollbar (. self + :scrollbar-icons-block i)] (string.rep new-scrollbar 2))) :hl {:fg colors.purple}}) diff --git a/home/config/nvim/plugins/nvim-lint.fnl b/home/config/nvim/plugins/nvim-lint.fnl index 45912e6..94100e7 100644 --- a/home/config/nvim/plugins/nvim-lint.fnl +++ b/home/config/nvim/plugins/nvim-lint.fnl @@ -28,7 +28,7 @@ (when (not= project-root nil) (set checkstyle.config_file (.. project-root :/config/checkstyle/checkstyle.xml))) - (set fennel.globals [:vim])) + (set fennel.globals [:vim :wezterm])) ;; Configure Linters per FT (set lint.linters_by_ft {:dockerfile [:hadolint] :elixir [:credo] diff --git a/home/config/wezterm/config.fnl b/home/config/wezterm/config.fnl new file mode 100644 index 0000000..2e2c457 --- /dev/null +++ b/home/config/wezterm/config.fnl @@ -0,0 +1,37 @@ +(let [wezterm (require :wezterm)] + {:default_prog _G.default_shell + ;; Appearance + :color_scheme "Dracula (Official)" + :window_padding {:left :6px :right :6px :top :2px :bottom :4px} + :enable_tab_bar true + :use_fancy_tab_bar true + :hide_tab_bar_if_only_one_tab true + ;; Fonts + :font (wezterm.font_with_fallback [{:family "JetBrains Mono" + :weight :Medium} + "Symbols Nerd Font" + "Apple Symbols" + "Apple Color Emoji" + "Noto Sans Symbols" + "Noto Sans Symbols2" + :Unifont]) + :font_size 13 + :line_height 0.9 + :freetype_load_target :Light + ;:freetype_render_target :HorizontalLcd + ;; Mouse + :mouse_bindings [; Only select text and don't open hyperlinks + {:event {:Up {:streak 1 :button :Left}} + :mods :NONE + :action (wezterm.action {:ExtendSelectionToMouseCursor :Cell})} + ; Don't copy on double click + {:event {:Up {:streak 2 :button :Left}} + :mods :NONE + :action :Nop} + ; CMD-click to open a hyperlink + {:event {:Up {:streak 1 :button :Left}} + :mods :CMD + :action :OpenLinkAtMouseCursor}] + ;; Scrollback + :scrollback_lines 5000}) + diff --git a/home/hosts/Styx.nix b/home/hosts/Styx.nix index 8c6cf06..e912800 100644 --- a/home/hosts/Styx.nix +++ b/home/hosts/Styx.nix @@ -8,7 +8,7 @@ in ../programs/fish.nix ../programs/starship.nix ../programs/direnv.nix - ../programs/kitty.nix + ../programs/wezterm.nix ../programs/nvim diff --git a/home/programs/fish.nix b/home/programs/fish.nix index 0d832ef..4d68260 100644 --- a/home/programs/fish.nix +++ b/home/programs/fish.nix @@ -1,6 +1,8 @@ { pkgs, config, ... }: { + home.packages = [ pkgs.terminal-notifier ]; + programs.fish = { enable = true; @@ -27,13 +29,14 @@ }; } + # https://github.com/franciscolourenco/done/releases { name = "done-fish"; src = pkgs.fetchFromGitHub { - owner = "nifoc"; + owner = "franciscolourenco"; repo = "done"; - rev = "2f4e94d8306224f63cd12fb992318985a83d51a8"; - sha256 = "Pq8HEISGjpCTXBIyukcLUK8r1hJ3/QXAklRCesm4nQ0="; + rev = "1.16.5"; + sha256 = "sha256-E0wveeDw1VzEH2kzn63q9hy1xkccfxQHBV2gVpu2IdQ="; }; } @@ -43,8 +46,8 @@ src = pkgs.fetchFromGitHub { owner = "PatrickF1"; repo = "fzf.fish"; - rev = "v9.2"; - sha256 = "sha256-XmRGe39O3xXmTvfawwT2mCwLIyXOlQm7f40mH5tzz+s="; + rev = "v9.5"; + sha256 = "sha256-ZdHfIZNCtY36IppnufEIyHr+eqlvsIUOs0kY5I9Df6A="; }; } @@ -65,8 +68,8 @@ src = pkgs.fetchFromGitHub { owner = "nickeb96"; repo = "puffer-fish"; - rev = "f8df25bde0875359805967aa999744a28dee0561"; - sha256 = "sha256-Gm4In5f03G2ijL1xDTKFsgE+hRXjQ29kk84LQSXXeF0="; + rev = "fd0a9c95da59512beffddb3df95e64221f894631"; + sha256 = "sha256-aij48yQHeAKCoAD43rGhqW8X/qmEGGkg8B4jSeqjVU0="; }; } @@ -76,8 +79,8 @@ src = pkgs.fetchFromGitHub { owner = "andreiborisov"; repo = "sponge"; - rev = "1.0.4"; - sha256 = "sha256-+GGfFC/hH7A8n9Wwojt5PW96fSzvRhThnZ3pLeWEqds="; + rev = "1.1.0"; + sha256 = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w="; }; } diff --git a/home/programs/wezterm.nix b/home/programs/wezterm.nix new file mode 100644 index 0000000..e1943bc --- /dev/null +++ b/home/programs/wezterm.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: + +{ + programs.wezterm = { + enable = true; + + extraConfig = '' + _G.default_shell = { '${pkgs.fish.outPath}/bin/fish', '--interactive'}; + + local cfg = require('config'); + return cfg + ''; + }; + + xdg.configFile."wezterm" = { + source = pkgs.runCommand "wezterm-fennel-files" + { + nativeBuildInputs = with pkgs; [ lua53Packages.fennel stylua ]; + } '' + mkdir -p $out + + config_store_path="${../config/wezterm}" + fennel="fennel --use-bit-lib --compile" + + echo "Using fennel command: $fennel" + + # Change PWD to config directory + cd "$config_store_path" + + # Init + echo "Compiling init.fnl ..." + $fennel "$config_store_path/config.fnl" > "$out/config.lua" + + stylua "$out/" + ''; + recursive = true; + }; +} diff --git a/system/darwin/fonts.nix b/system/darwin/fonts.nix index 0dbb057..18fd522 100644 --- a/system/darwin/fonts.nix +++ b/system/darwin/fonts.nix @@ -5,11 +5,16 @@ fontDir.enable = true; fonts = with pkgs; [ + jetbrains-mono + victor-mono + noto-fonts + unifont + (nerdfonts.override { fonts = [ - "FiraCode" - "JetBrainsMono" - "VictorMono" + "NerdFontsSymbolsOnly" + # "JetBrainsMono" + # "VictorMono" ]; }) ];