Editor Modes for Nix Files: Difference between revisions

imported>Fricklerhandwerk
No edit summary
DoggoBit (talk | contribs)
m propose merge
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Nix language has decent syntax highlighting (SH) support among popular code editors, but refactoring/autocomplete is still rare. Below is a list of editor modes for Nix syntax.  
{{Merge|Nix (language)}}
 
Nix language has decent syntax highlighting (SH) support among popular code editors, but refactoring/autocomplete is still rare. Below is a list of editor modes for Nix syntax.
 
== Language servers ==
Most popular editors have support for the [https://microsoft.github.io/language-server-protocol language server protocol], the following language servers can be used to provide features like completions and go-to-definition.
* [https://github.com/oxalica/nil nil]
* [https://github.com/nix-community/rnix-lsp rnix-lsp]
* [https://github.com/nix-community/nixd nixd]


== Emacs ==
== Emacs ==
Line 6: Line 14:
* [https://github.com/shlevy/nix-buffer nix-buffer]
* [https://github.com/shlevy/nix-buffer nix-buffer]
* [https://github.com/jwiegley/nix-update-el nix-update-el]
* [https://github.com/jwiegley/nix-update-el nix-update-el]
* [https://github.com/nix-community/rnix-lsp rnix-lsp]
 
== Vim ==
== Vim ==
=== rnix-lsp ===
* [https://github.com/nix-community/rnix-lsp rnix-lsp on github]
instructions are in the readme


=== vim-addon-nix ===
=== vim-addon-nix ===
Line 45: Line 49:
   ];
   ];
}</syntaxHighlight>
}</syntaxHighlight>
== Neovim ==
In addition to the Vim plugins listed above, [https://github.com/nvim-treesitter/nvim-treesitter nvim-treesitter] also has support for nix.
<syntaxHighlight lang="nix">{
  programs.neovim = {
    configure = {
      packages.all.start = with pkgs.vimPlugins; [
        (nvim-treesitter.withPlugins (ps: [ ps.nix ]))
        # or
        nvim-treesitter.withAllGrammars # to install all grammars (including nix)
      ];
    };
  };
}
</syntaxHighlight>


== IntelliJ IDEA ==
== IntelliJ IDEA ==
Line 64: Line 84:
== nano ==
== nano ==
* [https://github.com/seitz/nanonix nanonix]
* [https://github.com/seitz/nanonix nanonix]
== micro ==
Syntax highlighting is built-in. LSP support is available through the [https://github.com/AndCake/micro-plugin-lsp <code>lsp</code> plugin].
== Codemirror ==
* [https://github.com/replit/codemirror-lang-nix codemirror-lang-nix]
== Zed ==
* [https://github.com/hasit/zed-nix zed-nix on github]


== Relevant pages ==
== Relevant pages ==
Line 72: Line 101:
[[Category:Nix Language]]
[[Category:Nix Language]]
[[Category:Guide]]
[[Category:Guide]]
[[Category:Text Editor]]