mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-27 21:41:29 +00:00
Compare commits
3 commits
fb404c01a3
...
04c7ccac93
Author | SHA1 | Date | |
---|---|---|---|
![]() |
04c7ccac93 | ||
2728e65a5e | |||
![]() |
4eeadf3c96 |
4 changed files with 72 additions and 15 deletions
|
@ -10,12 +10,18 @@ To use it, we first add the input flake.
|
|||
```nix
|
||||
{
|
||||
inputs = {
|
||||
# Optional, if you intend to follow nvf's obsidian-nvim input
|
||||
# you must also add it as a flake input.
|
||||
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
|
||||
|
||||
# Required, nvf works best and only directly supports flakes
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
# you can override input nixpkgs
|
||||
# You can override the input nixpkgs to follow your system's
|
||||
# instance of nixpkgs. This is safe to do as nvf does not depend
|
||||
# on a binary cache.
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# you can also override individual plugins
|
||||
# Optionally, you can also override individual plugins
|
||||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
|
@ -27,8 +33,8 @@ Followed by importing the home-manager module somewhere in your configuration.
|
|||
|
||||
```nix
|
||||
{
|
||||
# assuming nvf is in your inputs and inputs is in the argset
|
||||
# see example below
|
||||
# Assuming "nvf" is in your inputs and inputs is in the argument set.
|
||||
# See example installation below
|
||||
imports = [ inputs.nvf.homeManagerModules.default ];
|
||||
}
|
||||
```
|
||||
|
|
|
@ -10,12 +10,18 @@ To use it, we first add the input flake.
|
|||
```nix
|
||||
{
|
||||
inputs = {
|
||||
# Optional, if you intend to follow nvf's obsidian-nvim input
|
||||
# you must also add it as a flake input.
|
||||
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
|
||||
|
||||
# Required, nvf works best and only directly supports flakes
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
# you can override input nixpkgs
|
||||
# You can override the input nixpkgs to follow your system's
|
||||
# instance of nixpkgs. This is safe to do as nvf does not depend
|
||||
# on a binary cache.
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# you can also override individual plugins
|
||||
# Optionally, you can also override individual plugins
|
||||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
|
|
|
@ -726,6 +726,11 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
plugin-R-nvim = {
|
||||
url = "github:R-nvim/R.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-haskell-tools-nvim = {
|
||||
url = "github:mrcjkb/haskell-tools.nvim";
|
||||
flake = false;
|
||||
|
|
|
@ -6,11 +6,13 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.types) enum either listOf package str nullOr attrsOf;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.r;
|
||||
|
||||
|
@ -74,7 +76,12 @@ in {
|
|||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "r";
|
||||
rPackage = mkGrammarOption pkgs "r";
|
||||
rnowebPackage = mkGrammarOption pkgs "rnoweb";
|
||||
mdPackage = mkGrammarOption pkgs "markdown";
|
||||
mdInlinePackage = mkGrammarOption pkgs "markdown-inline";
|
||||
yamlPackage = mkGrammarOption pkgs "yaml";
|
||||
csvPackage = mkGrammarOption pkgs "csv";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
@ -109,14 +116,28 @@ in {
|
|||
description = "R formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extensions = {
|
||||
R-nvim = {
|
||||
enable =
|
||||
mkEnableOption ''
|
||||
[R.nvim]: https://github.com/R-Nvim/R.nvim
|
||||
|
||||
R.nvim adds R support to Neovim, including:
|
||||
|
||||
- Communication with R via Neovim's built-in terminal or tmux
|
||||
- A built-in object explorer and autocompletions built from your R environment
|
||||
- Keyboard shortcuts for common inserts like <- and |>
|
||||
- Quarto/R Markdown support
|
||||
''
|
||||
// {default = true;};
|
||||
|
||||
setupOpts = mkPluginSetupOption "R-nvim" {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
|
||||
|
@ -126,5 +147,24 @@ in {
|
|||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [
|
||||
cfg.treesitter.rPackage
|
||||
cfg.treesitter.rnowebPackage
|
||||
cfg.treesitter.mdPackage
|
||||
cfg.treesitter.mdInlinePackage
|
||||
cfg.treesitter.yamlPackage
|
||||
cfg.treesitter.csvPackage
|
||||
];
|
||||
})
|
||||
|
||||
(mkIf cfg.extensions.R-nvim.enable {
|
||||
vim.startPlugins = ["R-nvim"];
|
||||
vim.pluginRC.R-nvim= entryAnywhere ''
|
||||
require("r").setup(${toLuaObject cfg.extensions.R-nvim.setupOpts})
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue