feat: add Neovim editor support (#1448)

This commit is contained in:
yuki yano
2025-06-30 02:25:22 +09:00
committed by GitHub
parent 87d4fc0560
commit c860dac233
3 changed files with 68 additions and 30 deletions

View File

@@ -12,12 +12,19 @@ export type EditorType =
| 'windsurf'
| 'cursor'
| 'vim'
| 'neovim'
| 'zed';
function isValidEditorType(editor: string): editor is EditorType {
return ['vscode', 'vscodium', 'windsurf', 'cursor', 'vim', 'zed'].includes(
editor,
);
return [
'vscode',
'vscodium',
'windsurf',
'cursor',
'vim',
'neovim',
'zed',
].includes(editor);
}
interface DiffCommand {
@@ -43,6 +50,7 @@ const editorCommands: Record<EditorType, { win32: string; default: string }> = {
windsurf: { win32: 'windsurf', default: 'windsurf' },
cursor: { win32: 'cursor', default: 'cursor' },
vim: { win32: 'vim', default: 'vim' },
neovim: { win32: 'nvim', default: 'nvim' },
zed: { win32: 'zed', default: 'zed' },
};
@@ -97,8 +105,9 @@ export function getDiffCommand(
case 'zed':
return { command, args: ['--wait', '--diff', oldPath, newPath] };
case 'vim':
case 'neovim':
return {
command: 'vim',
command,
args: [
'-d',
// skip viminfo file to avoid E138 errors
@@ -172,7 +181,8 @@ export async function openDiff(
});
});
case 'vim': {
case 'vim':
case 'neovim': {
// Use execSync for terminal-based editors
const command =
process.platform === 'win32'