Skip to content

Commit

Permalink
Reorder vim arguments in launchEditor so --remote works (facebook#2723)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
trygveaa authored and kasperpeulen committed Sep 24, 2017
1 parent 0d5b936 commit d87b73a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/react-dev-utils/launchEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ function addWorkspaceToArgumentsIfExists(args, workspace) {
function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
switch (editorBasename) {
case 'vim':
case 'mvim':
return [fileName, '+' + lineNumber];
case 'atom':
case 'Atom':
case 'Atom Beta':
Expand All @@ -74,6 +71,8 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
return [fileName + ':' + lineNumber];
case 'notepad++':
return ['-n' + lineNumber, fileName];
case 'vim':
case 'mvim':
case 'joe':
case 'emacs':
case 'emacsclient':
Expand Down

0 comments on commit d87b73a

Please sign in to comment.