From 14081936af2867c5a9acf91ea4d2bd1b15cc5fa4 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 8 Jun 2024 21:30:44 -0400 Subject: [PATCH] refactor: move sioyek out of common config --- common/home/neovim/langs/markdown.nix | 60 +++++++++------------------ modules/hyprland/packages.nix | 19 +++++++++ 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/common/home/neovim/langs/markdown.nix b/common/home/neovim/langs/markdown.nix index 5d6db55..779f4da 100644 --- a/common/home/neovim/langs/markdown.nix +++ b/common/home/neovim/langs/markdown.nix @@ -16,26 +16,6 @@ in lib.mkIf neovimIde { programs = { - # TODO: add syntax highlighting for markdown - sioyek = { - enable = true; - - config = let - # TODO: put this with the rest of the themes - dracula-theme = pkgs.fetchFromGitHub { - owner = "dracula"; - repo = "sioyek"; - rev = "b832ab04d880fbe243c0fe9043612be61226426e"; - hash = "sha256-+HzxZA8Bb+cGogK+w4JES4ZFG+ueXEAuLu+0T18fvbc="; - }; - in { - startup_commands = "toggle_custom_color"; - ui_font = "JetBrainsMono Nerd Font Mono Regular"; - font_size = "24"; - source = "${dracula-theme}/dracula.config"; - }; - }; - neovim = { extraPackages = [ pkgs.pandoc @@ -94,26 +74,30 @@ in command = 'setlocal ts=4 sw=4 sts=0 expandtab', }); - local gknapsettings = { + vim.g.knap_settings = { -- HTML - htmloutputext = "html", - htmltohtml = "none", + htmloutputext = 'html', + htmltohtml = 'none', htmltohtmlviewerlaunch = "", - htmltohtmlviewerrefresh = "none", + htmltohtmlviewerrefresh = 'none', -- Markdown - mdoutputext = 'pdf', - markdownoutputext = 'pdf', + mdoutputext = 'html', + markdownoutputext = 'html', + + -- Markdown to PDF mdtopdf = 'pandoc %docroot% -o /tmp/%outputfile%', - markdowntopdf = "pandoc %docroot% -o /tmp/%outputfile%", + markdowntopdf = 'pandoc %docroot% -o /tmp/%outputfile%', mdtopdfviewerlaunch = 'sioyek /tmp/%outputfile%', - markdowntopdfviewerlaunch = "sioyek /tmp/%outputfile%", + markdowntopdfviewerlaunch = 'sioyek /tmp/%outputfile%', mdtopdfviewerrefresh = 'none', markdowntopdfviewerrefresh = "none", - mdtohtml = "", - markdowntohtml = "", - mdtohtmlviewerlaunch = "", - markdowntohtmlviewerlaunch = "", + + -- Markdown to HTML + mdtohtml = 'pandoc --standalone %docroot% -o /tmp/%outputfile%', + markdowntohtml = 'pandoc --standalone %docroot% -o /tmp/%outputfile%', + mdtohtmlviewerlaunch = 'firefox -new-window /tmp/%outputfile%', + markdowntohtmlviewerlaunch = 'firefox -new-window /tmp/%outputfile%', mdtohtmlviewerrefresh = 'none', markdowntohtmlviewerrefresh = 'none', @@ -121,29 +105,25 @@ in -- TODO: stop from polluting workspace }; - vim.g.knap_settings = gknapsettings; - - local kmap = vim.keymap.set - -- F4 processes the document once, and refreshes the view - kmap({ 'n', 'v', 'i' }, '', function() + vim.keymap.set({ 'n', 'v', 'i' }, '', function() require('knap').process_once(); end); -- F5 closes the viewer application, and -- allows settings to be reset - kmap({ 'n', 'v', 'i' }, '', function() + vim.keymap.set({ 'n', 'v', 'i' }, '', function() require('knap').close_viewer(); end); -- F6 toggles the auto-processing on and off - kmap({ 'n', 'v', 'i' }, '', function() + vim.keymap.set({ 'n', 'v', 'i' }, '', function() require('knap').toggle_autopreviewing(); end); -- F7 invokes a SyncTeX forward search, or similar, -- where appropriate - kmap({ 'n', 'v', 'i' }, '', function() + vim.keymap.set({ 'n', 'v', 'i' }, '', function() require('knap').forward_jump(); end); ''; diff --git a/modules/hyprland/packages.nix b/modules/hyprland/packages.nix index 5c46597..91e2699 100644 --- a/modules/hyprland/packages.nix +++ b/modules/hyprland/packages.nix @@ -48,6 +48,25 @@ in { }) ]; + programs.sioyek = { + enable = true; + + config = let + # TODO: put this with the rest of the themes + dracula-theme = pkgs.fetchFromGitHub { + owner = "dracula"; + repo = "sioyek"; + rev = "b832ab04d880fbe243c0fe9043612be61226426e"; + hash = "sha256-+HzxZA8Bb+cGogK+w4JES4ZFG+ueXEAuLu+0T18fvbc="; + }; + in { + startup_commands = "toggle_custom_color"; + ui_font = "JetBrainsMono Nerd Font Mono Regular"; + font_size = "24"; + source = "${dracula-theme}/dracula.config"; + }; + }; + home.packages = (with pkgs; [ # School