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

Can't get syntax highlighting to work on nixos #111

Open
lippirk opened this issue Jan 27, 2019 · 5 comments
Open

Can't get syntax highlighting to work on nixos #111

lippirk opened this issue Jan 27, 2019 · 5 comments

Comments

@lippirk
Copy link

lippirk commented Jan 27, 2019

Using the following nix overlay, I can't get this plugin to work:

# ~/.config/nixpkgs/overlays/test-nvim.nix
self: super:
let
  haskell-vim = super.fetchFromGitHub
  {
    owner = "neovimhaskell";
    repo = "haskell-vim";
    rev = "b1ac46807835423c4a4dd063df6d5b613d89c731";
    sha256 = "1vqj3r2v8skffywwgv4093ww7fm540437j5qz7n8q8787bs5w0br";
  };

  my-nvim-test = super.neovim.override {
    configure = {
      customRC =
      ''
         filetype on
         syntax on
         filetype plugin indent on
         let g:haskell_enable_quantification = 1   " to enable highlighting of `forall`
         let g:haskell_enable_recursivedo = 1      " to enable highlighting of `mdo` and `rec`
         let g:haskell_enable_arrowsyntax = 1      " to enable highlighting of `proc`
         let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
         let g:haskell_enable_typeroles = 1        " to enable highlighting of type roles
         let g:haskell_enable_static_pointers = 1  " to enable highlighting of `static`
         let g:haskell_backpack = 1
      '';
      packages.myVimPackage = {
        start = [ haskell-vim ];
      };
    };
  };

in
{
  my-nvim-test = my-nvim-test;
};

Steps to reproduce:

$ nix-shell -p my-nvim-test
$ nvim path/to/HaskellModule.hs

Expected: good syntax highlighting.
Actual: default syntax highlighting.

If somebody else using nix can get this working it would be good to know!

@emptyflask
Copy link

I'm having the same problem.
Screenshot: vim on top, neovim on the bottom

@emptyflask
Copy link

emptyflask commented Jul 7, 2019

Found a solution for NixOS using home-manager. Basically, add plugins using the vim-plug config option:

{ 
  programs.neovim = {
    enable    = true;
    viAlias   = true;
    configure = {
      customRC = ''
        let $NVIM_TUI_ENABLE_TRUE_COLOR=1 
        let g:haskell_enable_quantification = 1   " to enable highlighting of `forall`
        let g:haskell_enable_recursivedo = 1      " to enable highlighting of `mdo` and `rec`
        let g:haskell_enable_arrowsyntax = 1      " to enable highlighting of `proc`
        let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
        let g:haskell_enable_typeroles = 1        " to enable highlighting of type roles
        let g:haskell_enable_static_pointers = 1  " to enable highlighting of `static`
        let g:haskell_backpack = 1                " to enable highlighting of backpack keywords
      '';
      plug.plugins = with pkgs.vimPlugins; [
        haskell-vim
      ];
    };
  };
}

@emptyflask
Copy link

My config above doesn't work anymore, not sure why. I haven't noticed for a while but I'm assuming it happened around either the NixOS 19.09 or 20.03 upgrade.

@maralorn
Copy link

@emptyflask I can confirm that it stopped working for me somewhat around the same time. :-(

@maralorn
Copy link

Apparently this is caused by a wrong load order of plugins. This plugin has to be before the nvim-runtime in the runtime-path. The first syntax file wins.

@emptyflask
This broke in nixos in 20.03.

It is fixed on nixos-unstable and I made a PR to fix it on stable. NixOS/nixpkgs#87543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants