gvim remote tab with command possible? - asynchronous

The simplified version of my question is how can I achieve a command such as the following.
gvim --remote-tab-silent -c mak
When I run this command I am hoping for a new tab to be opened, and to have the make command run. What actually happens however is there are two new tabs "-c" and "mak"
Is there a way to do this? My end goal is to be able to within vim run a command such as this to give me asynchonous make output.
!gvim --remote-tab-silent -c mak
Thanks in advance.
--EDIT--
I found the documentation for --remote, which explains how to do a remote command with opening a file. The syntax applies to remote-tab apparently.
To do what I want I am now using
gvim --remote-tab-silent +mak MakeOutput
Similarly inside vim I can use
!gvim --remote-tab-silent +mak
MakeOutput
It automatically opens the first error in a file for me, which is convenient I would think :)

It seems like what you're asking is how to execute commands asynchronously with updates when they complete.
Have a look at my AsyncCommand plugin. It's just wraps the vim syntax required to execute something and load it with --remote. I've uploaded AsyncCommand 2.0 that includes an AsyncMake command.
Add the script to your .vim/plugin and you can build with :AsyncMake or :AsyncMake target. Errors will be opened in your quickfix once the make completes.

Related

Deleting a command from zsh history

I'm writing a shell history application, and I'm experiencing issues with deleting a command from zsh history. When I was developing bash compatibility, I used readline to manipulate history - I first deleted command from readline's history, then wrote the history to a file. After the program exits, if the history was manipulated, then I do history -r and I get the expected behavior. Since zsh does not use readline and its history command significantly differs from the one that can be found on bash, I'm left with no other choice but to manipulate the history file directly. However, when I do that, the changes are not reflected until the shell is restarted. I have tried to use zsh's equivalent of history -r, which is supposed to be fc -R, but I did not get the expected results. While the command gets deleted from history after running that, pressing the up arrow (in order to go back to the previous command, which should be the one that invoked the program) brings me to a seemingly random command in the history.
I'd appreciate it if someone explained the odd behavior I'm experiencing. Any pointers in the right direction are also welcome.
I have solved this problem in my Zsh history editing plugin zsh-hist by not touching the histfile directly, but instead doing everything through Zsh's own mechanisms:
Set $HISTORY_IGNORE locally to a pattern that matches the contents of the entries you want to delete.
Use fc -W to write the history to file. Because of HISTORY_IGNORE, the unwanted entries will not be written.
Use fc -p to create a new history from file.
Zsh documentation:
$HISTORY_IGNORE parameter
fc builtin command

Send line to console in Notepad++

Is there a way to execute commands line-by-line written in NPP editor in a console.
I have already looked at the following plugins, but they seem to execute a line or chunk of code as a standalone script (i.e. not interactive):
NPPExec;
NPPConsole;
This question is similar to this one:
Run selected line in notepad++ console
but in their case the code is being saved, executed, and stopped. But I would like an interactive console, i.e. it would bring up an instance of shell (or any other console), and I can send line-by-line code from NPP editor.
It sounds like you are looking for behaviour similar to IPython and the Jupyter Notebook or maybe just a regular debugger. I don't know of any plugin that can do that in Notepad++.
If interactive behaviour after initial execution will do (e.g. for inspection of variables), you can achieve that using the interactive flag -i in NppExec like this:
cd $(CURRENT_DIRECTORY)
python -u -i $(FILE_NAME)

iexpress not executing installer

