Ctrl+S and Ctrl+Q can be used to pause/resume output in bash shell.
But in fish shell, it does not work.
Are there any replacement?
This is intentional. Fish disables terminal flow control because the original developers concluded the feature causes too many problems for inexperienced CLI users especially those used to emacs where [ctrl-s] is normally bound to the incremental search function and thus might type it at a shell prompt.
On the upside, the same functionality can be added to your fish shell with a function and a key-binding.
See the following plugins, for example:
https://github.com/oh-my-fish/plugin-sudope
https://github.com/oh-my-fish/plugin-bang-bang (implements the !! variant)
Related
For example, I would like to add completion to adb so that when I hit Tab after adb I can see sub-commands like shell and install. In Bash or Zsh the completion is always in separate file, so this is not an issue. How do I do similar thing in PowerShell (if ever possible)?
Use TabExpansion++.
There is precedent for using a script to generate completers for native commands (see here).
(The comment about PowerShell using Intellisense is incorrect.)
I am using fish terminal inside of Emacs term
My normal prompt on load looks like the following
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
$>
Ok, when I load fish term inside of term.el it looks like this
Welcome to fish, the friendly interactive shell
Type helpB for instructions on how to use fish
7;file://Collins-MacBook-Air.local/Users/collinbell/Programs/riddley⏎
$>
A cd command in my normal terminal looks like this
$> cd ~/
$>
However in the emacs term.el it looks like this
$> cd ~/
7;file://Collins-MacBook-Air.local/Users/collinbell⏎
$>
I have no idea why it is pasting the cwd into the buffer, but it does it every time a directory changes. Emacs also makes the system sound after this, while other commands like ls do not make the system sound.
This is obviously not the biggest issue in the world, but I do run clear as a pre-command to keep my terminal looking clean (although I turned it off for this example) and Emacs pasting this line into the buffer really messes with sublime usage.
You seem to be experiencing a known issue.
Try this fix:
In your fish config file ~/.config/fish/config.fish add the following:
function fish_title
true
end
Also, see this from the fish documentation, though according to the github issue, the fix suggested in the docs might not work, while the above function does.
According to the fish documentation, this is what's going on:
Fish is trying to set the titlebar message of your terminal. While
screen itself supports this feature, your terminal does not.
Unfortunately, when the underlying terminal doesn't support setting
the titlebar, screen simply passes through the escape codes and text
to the underlying terminal instead of ignoring them. It is impossible
detect and resolve this problem from inside fish since fish has no way
of knowing what the underlying terminal type is. For now, the only way
to fix this is to unset the titlebar message, as suggested above.
I am using cygwin on windows 7. I have a question regarding the Emacs shell.
Whenever I use the shell inside of the Emacs(M-x shell)
It echo pwd directory after prints out the result.
I found it very annoying since it distracts me.
e.g.
$ ls
workspace
^[]0;~/cs61bl^G
myname#pc ~/cs61bl
Is there any way to remove these lines?
^[]0;~/cs61bl^G
myname#pc ~/cs61bl
When using Emacs, try using the eshell: M-x eshell. The eshell does not suffer from this problem.
You might be looking for "shell-dirtrack-mode". You can either do an M-x shell-dirtrack-toggle or (shell-dirtrack-mode 1) in your init file. Recent emacs versions seem to disable it by default.
There is this file http://www.emacswiki.org/emacs/setup-cygwin.el that simplifies setup of various packages in Emacs (including shell) to use cygwin. Also try not to use ANSI sequences in your PS1 prompt because Emacs shell mode wouldn't interpret them, something like
export PS1="\h \W\$ "
should do.
I was told that in ZSH you could do something like command and then when you hit up it would filter the history based on the given command. But when I try this it just cycles the history like bash does. Is this disabled by default?
Hit Ctrl+R, type some letters, it will find the previous command with these letters, keep hitting Ctrl+R to continue through the previous findings.
Works in bash, zsh (and other shells i suppose).
What i personally like to have is: type some letters, press Up, the previous commands starting with the same letters appear. Very powerful, i love it.
You have to bind the keys you want to history-beginning-search-backward and history-beginning-search-forward.
In case it's not enough for you, zsh has a lot of options, try to look in Zsh Line Editor and tell us.
For bash, less powerful but more common, Bash commands for history.
Use exclamation point:
> !<starts-with this string>
You can arrow up/down through all commands that started with that. I use "!v" all the time to get my previous command for opening a file with Vim.
You can also use a question mark to search beyond matching the beginning of the string,
> !?status
Can find "git status".
Use percol to dynamically search and navigate through your history with Ctrl-r.
install percol: sudo pip install percol
add the zsh-history-search code snippet to your .zshrc file.
After a Ctrl-r, you can see your whole history in the same window. Searching for a keyword (dynamically) narrows that list down. You can use key-bindings (like this emacs like config) to navigate up and down the list and eventually make a selection.
Here is a search for all sudo install commands available in history with sudo make install selected.
Enter issues the selected command.
We can also use fzf to fuzzy search the command history interactively.
Here is how to install:
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
Say yes to all its configs. After that, restart your zsh shell, and press Ctrl-R, whoa, interactive command history search pops up. Enjoy!
With the vim keybindings activated in zsh you can use vi-history-search-backward (/) when in vi command mode.
That's a feature available in fish, but it seems like someone made a zsh plugin for it. It's not available in standard ZSH.
If you don't want to add any keybindings, you can search by default using Ctrl+R to move backward & Ctrl+S to move forward.
You can start search with any of the key shortcuts Ctrl+R or Ctrl+S
When using emacs for writing erlang source code, I have made the following configuration.
In the emacs, 6 windows are open at the same time, 4 windows for source code writing, 1 windows for terminal shell, 1 windows for erlang shell.
After one source code modification, I have use command "m-x ter" to switch "terminal shell", then using "m-p" for recovering last history command, then pressing "enter" to run.
Then using "c-x, left " to switch to erlang shell, then press m-p to repeat last command.
The above two switch process seems a little long, could you have better solution?
The compile function is the general mechanism for such things, and the compile-command variable tells it what to do (as a shell command to run).
By default, the command is make, so if you have a Makefile, you're already sorted.
If not, and writing one isn't appropriate, then you can customise compile-command for your files, perhaps using local variables.
File-local variables for this purpose are covered in the linked Q&A.
You can also use Directory-local variables if you want it to automatically apply to all files under a given directory.
Or if there's a general pattern which can be applied to all erlang files, everywhere, then you might set up compile-command using the erlang mode hook.
Finally, you can just supply the command on demand. Called interactively, M-x compile prompts you for the command to run, and uses the previous command as the default for the next time.