Notepad++ Macro to open specific file - macros

How can I create a macro in Notepad++ to open a specific file (for example C:\Users\ega\all.txt) ?

Instead of a Macro I used 'Run' and browsed the file and added a shortcut.

the question has sense: perhaps one would need firstly to open a specific file, then to operate with it and save operations in a single macro

Related

how to add your own zsh simple filetype completion?

I am guessing that I should not edit the .zcompdump file, because it may be overridden. Is this correct? but what is the recommended mechanism to extend it? let's say I simply want my latex command, called mylatex, which should only be run on .tex files. in .zcompdump, I see
'pdflatex' '_tex'
presumably, I should not just add a line
'mylatex' '_tex'
how is this done?

Using vim as default editor for matlab

I want to use gvim as the standard editor for Matlab. It used to work on Linux but now I am forced to use windows and I can't seem to figure out how to set the editor such that files are opened in gvim in a new tab.
In the preferences there is a field which allows to pass a command that points to the prefered text editor. That works, but things fail when I try to give additional options, in my case that would be "--remote-tab-silent" to tell gvim to open the file in a running instance in a new tab. More specifically, the following line in the matlab preferences works:
C:\pathtovim\gvim.exe
while this one fails
C:\pathtovim\gvim.exe --remote-tab-silent
A command line opens with the following error message (my own translation from German):
The command ""C:\pathtovim\gvim.exe --remote-tab-silent"" is either spelled incorrectly or could not be found.
My guess is that it has something to do with the additional quotes, I have no idea why the command is issued with quotes, even though in the field I put it without. The follwing commands work when typed into the command line directly:
"C:\pathtovim\gvim.exe"
C:\pathtovim\gvim.exe --remote-tab-silent file.m
and this one fails:
"C:\pathtovim\gvim.exe --remote-tab-silent file.m"
I'd really appreciate any help! Thanks!
I can't find a good way to hack around it through the MATLAB settings; it looks like MATLAB is stupidly expecting the text editor to take only file names as arguments.
I think your best option, is to create a .bat script that simply passes any arguments it receives on to Vim, inserting the --remote-tab-silent.
I.e. create a .bat file with these contents:
"C:\pathtovim\gvim.exe" --remote-tab-silent %*
Then set up your MATLAB preferences to invoke the .bat file rather than Vim.

How to get the target of a shortcut?

How can I resolve a shortcut to its ultimate target on Windows programmatically?
I specify "ultimate" above to include the general case
shortcut → shortcut_1 →… → shortcut_n → target, in which there may be one or more "intervening" shortcut(s) in reference chain between shortcut and target.Also, I specify "programmatically" to rule out solutions that require interactive use of some feature of the MATLAB GUI.
(On Unix systems, one way to resolve shortcuts is to use something like system(['readlink ' shortcut]), or even better, if available, system(['readlink -f ' shortcut]). But I have not been able to find anything like this on Windows.)
If you open the shortcut file and read the first line you should see it.
>>fID=fopen(shortcutpath);
>>C=fgetl(fID);
C =
*some weird string* *filepath* *some other weird string*
Then with regexp you can find it easily.
Assuming your goal is just to open the shortcut to its destination, it seems to be as easy as on unix. Simply use this code to open a shortcut named sc in your current directory:
!sc.lnk % Equivalent to system('sc.lnk')
If the file is not in your current directory you need to add the path of course. If the shortcut refers to a shortcut it automatically ends up on the final result.
You could do it using COM.
Example:
server = actxserver('WScript.Shell');
path = server.CreateShortcut('D:\temp.lnk').TargetPath;
server.delete;
As Windows doesn't allow a shortcut to a shortcut, you get the "ultimate" target. :)

In Emacs, how can we go to another file already found by the previous dired-find-name / findr.el?

This is in accordance to question Using Emacs to recursively find and replace in text files not already open. I already tried using find-name-dired and also package findr.el. It did open a file where the matching text found, but... how can I go to another file, not this automatically opened file????
Thank you!
This seems like more than one question.
find-name-dired will create a results buffer listing all the files with matching filenames. Use C-h m to see dired-mode's help, and all its key-bindings. RET will open the file at point, o will open the file at point in another window, and C-o will do the same, but leaves you in the Find window (which is convenient if you want to quickly visit several of those files).
findr-search (which is what it sounds like you're using) appears to work more like a tags mechanism. C-h f findr-search RET says that you can navigate to the next match with M-,. This will cycle through the matches in the current file, and then on to the next file as necessary.

In Emacs, how can I jump between functions in the current file?

I'd like to quickly move point to a function in my Emacs buffer. I'd like to run some function and get a prompt asking me for the function name, with completion provided for every function defined in the current buffer.
I generally use etags to navigate around, but sometimes I'm looking for a framework method that's been overridden in several files. In these cases, I can find the file I need but then I'd like to quickly jump to the function there. There is a similar feature in TextMate where you can select a definition from a list in the bottom right of the editor.
Just to jump around functions in the current file? Use imenu. It's the simplest and lightest of all the alternatives listed so far and might be enough for what you want. It's also built into Emacs and has minimum setup hassle. It features graphical and textual interfaces. Anything extra and you'll be better off using one of the other excellent suggestions made here.
speedbar comes standard, and gives you a collapsible menu for each file in the current directory, by default middle clicking on an entry for a function definition jumps to that def. With emacs23 this was changed to the more normal leftclick.
You can use etags-select to select from multiple matching tags. But the answer to what you asked is imenu.
Icicles is probably closer to what you are looking for:
http://www.emacswiki.org/emacs/Icicles_-_Tags_Enhancements
It's an enhancement to etags and includes (among other things) the file name with the tag so you can tell if it's the one you are looking for.
try CEDET. It is a bit difficult to set up the first, but here is an excellent tutorial: by Alex ott
And when he gets installed, you can use semantic-complete-jump. pressed tab couple times, and it is also brings up symbol definitions.
If M-. brings up the wrong method, you can type C-u M-. to find the next one with the same name.
global gtags is very good
To navigate within the current file or a set of files that you select, you do not need a TAGS file. You can use Imenu. But it is better to use Icicles imenu commands.
Why? Because they let you use completion. Substring, regexp, prefix, or fuzzy completion. Combine simple patterns to match, or subtract them.
Command icicle-imenu is bound in Icicle mode to C-c =. Butyou can also look up just a command or just a non-command function (non-interactive), using command icicle-imenu-command or icicle-imenu-non-interactive-function.
These commands are multi-commands, meaning that they are actually browsers: you can trip among function definitions using keys C-RET or C-mouse-2 (direct jumps) and C-down (cycle). Hit RET or click mouse-2 to settle down at a final destination.
I use C-M-a and C-M-e to jump between the beginning and end of functions.
Otherwise, open up Speedbar and click the + icon next to a file name to view a list of functions contained in the file. Then click on the function names to jump to them directly.