cursor icon indicating copy to clipboard operation
cursor copied to clipboard

`code .` opens cursor

Open TubbyStubby opened this issue 2 years ago • 6 comments

➜ cursor --version
0.9.3
e83fb25fe9144aa8b230e6f9ee2056e20fb24c70
x64

OS: Windows 11

I installed cursor few days ago. And during installation I was give 2 options, install code or cursor command. I chose cursor, and it works fine. But I just noticed that when I use code . it opens cursor which is not what I was expecting.

TubbyStubby avatar Sep 03 '23 08:09 TubbyStubby

seems like a super annoying bug. really sorry for causing this. will investigate soon if this is a bug on our side. (cc: @Sanger2000) if this is, will release a hot fix!

sualehasif avatar Sep 03 '23 08:09 sualehasif

I also encountered this issue some time ago and it happened because cursor added itself to the PATH before VS Code, instead of append itself, and since there is a code and code.cmd executable in there the code command would open cursor. This is despite me explicitly not choosing to override code with cursor during setup.

AppData\Local\Programs\cursor\resources\app\bin\ (contains code, code.cmd, cursor, cursor.cmd) AppData\Local\Programs\Microsoft VS Code\bin\ (contains code, code.cmd)

For me it was extra annoying because all of the sudden the "VS Code" external code editor in GitKraken would 'appear' to be mapped to cursor instead of code, with no way of changing it (other than uninstall cursor).

But changing the order of the PATH (code before cursor) fixed it for me.

jsnel avatar Oct 03 '23 14:10 jsnel

same issue for me. this is very upsetting. vscode is still my main IDE and I installed cursor to try it out for a while to see if maybe I would replace vscode down the road. I am uninstalling cursor because of this.

GitMurf avatar Oct 27 '23 17:10 GitMurf

Any news? This is still a problem.

shyagamzo avatar Nov 06 '23 14:11 shyagamzo

I am also looking for a fix, I am deleting

remove-item c:\Users\<username>\AppData\Local\Programs\cursor\resources\app\bin\code.cmd
remove-item c:\Users\<username>AppData\Local\Programs\cursor\resources\app\bin\code

after every update

I accepted the code replacement, but can't find the setting, I would like to deactivate this feature

AlxndrJhn avatar Nov 14 '23 10:11 AlxndrJhn

This issue is still not fixed. @sualehasif

A workaround for this is: Link to Cursor Forum

Souvik-Cyclic avatar Aug 02 '24 18:08 Souvik-Cyclic

Faced this issue on Mac OS. The cursor application overrides the code command and the only way to revert this is delete the code script (rm /usr/local/bin/code) and install 'code' command in PATH.

Alternatively you can edit the code script (nano /usr/local/bin/code).

-	REMOTE_CLI="$(which -a 'cursor' | grep /remote-cli/)"
+	REMOTE_CLI="$(which -a 'code' | grep /remote-cli/)"


- ELECTRON="$CONTENTS/MacOS/Cursor"
+ ELECTRON="$CONTENTS/MacOS/Electron"

This way, cursor would run cursor application and code runs vs code.

vchrombie avatar Oct 19 '24 16:10 vchrombie

The issues is still present till this day, I hope the team fix it soon, it's small but very annoying.

AhmedAlharees avatar Nov 13 '24 17:11 AhmedAlharees

If you’re in Windows, go to %localappdata%\Programs\cursor\resources\app\bin and delete 2 files: code code.cmd I hope this helped.

aady01 avatar Dec 15 '24 13:12 aady01

@aady01, after removing these files, cursor . didn't work for me anymore.

I fixed it by adding the following alias to my .bashrc shell config file:

alias cursor='"C:\Users\<username>\AppData\Local\Programs\cursor\resources\app\bin\cursor"'

As a result cursor . launches cursor, while code . launches vscode as intended.

BurakKTopal avatar Dec 16 '24 22:12 BurakKTopal

If you’re in Windows, go to %localappdata%\Programs\cursor\resources\app\bin and delete 2 files: code code.cmd I hope this helped.

