mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-29 09:55:43 +08:00
Reorder vim arguments in launchEditor so --remote works (#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.
This commit is contained in:
committed by
Dan Abramov
parent
85a9bc8590
commit
f495c15578
5
packages/react-dev-utils/launchEditor.js
vendored
5
packages/react-dev-utils/launchEditor.js
vendored
@@ -58,9 +58,6 @@ function addWorkspaceToArgumentsIfExists(args, workspace) {
|
|||||||
function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
|
function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
|
||||||
const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
|
const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
|
||||||
switch (editorBasename) {
|
switch (editorBasename) {
|
||||||
case 'vim':
|
|
||||||
case 'mvim':
|
|
||||||
return [fileName, '+' + lineNumber];
|
|
||||||
case 'atom':
|
case 'atom':
|
||||||
case 'Atom':
|
case 'Atom':
|
||||||
case 'Atom Beta':
|
case 'Atom Beta':
|
||||||
@@ -74,6 +71,8 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
|
|||||||
return [fileName + ':' + lineNumber];
|
return [fileName + ':' + lineNumber];
|
||||||
case 'notepad++':
|
case 'notepad++':
|
||||||
return ['-n' + lineNumber, fileName];
|
return ['-n' + lineNumber, fileName];
|
||||||
|
case 'vim':
|
||||||
|
case 'mvim':
|
||||||
case 'joe':
|
case 'joe':
|
||||||
case 'emacs':
|
case 'emacs':
|
||||||
case 'emacsclient':
|
case 'emacsclient':
|
||||||
|
|||||||
Reference in New Issue
Block a user