Helix config.toml keymap that should perform two actions but takes two tries to get them both done - toml

I set this keymap on ./helix/config.toml :
[keys.normal]
backspace = {r = [":w", ":sh cargo run"]}
And when I first call the macro after doing a change in a rust file, it just executes the cargo run command, and only writes the new changes to the disk before running on the second time I do it.
I tried to set the keymap to save twice before the cargo run, but again it just made its work on the second attempt.

Related

Why can't I continue executing Julia code in the VSCode REPL if I hit CTRL+F5?

Under Visual Studio Code (VSCode) with the Julia extension there are two REPLs. One is the standard REPL that comes with Julia. The other is some modified REPL provided by VSCode. This modified REPL has some advantages over the standard REPL.
I found two ways of running a program in the VSCode REPL. For both the first step is to select the file containing the code in the VSCode editor. The second step could be either one of these:
Hit CTRL+F5,
Click on an arrow (a triangle) that points rightwards and sits on the right-hand side of the bar with tabs at the top of the code editor.
Method 1 Is more convenient, especially since Method 2 sometimes does not work and has to be repeated.
However, there is a strong disadvantage to Method 1: After the program executes I get the message:
Terminal will be reused by tasks, press any key to close it.
After this I cannot execute code in the REPL since hitting any key indeed closes the Terminal.
This does not happen when the program is started by Method 2: after the program runs I can run Julia code in the Terminal.
Is there a way to have Method 1 work like Method 2?

Fish shell git_prompt inside TIDE

Is it possible to force Fish shell extention TIDE to
use fish_git_prompt instead of its own _tide_item_git.fish?
My goal is to make TIDE git prompt identical to this tutorial.
Right now with default TIDE setting I have this git prompt:
However, I want to make it look like this, but still use TIDE:
Source image
fish, version 3.2.1
Fedora 33
So what that tide function does is simply collect the git info and print it. Tide calls it, takes what it prints, and puts it in the correct place. This is also how the fish_git_prompt works - it prints the git stuff, your prompt is responsible for putting that in the correct place.
Simplified:
function fish_prompt
set gitstuff (_tide_item_git)
# do other tide stuff
printf '%s' $gitstuff $otherstuff
end
When fish calls a function, it goes through $fish_function_path for a file with the name of the function (plus a ".fish" suffix).
So what you would simply do is make your own function _tide_item_git, and put it first in $fish_function_path.
I'm not sure how you've installed tide, I'm assuming it's not directly in ~/.config/fish/functions - the normal directory for your functions. That's the simple case, so you can just call funced _tide_item_git, which will open it in your editor, and replace it with
function _tide_item_git
fish_git_prompt
end
then run funcsave _tide_item_git once you're happy.
In the more complicated case, make another directory for your functions - ~/.config/fish/myfunctions maybe - add it to $fish_function_path:
set -g fish_function_path ~/.config/fish/myfunctions $fish_function_path
(put that in config.fish)
make a file called _tide_item_git.fish there and put the above function in.

NppExec in Notepad++ to "Run a Macro Multiple Times..."

I use simple NPP_Exec commands in N++ which work fine for macros. Eg.:
NPP_MENUCOMMAND Macro/Action1
NPP_MENUCOMMAND Encoding/Convert to ANSI
NPP_SAVE
But how can I run a specific macro several times?
I have tried NPP_MENUCOMMAND Macro/Run but then I still have to manually select the macro I need and set it to "Run until the end of line" in the pop-up window.
You can use the NppExec plugin for simple loops like this:
:REPEAT
SCI_SENDMSG SCI_GETCURRENTPOS
set pos1 = $(MSG_RESULT)
// put your Macro invocation here instead of the linedown:
SCI_SENDMSG SCI_LINEDOWN
SCI_SENDMSG SCI_GETCURRENTPOS
set pos2 = $(MSG_RESULT)
// if the linedown (or your macro) doesnot give another pos, we have reached the end
if $(pos1) == $(pos2) goto END
// else loop
goto REPEAT
:END
it stores the current position
then it does something that advances the position (in this example a linedown, you would put your Macro invocation there, make sure it changes the cursor position)
then the position is compared with the stored position; we have reached the end, if the position has not changed;
in this case we leave the loop
I just found a simple and easy solution for that. I did not use command lines but it might work as well:
Make sure the macro ends with a Ctrl-Tab key
From Settings -> Preferences -> MISC, disable the doc switcher.
Open all files to be edited.
Use the "Run macro multiple times" dialog, and enter the number of files you have just opened.
Execute
Save all
I did not create this, found it here:https://sourceforge.net/p/notepad-plus/discussion/331754/thread/469ffec9/ , but it worked like a charm for me. I could edit 400 documents in less than 2 min.
I found another way to achieve this. Inspired by Wagner Fontes's answer, we can do the following:
Step 1: Record your Macro
Step 2 (Important): Before you finish the Macro, type the "Ctrl + Tab" as the last record in the Macro. This hotkey means moving to the next opening text file.
Step 3: Save the Marco.
Because of the Step 2, Notepad will move to the next text file after running the macro once. In this method, "Run a Macro Multiple Times" makes "Multiple Files".

Stop Matlab Command History From Jumping

Often I will want to repeat several Matlab commands from previous work, but not necessarily all at once. I can easily find these commands in the command history window and copy them across to the command window, but as soon as I execute these commands the command history window jumps down to the most recently executed commands, meaning that I have to scroll back up to find the section I was in for the remaining commands. Can I stop this jump from happening?

Create a new file with a similar name in Emacs with Helm

I always end up opening an eshell and executing find-file new-file-name, because helm always supplies me with candidates and a million options that don't look like the basic feature that I want: forcing the file to be called what I typed. For example, I want to great an org document called mto.org in a directory with another org file in it.
How can I force helm to create the file with the name I typed, so I can save 10 seconds by avoiding opening up eshell and adding a small, but (hopefully easily) avoidable disruption of my concentration?
You can press C-p and select the line
[?] mto.org
and then just press RET. It will (ask you to) create the file with the name you typed.