From 44bc095527c1a06755ef6b1c74a8b1fd09a08deb Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 28 Dec 2024 04:02:00 -0800 Subject: [PATCH] feat: correct neomutt keybinds, add rdrview --- pkgs/by-name/rdrview/default.nix | 45 ++++++++ pkgs/default.nix | 3 +- reference/users/youwen/neomutt.nix | 14 +++ reference/users/youwen/vimkeys.w3m | 179 +++++++++++++++++++++++++++++ 4 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/rdrview/default.nix create mode 100644 reference/users/youwen/vimkeys.w3m diff --git a/pkgs/by-name/rdrview/default.nix b/pkgs/by-name/rdrview/default.nix new file mode 100644 index 0000000..5a45d69 --- /dev/null +++ b/pkgs/by-name/rdrview/default.nix @@ -0,0 +1,45 @@ +{ + lib, + stdenv, + fetchFromGitHub, + libxml2, + curl, + libseccomp, + installShellFiles, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "rdrview"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "eafer"; + repo = "rdrview"; + rev = "v${finalAttrs.version}"; + hash = "sha256-UFHRsaLGa/jv/S+VXtXIMgLuQUPgqbRgD35bBrJyuZA="; + }; + + buildInputs = [ + libxml2 + curl + libseccomp + ]; + nativeBuildInputs = [ installShellFiles ]; + + installPhase = '' + runHook preInstall + install -Dm755 rdrview -t $out/bin + installManPage rdrview.1 + runHook postInstall + ''; + + enableParallelBuilding = true; + + meta = with lib; { + description = "Command line tool to extract main content from a webpage"; + homepage = "https://github.com/eafer/rdrview"; + license = licenses.asl20; + maintainers = with maintainers; [ djanatyn ]; + mainProgram = "rdrview"; + }; +}) diff --git a/pkgs/default.nix b/pkgs/default.nix index 1ff8ae2..4e34e4d 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,5 +4,6 @@ let in final: prev: { modrinth-app = callPackage ./by-name/modrinth-app { }; - hyprland-qtutils = callPackage ./by-name/hyprland-qtutils { }; + # hyprland-qtutils = callPackage ./by-name/hyprland-qtutils { }; + rdrview = callPackage ./by-name/rdrview { }; } diff --git a/reference/users/youwen/neomutt.nix b/reference/users/youwen/neomutt.nix index 4cf92e7..a1c9aec 100644 --- a/reference/users/youwen/neomutt.nix +++ b/reference/users/youwen/neomutt.nix @@ -111,4 +111,18 @@ in text/html; ${pkgs.w3m}/bin/w3m %s; nametemplate=%s.html; needsterminal text/html; ${pkgs.w3m}/bin/w3m -v -F -T text/html -dump %s; copiousoutput ''; + + home.file.".w3m/config".text = '' + inline_img_protocol 4 + imgdisplay kitty + display_link_number 1 + ''; + + home.file.".w3m/keymap".text = + (builtins.readFile ./vimkeys.w3m) + + '' + keymap R COMMAND "READ_SHELL '${pkgs.rdrview}/bin/rdrview $W3M_URL -H 2> /dev/null 1> /tmp/readable.html' ; LOAD /tmp/readable.html" + keymap f COMMAND "RESHAPE ; LINK_BEGIN ; GOTO_LINK" + keymap F COMMAND "RESHAPE ; LINK_BEGIN ; TAB_LINK" + ''; } diff --git a/reference/users/youwen/vimkeys.w3m b/reference/users/youwen/vimkeys.w3m new file mode 100644 index 0000000..b3c7227 --- /dev/null +++ b/reference/users/youwen/vimkeys.w3m @@ -0,0 +1,179 @@ +# Removing Defaults + +keymap + NULL +keymap C-v NULL +keymap SPC NULL +keymap ^[[6~ NULL +keymap - NULL +keymap ESC-v NULL +keymap ^[[5~ NULL +keymap b NULL +keymap C-f NULL +keymap C-b NULL +keymap C-f NULL +keymap C-b NULL +keymap C-n NULL +keymap C-p NULL +keymap J NULL +keymap K NULL +keymap > NULL +keymap < NULL +keymap , NULL +keymap . NULL +keymap C-a NULL +keymap ^ NULL +keymap $ NULL +keymap C-e NULL +keymap 0 NULL +keymap Z NULL +keymap z NULL +keymap w NULL +keymap W NULL +keymap b NULL +keymap ESC-g NULL +keymap ESC-< NULL +keymap ESC-> NULL +keymap ^[[1~ NULL +keymap ^[[4~ NULL +keymap G NULL +keymap g NULL +keymap [ NULL +keymap ] NULL +keymap TAB NULL +keymap C-u NULL +keymap ESC-TAB NULL +keymap ^[[Z NULL +keymap ESC-m NULL +keymap u NULL +keymap C-r NULL +keymap C-j NULL +keymap C-m NULL +keymap C-t NULL +keymap ESC-C-j NULL +keymap ESC-C-m NULL +keymap a NULL +keymap I NULL +keymap ESC-I NULL +keymap c NULL +keymap u NULL +keymap i NULL +keymap = NULL +keymap C-g NULL +keymap : NULL +keymap ";" NULL +keymap ESC-: NULL +keymap F NULL +keymap M NULL +keymap ESC-M NULL +keymap L NULL +keymap ESC-l NULL +keymap U NULL +keymap ESC-u NULL +keymap V NULL +keymap @ NULL +keymap "#" NULL +keymap | NULL +keymap B NULL +keymap C-_ NULL +keymap s NULL +keymap v NULL +keymap ESC-s NULL +keymap S NULL +keymap E NULL +keymap ESC-e NULL +keymap R NULL +keymap r NULL +keymap C-l NULL +keymap T NULL +keymap C-q NULL +keymap { NULL +keymap } NULL +keymap ESC-t NULL +keymap J NULL +keymap K NULL +keymap ESC-b NULL +keymap ESC-a NULL +keymap / NULL +keymap ? NULL +keymap n NULL +keymap N NULL +keymap C-s NULL +keymap C-r NULL +keymap ESC-w NULL +keymap ESC-W NULL +keymap C-@ NULL +keymap ESC-n NULL +keymap ESC-p NULL +keymap \" NULL +keymap ^[[28~ NULL +keymap ^[[2~ NULL +keymap ^[[E NULL +keymap ^[[L NULL +keymap H NULL +keymap o NULL +keymap r NULL +keymap C-k NULL +keymap C-h NULL +keymap D NULL +keymap m NULL +keymap C-w NULL +keymap ESC-c NULL +keymap ESC-o NULL +keymap ESC-k NULL +keymap ! NULL +keymap C-z NULL +keymap q NULL +keymap Q NULL + +# New keybinds + +# Navigation +keymap $ LINE_END +keymap ^ LINE_BEGIN +keymap 0 LINE_BEGIN +keymap G END +keymap gg BEGIN +keymap ESC-g GOTO_LINE +keymap w NEXT_WORD +keymap b PREV_WORD + +# NPage Navigation +keymap j COMMAND "MOVE_DOWN1" +keymap k COMMAND "MOVE_UP1" + +# Undo +keymap C-r REDO + +#keymap C-f NEXT_PAGE +keymap C-f COMMAND "NEXT_PAGE" +#keymap C-b PREV_PAGE +keymap C-b COMMAND "PREV_PAGE" +keymap H BACK +keymap r RELOAD + +# Tab stuff +keymap J NEXT_TAB +keymap K PREV_TAB +keymap o GOTO +keymap O TAB_GOTO + +# Search +keymap / WHEREIS +keymap ? SEARCH_BACK +keymap n SEARCH_NEXT +keymap N SEARCH_PREV + +# Commands +keymap :: COMMAND +keymap :help HELP +keymap :downloads DOWNLOAD_LIST +#keymap :hist HISTORY +keymap :settings OPTIONS + +keymap ZZ EXIT +keymap C-Q EXIT +keymap ZQ QUIT +keymap :q QUIT + +# copy url to clipboard +keymap yy EXTERN 'printf %s | wl-clipboard'