Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ranger: syntax highlight previews by default #47432

Merged
merged 2 commits into from Sep 28, 2018
Merged

Conversation

alyssais
Copy link
Member

@alyssais alyssais commented Sep 27, 2018

This also fixes out-of-the-box previews. I'm guessing this became commented out by default at some point.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

I'm guessing this became commented out by default at some point.
@xeji
Copy link
Contributor

xeji commented Sep 27, 2018

Looks nice (no nix higlighting unfortunately). Also add ~2.8M to closure size. But I think it should be fine.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Sep 28, 2018

You could use pygments instead, it has nix support but it will probably increase the closure even more:

--- a/pkgs/applications/misc/ranger/default.nix
+++ b/pkgs/applications/misc/ranger/default.nix
@@ -24,6 +24,9 @@ python3Packages.buildPythonApplication rec {
   '';
 
   preConfigure = ''
+    sed -i -e 's|# pygmentize|${python3Packages.pygments}/bin/pygmentize|' \
+      ranger/data/scope.sh
+
     substituteInPlace ranger/data/scope.sh \
       --replace "/bin/echo" "echo"

@emmanuelrosa
Copy link
Contributor

It's working nicely on NixOS 👍

@alyssais
Copy link
Member Author

Annoying that pygments and highlight have different command line arguments, so you can't just swap them with overrides…

I think that leaving it as highlight would be better as the default, since that's what upstream does. Then all we're doing is fixing a path rather than changing upstream's functionality.

@xeji
Copy link
Contributor

xeji commented Sep 28, 2018

I think that leaving it as highlight would be better as the default, since that's what upstream does.

Agree. Users can easily switch to pygmentize in their ~/.config/ranger/scope.sh

@xeji xeji merged commit e72de08 into NixOS:master Sep 28, 2018
@alyssais alyssais deleted the ranger branch September 28, 2018 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants