From 978596fec4b45379390c409df14cf768dc3a1beb Mon Sep 17 00:00:00 2001 From: leycm Date: Tue, 10 Feb 2026 10:53:42 +0100 Subject: [PATCH] Add nvim as an ExternalEditorType for windows macos and linux --- .../xpipe/app/prefs/ExternalEditorType.java | 82 ++++++++++++++++++- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java index 795ae83b6..4ac5dd5bf 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java @@ -23,7 +23,6 @@ import java.util.Optional; import java.util.function.Supplier; public interface ExternalEditorType extends PrefsChoiceValue { - ExternalEditorType NOTEPAD = new WindowsType() { @Override @@ -280,6 +279,68 @@ public interface ExternalEditorType extends PrefsChoiceValue { LinuxPathType KIRO_LINUX = new LinuxPathType("app.kiro", "kiro", "https://kiro.dev/"); + LinuxType NEOVIM_LINUX = new LinuxType("app.neovim", "nvim", "https://neovim.io/", null) { + @Override + public void launch(Path file) throws Exception { + TerminalLaunch.builder() + .title(file.toString()) + .localScript(sc -> new ShellScript(CommandBuilder.of() + .add(getExecutable()) + .addFile(file.toString()) + .buildFull(sc))) + .logIfEnabled(false) + .preferTabs(false) + .launch(); + } + }; + + WindowsType NEOVIM_WINDOWS = new WindowsType() { + @Override + public String getId() { + return "app.neovim"; + } + + @Override + public boolean detach() { + return false; + } + + @Override + public String getExecutable() { + return "nvim"; + } + + + @Override + public String getWebsite() { + return "https://neovim.io/"; + } + + + @Override + public Optional determineInstallation() { + var local = AppSystemInfo.ofWindows().getLocalAppData().resolve("Programs", "nvim").resolve("nvim.exe"); + if (Files.exists(local)) return Optional.of(local); + var programFiles = AppSystemInfo.ofWindows().getProgramFiles().resolve("Programs", "nvim").resolve("nvim.exe"); + if (Files.exists(programFiles)) return Optional.of(programFiles); + return Optional.empty(); + } + + @Override + public void launch(Path file) throws Exception { + TerminalLaunch.builder() + .title(file.toString()) + .localScript(sc -> new ShellScript(CommandBuilder.of() + .add(findExecutable().toString()) + .addFile(file) + .buildFull(sc))) + .logIfEnabled(false) + .preferTabs(false) + .launch(); + } + + }; + WindowsType ZED_WINDOWS = new WindowsType() { @Override @@ -356,6 +417,20 @@ public interface ExternalEditorType extends PrefsChoiceValue { ExternalEditorType WINDSURF_MACOS = new MacOsEditor("app.windsurf", "Windsurf", "https://windsurf.com/editor"); ExternalEditorType KIRO_MACOS = new MacOsEditor("app.kiro", "Kiro", "https://kiro.dev/"); ExternalEditorType TRAE_MACOS = new MacOsEditor("app.trae", "Trae", "https://www.trae.ai/"); + ExternalEditorType NEOVIM_MACOS = new MacOsEditor("app.neovim", "Neovim", "https://neovim.io/") { + @Override + public void launch(Path file) throws Exception { + TerminalLaunch.builder() + .title(file.toString()) + .localScript(sc -> new ShellScript(CommandBuilder.of() + .add("nvim") + .addFile(file.toString()) + .buildFull(sc))) + .logIfEnabled(false) + .preferTabs(false) + .launch(); + } + }; ExternalEditorType CUSTOM = new ExternalEditorType() { @Override @@ -422,7 +497,8 @@ public interface ExternalEditorType extends PrefsChoiceValue { VSCODE_INSIDERS_WINDOWS, VSCODE_WINDOWS, NOTEPADPLUSPLUS, - NOTEPAD); + NOTEPAD, + NEOVIM_WINDOWS); List LINUX_EDITORS = List.of( ExternalEditorType.WINDSURF_LINUX, ExternalEditorType.KIRO_LINUX, @@ -435,6 +511,7 @@ public interface ExternalEditorType extends PrefsChoiceValue { PLUMA, LEAFPAD, MOUSEPAD, + NEOVIM_LINUX, GNOME, ExternalEditorType.COSMIC_EDIT, ExternalEditorType.WESTON_EDITOR, @@ -451,6 +528,7 @@ public interface ExternalEditorType extends PrefsChoiceValue { VSCODE_MACOS, SUBLIME_MACOS, ZED_MACOS, + NEOVIM_MACOS, TEXT_EDIT); List CROSS_PLATFORM_EDITORS = List.of(FLEET, INTELLIJ, PYCHARM, WEBSTORM, CLION);