I have an install.bat file and a resource folder. so long as these two files are in the same directory, if you run install.bat, it will install a my lwjgl game. so what im trying to do is make a self extracting file that when completed runs the launch.bat file. I have tried using iexpress, and got it working for the most part. i have added in all my files and such so it will extract to some directory and then i can run the install.bat file to get my program to work. thing is though, i want the exe i created with iexpress to launch install.bat when its finished. so, i tried using the option in iexpress that says it will execute a command when finished the "installation" (using quotes because its not the actual installation, just extracting the files to some directory specified by the user). when i get to the step where it says what i would like to execute during and after the "installation". during the installation i left blank. after the installation i chose the install.bat file. when i try to click next though, it tells me i must choose something for the command during the extraction. I don't have anything specific to do during the installation so i just said "echo." (without quotes). after i was done i tried running the installer. before it even prompted me for a folder to extract to, it told me that echo. could not be executed. so i went back into my installation (via a .sed file) and changed the "echo." to "pause". that didn't work either. i then read on another website that in order to run a file the way i would like to, i put the file name in both the during and after installation boxes. i tried doing that and it didn't work either. can anyone please help me?
If I understood your question correctly you will need to specify what the iexpress must do at the post install command option provided so that cmd.exe is used instead of command.com, eg:
cmd.exe /c filethatyouwanttorun.bat
Refer to the question: Create Batch file for iexpress.
You can use the SED file and then modify the self extraction directive. This will run the batch file that you wanted to run and then install the application. (If you have chosen the option to extract and run an installation in iexpress, a temp folder will be used for the extraction I suppose.)
I'm not sure I understand your question exactly but perhaps a few points would help:
If you want a "do nothing" command, you can use something like:
cmd /c echo.
There is no "command during the extraction". There's only an install program and a post install command. Both of these execute after extraction. If you only need to execute one batch file, put it in the install program line and leave the post install command blank.
You can't ask the user for an extraction path and execute a file. You can only do one or the other. (The install program could prompt the user and copy the files there, though.)

Changing interpreter bash script

Is there any way for changing the interpreter in the middle of a bash script
For instance start with:
#!/bin/bash
Later change to:
#!$drush_location
The reason is because I want to use bash to resolve the location of drush using bash and then pass that var in as an interpreter
You will need to write two scripts and use the first (bash) one to launch the second (drush).
There are other ways to accomplish this, but they are all basically fancy ways of doing the above. For example you could use a here-doc to cram a script contained as a string in your first script into stdin on drush and have it execute that, or even write a temporary file and execute that as a script, but you have to run two processes somehow, you can't change the interpreter on the fly.
Really the thing to do would be to fix your environment so that it can find drush. Then you can use:
#!/usr/bin/env drush
As the hashbang for your drush script. If your system evn can't find it, then fix your search paths until it can!

Zsh wants to autocorrect a command, with an _ before it

I just started using Zsh lately for some of the integrated support in the shell prompt for my Git status etc.
When I type in:
ruby -v
to confirm the version of ruby I'm running, Zsh asks if I want to change the command to _ruby. Well after saying no at the prompt and the command completing as expected I continue to get the question at the prompt after confirming my command is correct.
I'm assuming there is a completion file or something of the sort.
Thanks
Update:
The shell is no longer trying to complete _ruby, it stopped responding after closing the shell a few times some how.
I tried to clean the file up several times but there is a "opts" variable that is 50 or more lines long and the lines are all ran together, some lines more than 150 characters. Maybe I could email an attachment to you if you still want to see it.
I sincerely apologize for the messy post.
This is command autocorrection, activated by the correct option. It has nothing to do with completion. You're seeing _ruby because zsh thinks there is no ruby command and it offers _ruby as the nearest existing match.
If you've just installed ruby, it's possible that zsh has memorized the list of available command earlier, and it won't always try to see if the command has appeared in between. In that case, run hash -rf. Future zsh sessions won't have this problem since the ruby command already existed when they started.
Sometimes, when you change your PATH, zsh forgets some hashed commands. The option hash_listall helps against this. As above, if you can force zsh to refresh its command cache with hash -rf.
You could make an alias:
alias ruby='nocorrect ruby'
It's what I did when zsh kept asking me if I meant .meteor when I typed meteor because auto-correct is still useful from time to time.
I find the autocorrect feature can get annoying at times. So I do in my ~/.zshrc,
DISABLE_CORRECTION="true"
I had the same problem even when the command is not installed.
I can solve it using the CORRECT_IGNORE variable in my .zshrc
# OPTs to enable
setopt HASH_LIST_ALL
setopt CORRECT
# Zsh variable to determine what to ignore,
# in this case everything starting with _ or .
CORRECT_IGNORE="[_|.]*"
I hope it helps to you or anyone with this issue
Sometime ago after an update, I got command auto-correction enabled which I don't want. If the same happened to you and you want to revert it, in the ~/.zshrc file you'll have make it:
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="false"
or comment it as per bellow:
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
Just a note, on my zsh (version 5.7.1 on macOS), the DISABLE_CORRECTION didn't work.
I saw in my .zshrc file the following two lines, which I then commented out
setopt CORRECT
setopt CORRECT_ALL
That did it for me.

Resources