adb shell auto-complete under Windows 7? - shell

I tried on linux and ash from busybox does auto-complete command line... But under Windows 7 when I press Tab it doesn't work. Any idea to make Windows 7 smart? :) Thanks!
Looks like auto-complete is done, but nothing echoes back after when tab is pressed...
An example:
adb shell
ls m[press tab]
after tab is pressed, some space characters are shown, but characters that are generated by auto-complete doesn't echo back, then if I press enter, directory mnt is listed which means auto-complete works but echo system has some problem. Right?
ls m[space][space][space][press enter]
mnt

I run adb on Win7 sometimes, both under the cmd.exe and Cygwin, and I was frustrated by how adb shell handled autocompletion and character echo. I also use adb under OS X and Linux, and in both of those environments the autocompletion and character handling works as I expect. What the problem on Windows seems to be is that adb shell is not setting the terminal modes (stty/termio() for UNIX-type shells). I came up with the following workaround that seems to work well for Cygwin's bash shell. I don't know Windows well enough to know if there is a similar command to stty for cmd.exe:
$ stty -icanon -echo -echoe intr ^0 ; adb shell ; stty sane
Of course you can put this in a script.
I believe that the reason that recompiling adb under Cygwin fixes this issue (under Cygwin) is because the recompile causes adb to use the termio() calls to setup the local terminal modes so that they don't interfere with what you type to the Android shell.

Solved this problem by recompiling adb under cygwin. :)

You can use ADB enhanced Putty
It support auto complete and coloring
you can download it from
ADB Putty
read more at ADB enhanced Putty (replacement for "adb shell" command)

Auto-complete is controlled by the following Registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
Set the value to 9 or 40.

Related

How can I run Windows 10's bash for Emacs mingw32 for Windows?

I would like to use the recent bash shell of Windows 10 in shell mode of Emacs (mingw32) for Windows. Could anyone advise how could I do that?
You can use one of the other terminal mode: term or ansi-term by typing M-x term or M-x ansi-term.
When being invoked, these terminals will ask for the path to your shell. Here you just need to put the correct path to the Windows shell.

Enable adb shell auto-completion in archlinux

The auto-completion with Tab is not working in an adb shell on archlinux.
Everything else is working fine. Do you know what can be the problem?
The problem is auto completion with Tab key is managed by the shell you're running, as a built-in. It is your shell (let's say Bash) that decides what to do when this key is pressed.
Once you've left Bash, it no longer applies and that behavior is determined by the program running, which here, is adb and its own shell program that probably does not include a real user friendly list of features.
I also faced the same, bash-completion package will provide completions for that.
sudo pacman -S bash-completion

Cygwin terminal window empty

I've just installed cygwin (64bit) terminal on Windows 7 64. When I open cygwin terminal from Start menu, I can only see empty terminal window with blinking cursor. I can issue commands and see output, but prompt is missing (at least $ should be there, right?)
Any ideas how to fix it? It is fresh installation of cygwin on fresh Windows 7 64bit Enterprise.
Start with issuing the command
echo xyz
To find out if you are actually at a blank command prompt. If that responds with the output of xyz then check your prompt with
echo $PS1
And then set it
export PS1='\h \w> '
This should give you a prompt. If the first step itself does not give you a prompt you have other problems.
Another option is to start the bash shell from windows command prompt:
c:>c:\cygwin\bin\bash --login
Assuming you have installed cygwin in c:\cygwin
First,
I'm using window64 too, but it can work with cygwin32, please try with cygwin 32
If not, please try install cygwin again from another miror

Compact cygwin terminal

I'm looking for a way to make the cygwin terminal more compact, or an alternate terminal that is more compact. Currently, every command I enter has a header line above it with username and pwd, and there is a blank line trailing every command. For instance:
username ~
$ cd tmp
username ~/tmp
$
3 lines for every 1 line of command. I frequently work on a small screen, which makes all this wasted space quite irritating. Is there a setting somewhere I can alter to prevent all this wasted space? Or, perhaps another terminal?
Thanks in advance.
That's the default shell prompt set by Cygwin.
To use a smaller prompt in your current terminal:
PS1='$ '
To make the change permanent, put that command in your ~/.bashrc file.
You can set the prompt to just about anything you like, as explained by the bash manual (there are several variables that control different prompts; $PS1 is the main one).
It's important to remember than in Cygwin (as in Linux and Unix), the terminal program is a separate program from the shell that runs in it. The prompt is controlled by the shell; bash is the default. The graphical display is controlled by the terminal emulator, which could be rxvt, mintty, xterm, or even the Windows terminal that normally runs a DOS-like shell.
What you're seeing there is the prompt, as stored in the environment variable PS1
echo $PS1
will show you how it's created. By the way, that prompt is managed by the bash shell, not by the terminal.
export PS1=$
will give you just a $ prompt
export PS1="$ "
will leave some room behind the prompt. There are many more possibilities, here is a nice tutorial.
bash reads its settings from a file called ~/.bashrc aka a file called .bashrc in your home directory. Note that due to the initial dot in the name ls won't show the file by default, ls -a or ls -la will.
I would Recommend we go with modern terminals using Cygwin-X as shown in the below interactive menu
I love Xfce Terminal which allows creating tabs and new windows with font options and color options

Vim on Cygwin and MinGW

I have tried to use Vim both on Cygwin and MinGW but many times the characters behave in an unpredictable manner (backspace is not deleting, cannot have a semicolumn, and so on...). I am wondering if this is related to those systems or if it could be a problem of my own system/settings (e.g I need to adjust some settings, define the character encoding, etc.). I am on windows 7 64bit
Thank you
The Cygwin CMD emulator has a known problem with Vim. Seems to be a redraw problem. Apparently fixing it would break execution of some exes that Cygwin depends on. Many users choose to use another terminal emulator. I find that paging down and back up fixes the redraw but sometimes I have to exit Vim and relaunch.
PuTTYcyg is a patched version of PuTTY that, in addition to telnet, rlogin, ssh, and serial connections, can also be used as a local Cygwin terminal instead of the Windows console or xterm. See README.txt on the PuTTYcyg site for more information.
To use rxvt:
#echo off
C:
chdir C:\cygwin\bin
set EDITOR=vi
set VISUAL=vi
set CYGWIN=codepage:oem tty binmode title
rxvt -sr -sl 10000 -fg white -bg black -fn fixedsys -fb fixedsys -tn cygwin -e bash --login -i
Mintty is a terminal emulator for Cygwin and MSYS. In Cygwin, it is installed as the default terminal by Cygwin's setup.exe. In MSYS, the mintty package can be installed with the command mingw-get install mintty. Alternatively, binaries for Cygwin 1.7, 1.5 and MSYS can be found on the Minitty downloads page.

Resources