Shorcut for `Run Line(s)` in Octave / Matlab - octave

In RStudio it is Ctrl+Enter, while in PyCharm it is Ctrl+backslash, but I can't find a similar shortcut for Octave (not so interested in Matlab). There has to be a way to run a single line of code on the editor without running the entire document. I know there is a method to run chunks of code, but this doesn't seem practical, either.

You need to select the code that you want to run first. The actual shortcut to then execute the selection is configurable (Edit > Preferences...) but defaults to F9.
Or you can right click on the editor which shows you the options and shortcut:

Related

Octave (GUI): Clear all variables of the work environment in one go

GNU Octave, Version 6.1.0, using the GUI:
Is there a way to clear all variables that are listed in the work environment without restarting Octave and without clicking and clearing every single variable?
This is needed for a cold start when switching to a new task, when you still want to keep opened the already opened files.
Taken from the helpful comments, here are the ways to choose from:
Type "clear" in the editor.
Edit->Clear Workspace in the menu.
Not recommended of course, but possible: you could also just close the GUI and open it again. Then, you should at best use the setting to re-open tabs from the previous session when you close the GUI and open it again. See Edit -> Preferences -> Editor -> File-Handling -> Restore Editor Tabs from previous session on startup or when editor is shown again after closing

Set syntax for a specific file name in Sublime Text 2/3

I have a program that uses a file called user.cfg to get its user defined configuration settings. The odd thing is that they chose the syntax for this file to be Tcl (it's not odd that it is Tcl, it's odd they chose the .cfg extension instead of .tcl). So, when I open this file in Sublime Text, it doesn't know what syntax highlighting scheme to choose.
What I would like to do is set the syntax highlighting for user.cfg to Tcl, but not all .cfg files to Tcl.
I have seen this question which is very similar to mine, except in that case the special file name had no extension so Sublime Text knew to assign Ruby highlighting to only that one file. Unfortunately, I have an extension so the solution given there will not work for me.
Is there any known way to get Sublime Text base a highlighting scheme on the full filename?
Take a look at the ApplySyntax plugin.
The previous answer is completely true; however, I thought it would be better to have it here all in one place rather than going on another webpage to find the list of procedure to apply it
Sublime text 3
This is found here
Ensure Package Control is installed. Instructions are found here.
In Sublime Text, press Ctrl+Shift+P (Win, Linux) or Cmd+Shift+P (macOS) to bring up the quick panel and start typing Package Control: Install Package.
Select the command and it will show a list of installable plugins.
Start typing ApplySyntax; when you see it, select it.
Restart to be sure everything is loaded proper.
Enjoy!

Add a new command to notepad++

Notepad++ is my go to editor for most things. I would like to develop a new command(keyboard shortcut) for doing something unique. Anybody has any pointers regarding how I can do this?
I would like to create a command which arranges selected text in certain order based on the characters found. I would also like create a keyboard shortcut for running the same command.
You have several options:
develop a macro - examine Macros dropdown menu in Notepad++
use AutoHotKey which can send keystrokes/mouseclicks, run apps/DLL's, work with clipboard, read any system settings, take values from input boxes and many more. Please see here for its sample usage with Notepad++
use JN plugin for Notepad++ and script your functionality in JavaScript - example. Similarly, there is a Python scripting plugin, too.
write your own N++ plugin. You get the best control, but without experience this is the most difficult option.

How to change the load path in Octave

I have a problem with loading images and editing scripts in Octave. I think Octave has the wrong path or something. When I say 'edit', it says:
sh: 1: emacs: not found
What does that mean?
I'm pretty new to both Octave and MATLAB, but when I'm at school using MATLAB, for example, writing the command 'edit' works...
How do I know where to put files I want to load in Octave, and how do I change the path?
The problem is not with your path, the problem is that you didn't set up EDITOR (see help EDITOR and the editor option at help edit). As you have no environmental variable for it, it defaults to emacs so when you run edit, it tries to open the file in emacs and fails because you don't have it installed. Set up EDITOR for your text editor of choice at .octaverc file (If I remember correctly, the text editor to use is set as a persistent variable inside edit.m so you'll have to restart octave) or an environmental variable (I'd recommend this one).
It works in matlab because they made their own text editor. Octave is not a text editor, it's a programming language, it would be a waste of time to reinvent the wheel, and you should be able to choose whatever you are comfortable to code with.

Is there Octave's equivalent for iPython's "!"

For example,
!vim
in iPython opens vim. Is there such a thing in Octave?
The following might work system("vim");
If you want the interactivity of calling something inside of Octave and interactivity with it directly try exec("vim") instead.
See Controlling Subprocesses for more examples.
Otherwise you can either combine calls to system, fork and exec or extend octave with Python/iPython or C++.
If you only want to run another process then , the already suggested system() or exec() should work.
However, if you plan on using this to simply open up a text editor and edit an Octave file, set the value of EDITOR with EDITOR ("vim") (you can add this to your .octaverc file) and then use edit (foo) to open up the foo function on the text editor.