neovimhaskell / haskell-vim

Custom Haskell Vimscripts
BSD 2-Clause "Simplified" License
681 stars 83 forks source link

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

Open lippirk opened 5 years ago

lippirk commented 5 years ago

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 commented 5 years ago

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

emptyflask commented 5 years ago

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 commented 4 years ago

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 commented 4 years ago

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

maralorn commented 4 years ago

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. https://github.com/NixOS/nixpkgs/pull/87543