Fish is not returning to new line after executing bind - fish

I'm binding Ctrl+f to fg so I can Ctrl+z and Ctrl+f back into vim. However after two times doing the combo twice, it ruins the terminal:
user#pc:~$ vim
Job 1, 'vim' has stopped
user#pc:~$ Send job 1, “vim” to foreground
Job 1, 'vim' has stopped
^F▉
Cursor is now not on a line (which begins with user#pc) and executing any command show it as string (^Fas example).
Pressing enter fixes this, but there should be a better solution.
Edit: using bind \cf 'fg; commandline -f repaint' shows the PS1, but it's still in text mode, meaning pressing Ctrl+f, doesn't run fg but outputs ^F.

Solution was to instad of using:
bind \cf 'fg'
use:
bind \cf 'fg; commandline -f execute'
It ocassionaly does an extra enter, but whatever.

Related

Execute highlighted command with single keypress in fzf

I'm using fzf Ctrl+R binding to navigate the command line history. Now first Enter keypress selects the command, and the second one executes it.
Is it possible to configure fzf to perform both of these actions with a single keypress?

Neovim: how to send keys to terminal emulator

When I open up a nvim terminal emulator and enter the following command, trying to execute command 'python':
:normal! ipython
It turned out the register content is pasted onto the screen, as if 'p' is pressed under normal mode, even if 'i' has been pressed in prior to (supposedly) enter terminal-insert mode.
This does not help either:
:execute "normal! ipython\<CR>"
Where have I gone wrong, and how could I do it correctly?
Alternatively I used termopen() to execute a command in the terminal on start, something like
:call termopen('python')
But still, no idea about how to do so with normal!.
:normal! ipython
doesn't mean "run the program". It means "switch to Normal mode and run !" which is a filter command; then run i that is switch to Insert mode and insert "python".
To run a command from the vim command line use
:!ipython

Ctrl+c not working in integrated terminal which uses Powershell

I'm using Powershell in the integrated terminal by adding the following line to the settings.json file.
"terminal.integrated.shell.windows": "C:\\WINDOWS\\system32\\WindowsPowershell\\v1.0\\powershell.exe",
It works very well, but usually, when I'm in Powershell, typing ctrl+c cancels what I had typed and opens a new line.
But in the integrated terminal it just prints ^C.
Is there a way to fix it or find an alternative method to achieve this?
Thanks
This is with VSCode and not necessarily with the PowerShell Extension. You can see this by just using the default cmd.exe terminal, CTRL+C does nothing. It does not print the ^C at all, and creates no new line.
If you want this to work as expected in the normal command prompt or PowerShell.exe you will need to submit an issue to VSCode repository and request it.
I would expect this is all tied to the keybindings.json file. I went through that file but could not find a command available to the same function that occurs in the full command prompt or console. So this will likely need a new command added for VSCode.
If you search through the keybindings file you can see the terminal has that key CTRL+C bound to copySelection when terminalFocus && terminalTextSelected. This is why the ^C is being output, and no new line is being added.
A workaround:
Pressing Esc will erase the line back to the beginning.

How do I make MINGW not wait for Sublime Text to close before accepting more commands?

On my Windows, I managed to get sublime text become a command on my MINGW terminal. I'm able to open sublime text itself or open sublime text with a text file. However, the terminal won't accept more commands until I close the terminal. It's similar to calling vim, where vim needs to exit before it accepts more commands. But sublime is its own window, so there's no reason for a terminal to wait. What is the way to configure a command in such a way that we don't wait for it to terminate before the terminal accept more commands?
Is it a bash compatible shell?
The most obvious way of doing might be to append an & to the end of
the command. This detaches the command from stdin which means the
shell isn’t tied up by the command and you can execute other commands.
However, the command's process is still managed by the shell and
stdout and stderr are still attached to the shell session. This means
that when the shell session ends (you close your terminal window, exit
ssh, etc) the command’s process is sent a HUP signal, which usually
terminates the command.
Refrence:
Running bash commands in the background properly

How can I detect that a command completed its output in a tty?

I'm studying the code of Mobile Terminal which is a command line for iPhone.
The projects emulates a VT100 terminal.
I can monitor everything that goes through the terminal (ascii and control characters)
but I can't figure out how the terminal knows that a command completed its output. How
does the terminal know when to display the prompt again ? Is there a special control
character that every command sends when ending ?
To me it sounds like you're running a shell in the terminal, because a VT100 doesn't show a prompt (AFAIK).
A shell creates a child process and executes the command there. The shell then simply waits until this child process is finished and then prints its prompt again.
An exception is when the command is run in the background (some_command &), the shell doesn't wait for the child to exit and immediately prints the prompt again.