vscode terminal jump word shortcuts

14 次查看(过去 30 天)
I know this is not a 100% matlab specific question, but since it is related to the matlab official extension for vscode, I think it might be ok to ask about it here.
I am currently running matlab without GUI extlusively through vscode, since there is a bug in matlab 2025a on linux which prevents me from using dead keys on neither the workspace nor any of the built in editors.
It has worked great so far for my use case, but on vscode terminal (which is equivalent to matlab's workspace), I cannot find any way to enable ctrl+arrowleft to jump to the beginning of current word or ctrl+arrowright to jump to the end of current word. Does anyone know how to enable this functionality?
Thanks

回答(2 个)

Ruchika Parag
Ruchika Parag 2025-7-7
Hi @Sebastián Gómez Jorge, you're right that this isn't strictly a MATLAB-specific question, but it's definitely relevant if you're using the MATLAB extension for Visual Studio Code in a no-GUI setup. The issue you're seeing—where Ctrl + ← and Ctrl + → don’t move by word in the integrated terminal—is typically related to how the terminal emulator in VS Code handles keyboard input, especially on Linux.
To isolate the cause, try launching MATLAB using matlab -nodesktop -nosplash in a standard terminal (like GNOME Terminal or xterm) outside of VS Code. If the shortcuts don’t work there either, the issue likely lies with your shell configuration rather than VS Code.
If you're using bash, check or create a ~/.inputrc file and add the following:
"\e[1;5C": forward-word
"\e[1;5D": backward-word
Then run bind -f ~/.inputrc to reload the configuration.
VS Code itself might also be intercepting those key combinations. Check your keyboard shortcuts in VS Code (Ctrl+K Ctrl+S) and search for Ctrl + Arrow. If anything is bound to those keys globally or in the terminal context, try removing or reassigning them.
If the issue turns out to be with the integrated terminal alone and everything works fine in a standalone terminal, you can configure VS Code to launch an external terminal for MATLAB interactions. This can be done by editing your settings.json with a line like:
"terminal.external.linuxExec": "gnome-terminal"
This is ultimately a combination of shell behavior and terminal emulation, rather than MATLAB itself. That said, it’s reasonable to bring it up here since it directly impacts how you interact with MATLAB in your setup. Hope this helps!
  1 个评论
Sebastián Gómez Jorge
编辑:Sebastián Gómez Jorge 2025-7-7
Thanks for the answer, but the issue with ctrl+arrow is not linux exclusive. I have linux on my office machine and windows on my home machine. To keep the workflow as similar as possible, I've been running matlab through vscode at home as well, and the issue is also present on a windows machine. I'll test your suggestion though, and see if it can be fixed by adding a bash shortcut on linux at least.
Additionally, the shortcuts are setup correctly in vscode, and they work both on the editor itself and on the powershell terminal you can open in vscode on a windows machine (I'll test on the bash terminal that can be open in vscode on the linux machine later today). Thanks again
Edit: I just tried starting matlab from the terminal in linux with no gui, and ctrl+arrows work as expected there, so the issue is with vscode and matlab extension

请先登录,再进行评论。


sudobash
sudobash 2025-7-7
Hey Sebastian,
I too face the same issue. Looks like this has been raised on the GitHub repo as an issue: https://github.com/mathworks/MATLAB-extension-for-vscode/issues/249
Let's track this issue until it gets fixed.
I tried setting up custom key bindings VS Code, but was not successful.
  1 个评论
Sebastián Gómez Jorge
yes, I tried to add custom shortcuts as well with no success. It seems the issue is not related to the OS, as I see this both on linux and windows, an the report on git is for MacOS. Hopefully it will be fixed in the future.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2025a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by