gpt4 book ai didi

python - 在 vim_configurable.customize 中用 python3 覆盖 python

转载 作者:太空狗 更新时间:2023-10-30 02:55:12 24 4
gpt4 key购买 nike

我正在关注 this使用 Nix 配置我的自定义 vim 的模板。我的vim-config/default.nix如下:

{ pkgs }:

let
my_plugins = import ./plugins.nix { inherit (pkgs) vimUtils fetchFromGitHub; };
in with (pkgs // { python = pkgs.python3; }); vim_configurable.customize {
name = "vim";
vimrcConfig = {
customRC = ''
syntax on
filetype on
" ...
'';

vam.knownPlugins = vimPlugins // my_plugins;
vam.pluginDictionaries = [
{ names = [
"ctrlp"
# ...
]; }
];
};
}

虽然在第 5 行有一个 (pkgs//{ python = pkgs.python3; }) 覆盖,但仍然没有使用 python3(当我运行 vim --version 它显示 +python -python3)。我错过了什么吗?

最佳答案

由于仍然有人在积极关注这个话题,我会提到有一个比我第一次遇到的更简单的解决方案:

my_vim_configurable = pkgs.vim_configurable.override {
python = pkgs.python3;
};

我的旧答案:

事实证明with (pkgs // { python = pkgs.python3; });只修改 pythonwith 之后的范围内陈述。 python用于 vim_configurable不受影响。我最终做的是制作 vim_configurable 的 python3 版本。使用 vimUtils.makeCustomizable :

vim-config/default.nix :

{ pkgs }:

let
  my_plugins = import ./plugins.nix { inherit (pkgs) vimUtils fetchFromGitHub; };
  configurable_nix_path = <nixpkgs/pkgs/applications/editors/vim/configurable.nix>;
  my_vim_configurable = with pkgs; vimUtils.makeCustomizable (callPackage configurable_nix_path {
    inherit (darwin.apple_sdk.frameworks) CoreServices Cocoa Foundation CoreData;
    inherit (darwin) libobjc cf-private;

    features = "huge"; # one of  tiny, small, normal, big or huge
    lua = pkgs.lua5_1;
    gui = config.vim.gui or "auto";
    python = python3;

    # optional features by flags
    flags = [ "python" "X11" ];
  });

in with pkgs; my_vim_configurable.customize {
  name = "vim";
  vimrcConfig = {
    customRC = ''
      syntax on
      “...
    '';

    vam.knownPlugins = vimPlugins // my_plugins;
    vam.pluginDictionaries = [
      { names = [
        "ctrlp"
        # ...
      ]; }
    ];
  };
}

关于python - 在 vim_configurable.customize 中用 python3 覆盖 python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43197204/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com