Skip to content

Commit ec2f319

Browse files
trygveaamorgs32
authored andcommitted
Reorder vim arguments in launchEditor so --remote works (facebook#2723)
This allows you to set REACT_EDITOR to 'vim --remote', so the file can be opened in an already running vim process. When using vim without remote, it works in the same way as before. When launching vim without --remote, the order of the line and path arguments doesn't matter. However, when using --remote the line argument has to precede the path. This happens to be the same as joe and emacs uses, so the vim cases were just moved there. I haven't tested this with mvim, but the documentation says the same as the vim documentation, so I assume it works the same.
1 parent c243dbf commit ec2f319

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/react-dev-utils/launchEditor.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ function addWorkspaceToArgumentsIfExists(args, workspace) {
5858
function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
5959
const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
6060
switch (editorBasename) {
61-
case 'vim':
62-
case 'mvim':
63-
return [fileName, '+' + lineNumber];
6461
case 'atom':
6562
case 'Atom':
6663
case 'Atom Beta':
@@ -74,6 +71,8 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
7471
return [fileName + ':' + lineNumber];
7572
case 'notepad++':
7673
return ['-n' + lineNumber, fileName];
74+
case 'vim':
75+
case 'mvim':
7776
case 'joe':
7877
case 'emacs':
7978
case 'emacsclient':

0 commit comments

Comments
 (0)