This is life saver. I accidentally enabled this and wanted to revert it.

thechandanbhagat avatar Dec 18 '24 15:12 thechandanbhagat

FYI - I followed the suggestions above on my windows computer, deleting the 2 files:

%localappdata%\Programs\cursor\resources\app\bin\code %localappdata%\Programs\cursor\resources\app\bin\code.cmd

I've been using both commands (code and cursor) for about a month, and somehow it reset itself in the last week. So I'm having to delete it again. It would be great if there were a permenant fix.

jcache avatar Dec 30 '24 18:12 jcache

same

lijie97 avatar Jan 08 '25 16:01 lijie97

I agree in that installing first VSC before cursor did resolve it. Then when I have a Windows fresh installation, and installing cursor, pressing only install cursor command, then code command is registering

ulysses-ck avatar Jan 16 '25 19:01 ulysses-ck

Hello, I am not an English speaker but I hope you understand me: When you install the editor it gives you these options:

Image

By installing only the first one, what it does is that it somehow replaces the "code" of the vscode command line registered in the path with "cursor", which means that when you use "cursor" and "code" it opens Cursor, because "C:\Program Files\Microsoft VS Code\bin" was removed from the PATH

When you install only the second one, what it does is that it adds you to your command line and registers the "cursor" in the path (it does not affect the "code" of vscode), that is, you have "code" to open vscode and "cursor" to open Cursor, both separately

And when you install both you give priority to Cursor

To solve this there are several ways (if you installed both options) and you want to have the "code" and "cursor" separately:

  1. Within Cursor you can do Ctrl+Shift+P and there search for "Shell Command: uninstall 'code' command from path" and click on that option (but in the PATH it is still registered)
  2. Go to your environment variable (path) and delete "c:\Users[Your User Name]\AppData\Local\Programs\cursor\resources\app\bin" (you will see two, just delete one) and add the command line for VScode "C:\Program Files\Microsoft VS Code\bin" and that should be it.

The other way is to uninstall Cursor completely

  1. Uninstall Cursor.
  2. You delete these folders "C:\Users\TU_USER\AppData\Roaming\Cursor" and "C:\Users\TU_USUARIO.cursor" within the PATH you delete this "c:\Users\TU_USER\AppData\Local\Programs\cursor\resources\app\bin"
  3. You install Cursor again and it should show you the entire installation process

JeanHz123 avatar Feb 17 '25 01:02 JeanHz123

This issue is still not resolved, nearly two years later.

For me, the fix was: The VS Code 'code' command was only in the User PATH, while the cursor 'code' command was both in the User and System PATH. I used win + R to launch 'sysdm.cpl', and opened Environment Variables (under the 'Advanced' tab). From there, I copied the VS Code path from user PATH to the System PATH. The VS Code command then took priority over Cursor's. I guess this would persist across Cursor updates? Not sure.

bipboop1 avatar Mar 11 '25 13:03 bipboop1

That is what it says, that when you install Cursor and install its command line it eliminates the vscode path and deletes it in the ENVIRONMENT VARIABLE, that is why it is only necessary to choose the cursor (when it is a clean installation) and now for your case it seems that you installed vscode for the system and for your current user (which would not be a good option if you are the only one who uses your computer and also that you will have not very extensive problems in the path but there are some), now what you just did should solve your problem because you reset the vscode path in the environment variable (which at the time Cursor deleted it) now if what you want is to have code for VSCODE and cursor for CURSOR, it would be that you follow the steps that I left you (I will be informed if you have any problems.) And if Cursor is an Editor in development, there were recently problems in an update, it is also worth keeping up to date on its Cursor forum

JeanHz123 avatar Mar 12 '25 02:03 JeanHz123

