fix: yazi opener
This commit is contained in:
parent
27482b20d7
commit
53b83b3471
4 changed files with 58 additions and 41 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
osConfig,
|
osConfig,
|
||||||
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
inputs,
|
inputs,
|
||||||
|
|
@ -7,7 +8,7 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib) concatStringsSep;
|
inherit (lib) concatStringsSep optionalString;
|
||||||
|
|
||||||
suda-nvim = pkgs.vimUtils.buildVimPlugin {
|
suda-nvim = pkgs.vimUtils.buildVimPlugin {
|
||||||
name = "vim-suda";
|
name = "vim-suda";
|
||||||
|
|
@ -23,6 +24,8 @@ let
|
||||||
name = "marks-nvim";
|
name = "marks-nvim";
|
||||||
src = inputs.marks-nvim;
|
src = inputs.marks-nvim;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
yaziOpenDir = config.programs.nvf.settings.vim.utility.yazi-nvim.setupOpts.open_for_directories;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
|
@ -44,6 +47,9 @@ in
|
||||||
vim = {
|
vim = {
|
||||||
enableLuaLoader = true;
|
enableLuaLoader = true;
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
|
luaConfigPre = ''
|
||||||
|
${optionalString yaziOpenDir "vim.g.loaded_netrwPlugin = 1"}
|
||||||
|
'';
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
nixfmt
|
nixfmt
|
||||||
];
|
];
|
||||||
|
|
@ -535,6 +541,7 @@ in
|
||||||
|
|
||||||
yazi-nvim = {
|
yazi-nvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
setupOpts.open_for_directories = true;
|
||||||
mappings.openYaziDir = "<leader>-";
|
mappings.openYaziDir = "<leader>-";
|
||||||
mappings.openYazi = "<leader>e";
|
mappings.openYazi = "<leader>e";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
config,
|
config,
|
||||||
osConfig,
|
osConfig,
|
||||||
...
|
...
|
||||||
|
|
@ -11,6 +12,17 @@ let
|
||||||
dataDir = "${config.home.homeDirectory}/${relativeDir}";
|
dataDir = "${config.home.homeDirectory}/${relativeDir}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
programs.nvf.settings.vim.extraPackages = with pkgs; [
|
||||||
|
imagemagick # for image.nvim
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.nvf.settings.vim.utility.images.image-nvim = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts = {
|
||||||
|
backend = "kitty";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
programs.nvf.settings.vim.utility.leetcode-nvim = {
|
programs.nvf.settings.vim.utility.leetcode-nvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
setupOpts = {
|
setupOpts = {
|
||||||
|
|
@ -18,7 +30,7 @@ in
|
||||||
lang = "rust";
|
lang = "rust";
|
||||||
plugins.non_standalone = true;
|
plugins.non_standalone = true;
|
||||||
storage.home = mkLuaInline ''"${dataDir}"'';
|
storage.home = mkLuaInline ''"${dataDir}"'';
|
||||||
injector = mkLuaInline ''
|
injector = mkLuaInline /* lua */ ''
|
||||||
{
|
{
|
||||||
['rust'] = {
|
['rust'] = {
|
||||||
before = { '#[allow(dead_code)]', 'fn main() {}', '#[allow(dead_code)]', 'struct Solution;' },
|
before = { '#[allow(dead_code)]', 'fn main() {}', '#[allow(dead_code)]', 'struct Solution;' },
|
||||||
|
|
@ -26,9 +38,7 @@ in
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
hooks."question_enter" = [
|
hooks."question_enter" = [
|
||||||
(mkLuaInline
|
(mkLuaInline /* lua */ ''
|
||||||
# lua
|
|
||||||
''
|
|
||||||
function (question)
|
function (question)
|
||||||
if question.lang ~= 'rust' then
|
if question.lang ~= 'rust' then
|
||||||
return
|
return
|
||||||
|
|
@ -60,8 +70,7 @@ in
|
||||||
print("Failed to open file " .. problem_dir)
|
print("Failed to open file " .. problem_dir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
''
|
'')
|
||||||
)
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ in
|
||||||
opener = {
|
opener = {
|
||||||
edit = [
|
edit = [
|
||||||
{
|
{
|
||||||
run = ''''\${EDITOR:=nvim} "$0"'';
|
run = ''''\${EDITOR:=nvim} "$1"'';
|
||||||
desc = "$EDITOR";
|
desc = "$EDITOR";
|
||||||
block = true;
|
block = true;
|
||||||
}
|
}
|
||||||
|
|
@ -77,12 +77,12 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
player = [
|
player = [
|
||||||
{ run = ''mpv --force-window "$0"''; }
|
{ run = ''mpv --force-window "$1"''; }
|
||||||
];
|
];
|
||||||
|
|
||||||
open = [
|
open = [
|
||||||
{
|
{
|
||||||
run = ''xdg-open "$0"'';
|
run = ''xdg-open "$1"'';
|
||||||
desc = "Open";
|
desc = "Open";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -171,8 +171,9 @@ in
|
||||||
"application/xhtml+xml"
|
"application/xhtml+xml"
|
||||||
"application/json"
|
"application/json"
|
||||||
"application/pdf"
|
"application/pdf"
|
||||||
"text/plain"
|
|
||||||
"text/html"
|
"text/html"
|
||||||
|
"image/png"
|
||||||
|
"image/jpeg"
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue