Terminal does not seem to have reverse-i-search (ctrl-r does nothing) - linux

I'm ssh-ing into a remote machine and when I try to search my history in a linux terminal with reverse-i-search, nothing happens. I press ctrl-r as I usually do on my machine, but the prompt doesn't appear.
Any ideas? How can I check the keybindings for ctrl-r? How do I set them if they aren't set? Do I have to apt-get reverse-i-search functionality?
Thanks!

To use ctrl-r your shell needs to be using readline (or something similar), your history should be collected.
So you should verify your shell for example sh doesn't support this.
You should check it the history is collected. For example with bash shell: echo $HISTFILE
I think these can be the main reasons.
Hopefully with simply entering bash, you can switch to a proper shell which will support this.

Related

open vim file in new unix terminal

How to open existing vim file from unix shell (bash) in new terminal (not in same/new tab of existing terminal) on local machine ?
Also is there any way to split file on new terminal (not in same/new tab of existing terminal) from inside vim ?
How to open a new terminal is platform dependent; This doesn't really have a whole lot to do with vim itself.
For example, if you're using GNOME you could do this by running gnome-terminal -e "vim $filename" & disown. Look up the documentation for the terminal emulator you're using to find out how to launch a new terminal and execute commands in it.
Another (IMHO much better) solution is to simply use GVim for situations like these, unless you have a very good reason to run vim in the terminal (if you're running this over ssh this won't work anyway, in that case you're better off using a terminal multiplexer like screen or tmux).
PS: bash isn't a terminal (emulator); bash is a shell. If you just run a new instance of bash it'll run in the same terminal, which is not what you want here.
Try this:
vim [your file]
If this isn't working for you, make sure you have it installed with:
sudo apt-get install vim
If you're already IN vim do
:edit [your file]

Which project provides the terminal emulator used by the bash from Git for Windows?

I am having a problem* with the bash that comes with Git for Windows.
But I don't even know where to start looking/googling/reporting the bug.
It seems that all of MINGGW64 (= MinGW-w64?), MSYS, Cygwin and maybe Mintty are somehow involved, but I don't really understand the relationships between them.
Which one is providing the terminal?
* It ignores the VT100 escape sequence sent by echo -e '\033[?1h' which should put the cursor keys in "application mode" (= make them send <ESC>OA instead of <ESC>[A).
I assume you have already found, if not
https://mintty.github.io/

Mark mode in Terminal without mouse

Is it possible to enter mark mode(to mark text in Linux terminal) without mouse. In CMD you can ,alt+space+e+k. Can it be done natively without 3th party programs?
Regardless of your terminal you can enable vi mode for you shell, both bash and zsh support this.
A quick one (without installing third party programs) would be to set -o vi in your shell to enable vi and use the shortcuts
If you don't like it you can always come back to emacs: set -o emacs

Vim + zshell, "zsh suspended" after running a Vim external command

Vim newbie here (has worked with zsh for a few months now). I think I install too many dotfiles or have a wrong configuration because whenever I attempt an external command (even thing such as :!rm TEST, Vim exits with a message zsh: suspended (tty output) vim .. How do I fix this?
The dotfiles: https://github.com/daryllxd/dotfiles. (I got them from someone else).
Try to comment this out:
set shellcmdflag=-ci
If this doesn't work for you look at the following.
From the manual:
Commands are first read from /etc/zshenv; this cannot be overridden.
[...]
Commands are then read from $ZDOTDIR/.zshenv. If the shell is a
login shell, commands are read from /etc/zprofile and then
$ZDOTDIR/.zprofile. Then, if the shell is interactive,
commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally,
if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are
read.
From what I understand,
set shell=zsh\ -i
should work.
if u want back to the vim by suspended,u could use fg,just like this:
fg %vim\ [u viming file]
this title maybe help u:http://ytliu.info/blog/2013/09/28/ttyde-na-xie-shi-er/

Screen and Cygwin: no tab completion?

I'm having some problems working with my development environment. Specifically, after I invoke the screen utility from within Cygwin I lose the ability to do tab completion. Before I invoke screen however tab completion works just fine.
I messed around with setting different values for the TERM env variable (VT100, xterm etc) but without success. It must be something trivial but I have no idea anymore. Does StackOverflow have any suggestions for me?
when you issue 'screen' from inside cygwin it might put you in another shell like /bin/sh instead of /bin/bash (and bash is where you're getting the tab completion from).
To fix the problem you could edit your .screenrc file (found in your home directory) and add in this line:
shell bash
Then try running screen again and you should see tab completion work within this new window.
The problem is that bash needs to be run as a login shell in order to have tab completion in the default cygwin setup. If you run bash in a cygwin bash you won’t have tab completion either. To set screen to run bash in login mode, add this line to your ~/.screenrc file:
shell -bash
I had a similar problem with git autocompletion not working when using screen on a linux machine, but wasn't due to a different shell. I fixed it using this question: Git autocomplete in screen on mac os and doing the following:
Get the git autocompletion script
curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -OL
why would you want that hanging around?
mv git-completion.bash .git-completion.bash
add this line to your ./bashrc
source ~/.git-completion.bash
Then in your terminal
source ~/.bashrc
That worked for me.
(I imagine after three years you've probably solved your problem, but I hope this helps someone else)

Resources