I'm on Mac. Tried some of the solutions here and didn't work. What worked for me was:

  1. Delete the current script: sudo rm /usr/local/bin/code
  2. Open VS Code (you'll need to find it in your Applications folder)
  3. Open the Command Palette (Cmd+Shift+P)
  4. Type and select "Shell Command: Install 'code' command in PATH"

devtooligan avatar Mar 14 '25 17:03 devtooligan

On the Mac. Open the Command Palette (Cmd+Shift+P), type 'shell command', and run the Shell Command: Install 'code' command in PATH command.

Then VS Code would override it.

tantan39 avatar Mar 15 '25 18:03 tantan39

This issue is still not resolved, nearly two years later.

For me, the fix was: The VS Code 'code' command was only in the User PATH, while the cursor 'code' command was both in the User and System PATH. I used win + R to launch 'sysdm.cpl', and opened Environment Variables (under the 'Advanced' tab). From there, I copied the VS Code path from user PATH to the System PATH. The VS Code command then took priority over Cursor's. I guess this would persist across Cursor updates? Not sure.

Thanks, this works for me. Oh and for my windows machine, the path for vscode needs to be moved up to higher than cursor's path for it to work. At least for now, I can use code code . to open vscode and cursor cursor . to open cursor.

Yawhou avatar Mar 28 '25 04:03 Yawhou

Is this what we call aggresive marketing? I thought i would start with cursor, and i was really suprised to see it launching instead of my traditional well-known vsc

vesnikos avatar Apr 28 '25 08:04 vesnikos

Is this what we call aggresive marketing? I thought i would start with cursor, and i was really suprised to see it launching instead of my traditional well-known vsc

I don't even consider it a marketing strategy, it's unethical. Such thing is considered a dark pattern UX, also known as deceptive design pattern.

derciojds avatar May 01 '25 19:05 derciojds

This issue is still not resolved, nearly two years later.

For me, the fix was: The VS Code 'code' command was only in the User PATH, while the cursor 'code' command was both in the User and System PATH. I used win + R to launch 'sysdm.cpl', and opened Environment Variables (under the 'Advanced' tab). From there, I copied the VS Code path from user PATH to the System PATH. The VS Code command then took priority over Cursor's. I guess this would persist across Cursor updates? Not sure.

This is my solution for now. Thank you, @bipboop1. I also agree with @derciojds. A bug that has lasted for two years? Nope, it's intentional.

chrispmcgee avatar May 02 '25 17:05 chrispmcgee

I am here to say some very nasty words, it is very annoying and disgusting to automatically register cursor as code after every update or in the random period, as I said many times NO in the cursor settings / by deleting the code,code.cmd file from the C:\Users\USERNAME\AppData\Local\Programs\cursor\resources\app\bin and changing the priority in environment variables. It is a very aggressive and unethical strategy, but you guys chose to keep doing this, for the issue has been open for nearly 2 years.

erbanku avatar May 04 '25 16:05 erbanku

Same issue. Even removing code from the cursor path and reinstalling VSCode didn't overwrite it.

411A avatar May 05 '25 10:05 411A

If you're encountering issues with the code command opening the cursor, try running

where code on Windows

or

which code on Linux. You might see paths like:

C:\Users\<username>\AppData\Local\Programs\cursor\resources\app\bin\code  
C:\Users\<username>\AppData\Local\Programs\cursor\resources\app\bin\code.cmd  
C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\bin\code  
C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd  

or their equivalents on Linux.

In my case, removing the entries under the cursor\resources\app\bin\ directory resolved the issue. It seems like those were taking precedence over the official VS Code paths.

Hope this helps!

shahzaib3120 avatar May 19 '25 21:05 shahzaib3120

try to delete os path item that contains cursor but not working, now I decide to uninstall cursor to fix it.

LuckyCurve avatar May 24 '25 04:05 LuckyCurve

If you’re in Windows, go to %localappdata%\Programs\cursor\resources\app\bin and delete 2 files: code code.cmd I hope this helped.

Thanks it worked very well

PrimeRaouf avatar May 26 '25 08:05 PrimeRaouf

modifing the path manually so the real code would be found first is not a solution or a fix -- its a workaround

vesnikos avatar May 27 '25 07:05 vesnikos

The method mentioned above does work, but previously, even after doing that, cursor updates would still change the user configuration. However, this hasn't happened in the most recent updates, probably because the development team felt the users' anger, LOL.

erbanku avatar May 27 '25 07:05 erbanku