mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
feat: add Neovim editor support (#1448)
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user