Nvim-r: Difference between revisions

From NixOS Wiki
imported>Josephsdavid
Added installation instructions as nvim-r has some build-time dependencies
Klinger (talk | contribs)
m Category:Applications [[Category:Text Editor{{#translation:}}]]
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{#if:{{NAMESPACE}}|{{NAMESPACE}}:|}}{{lcfirst:{{PAGENAME}}}}}}
This plugin turns vim/Neovim into a fully fledged R IDE<ref>https://medium.freecodecamp.org/turning-vim-into-an-r-ide-cd9602e8c217?gi=a7ef030c5ed2</ref>. Once added as a [[vim]] plugin it will try to compile a backend executable called nvimcom<ref>https://github.com/jalvesaq/Nvim-R</ref>.  
This plugin turns vim/Neovim into a fully fledged R IDE<ref>https://medium.freecodecamp.org/turning-vim-into-an-r-ide-cd9602e8c217?gi=a7ef030c5ed2</ref>. Once added as a [[vim]] plugin it will try to compile a backend executable called nvimcom<ref>https://github.com/jalvesaq/Nvim-R</ref>.  


==If nvimcom Installation Fails==
==If nvimcom Installation Fails==


This Just Works &trade; but you have to explictly install GCC  on [https://nixos.org/nixos/manual/index.html#sec-package-management system packages] so the plugin script can find it and compile the code it needs. If GCC is not explicitly installed, then it will print an "updating nvimcom" message and then a criptyc compilation error log.
This Just Works &trade; but you have to explictly install GCC  on [https://nixos.org/nixos/manual/index.html#sec-package-management system packages] so the plugin script can find it and compile the code it needs. If GCC is not explicitly installed, then it will print an "updating nvimcom" message and then a cryptic compilation error log.




Line 12: Line 13:


'''~/.config/nixpkgs/vim.nix'''
'''~/.config/nixpkgs/vim.nix'''
<pre>
<syntaxHighlight lang=nix>
with import <nixpkgs> {};
with import <nixpkgs> {};
let customPlugins = {
let customPlugins = {
Line 18: Line 19:
     name = "nvim-r";
     name = "nvim-r";
     src = fetchgit {
     src = fetchgit {
      url= "https://github.com/jalvesaq/nvim-r";
      url= "https://github.com/jalvesaq/nvim-r";
  rev =  "c53b5a402a26df5952718f483c7461af5bb459eb";
      rev =  "c53b5a402a26df5952718f483c7461af5bb459eb";
  sha256 = "13xbb05gnpgmyaww6029saplzjq7cq2dxzlxylcynxhhyibz5ibv";
      sha256 = "13xbb05gnpgmyaww6029saplzjq7cq2dxzlxylcynxhhyibz5ibv";
};
      };
buildInputs = [ which vim  zip];
    buildInputs = [ which vim  zip];
};
  };
};
};
...
...
...
...
in vim_configurable.customize {
in vim_configurable.customize {
   name = "vim";
   name = "vim";
   vimrcConfig.customRC = ' '
   vimrcConfig.customRC = ''
   vimrc things go here
   vimrc things go here
   '';
   '';
Line 40: Line 42:
     ];
     ];
}
}
</pre>
</syntaxHighlight>




'''~/.config/nixpkgs/home.nix'''
'''~/.config/nixpkgs/home.nix'''
<pre>
<syntaxHighlight lang=nix>
   home= {
   home= {
     packages =with pkgs; [
     packages = with pkgs; [
       (import ./vim.nix)
       (import ./vim.nix)
       other packages
       # other packages
   ];
   ];
};
};
</pre>
</syntaxHighlight>
[[Category:Applications]]
[[Category:Text Editor{{#translation:}}]]

Latest revision as of 17:33, 25 August 2024

This plugin turns vim/Neovim into a fully fledged R IDE[1]. Once added as a vim plugin it will try to compile a backend executable called nvimcom[2].

If nvimcom Installation Fails

This Just Works ™ but you have to explictly install GCC on system packages so the plugin script can find it and compile the code it needs. If GCC is not explicitly installed, then it will print an "updating nvimcom" message and then a cryptic compilation error log.


Installation via Home-Manager

An example installation of nvim-r using home-manager is shown below.

nvim-R requires build dependencies: which, vim and zip

~/.config/nixpkgs/vim.nix

with import <nixpkgs> {};
let customPlugins = {
  nvim-r = vimUtils.buildVimPlugin {
    name = "nvim-r";
    src = fetchgit {
      url= "https://github.com/jalvesaq/nvim-r";
      rev =  "c53b5a402a26df5952718f483c7461af5bb459eb";
      sha256 = "13xbb05gnpgmyaww6029saplzjq7cq2dxzlxylcynxhhyibz5ibv";
      };
    buildInputs = [ which vim  zip];
  };
};

...
...
in vim_configurable.customize {
  name = "vim";
  vimrcConfig.customRC = ''
  vimrc things go here
  '';
    vimrcConfig.vam.knownPlugins = pkgs.vimPlugins // customPlugins;
    vimrcConfig.vam.pluginDictionaries = [
      { names = [
        "nvim-r"
        "other normal vim plugins"
      ]; }
    ];
}


~/.config/nixpkgs/home.nix

  home= {
    packages = with pkgs; [
      (import ./vim.nix)
      # other packages
  ];
};