Open ghost opened 6 years ago
I think I would be the best to search for the next 'uncommented line' to check if the line starts (excluding whitespaces) with the % character. I propose this because I often use block comment (%{ ... %}) to add some usage examples to the functions help section. For the evaluation of these examples I am in commented lines but they doesn't begin with a % character. The feature to execute the current line without moving to the next line was introduced to quickly test the current line or lines in functions or methods. Therefore, I would suggest keeping the current function and introduce the new function with a new shortcut (e.g. CTRL+F9).
@cowlumbus
- Evaluate current line or section. [...] only evaluate the selection.
Isn't this the behavior of F9?
- Evaluate current line and move to the next line [...]
This is definitely an improvement.
@MartinLechner-TD I could check whether the SHIFT + F9 was called inside an block comment. if so jump to next line inside block comment. otherwise skip block comments.
@GavriYashar Evaluate current line or section. [...] only evaluate the selection. Isn't this the behavior of F9?
F9 only runs if a chunk of code (either a variable, a section of a line, a line, or multiple lines) is selected. I like your function of run the current line without selecting it. Now I want to know if we can combine these two functions into one hotkey like what RStudio does. Thanks.
oh... haven't thought of that. should be possible. I'll consider making it an option to let users choose which one they prefer. This would allow users to backup if Matlab doesn't behave as it should after MEP is installed.
Thank you for the beautiful MEP tool.
I wonder if we can have the following two features:
Evaluate current line or section. If no selection, evaluate the current line (also see the Feature 2 below). If a line or part of a line (e.g., a variable, etc) is selected, only evaluate the selection.
Evaluate current line and move to the next line Currently, the SHIFT+F9 will select the current line and execute it. After executing, the line remains selected. Is there a way to set it to move the mouse cursor to the next uncommented line? This is a really convenient feature in RStudio.
The following post has a solution to this. However, it does not provide a way to customize the shortcut key. I replaced the shortcut key (SHIFT+F9) to F4. One key is easier to handle than two keys.
https://www.mathworks.com/matlabcentral/answers/132119-keyboard-shortcut-to-evaluate-current-line
Thanks.