I have an issue with recent versions of MSYS2 that I didn't have with older versions.
I often paste a large number of commands, some of which are longer that the console width. There are also sometimes multiline commands in there (e.g. shell if stuff with the fi several lines later). But I do make sure there are no tabs in there to avoid autocompletion from kicking in.
In old MSYS2 I could just paste everything and the commands would start right away.
In newer MSYS2 after pasting it is apparently waiting for another Enter before starting.
But what's worse: the data pasted isn't intact. Sometimes pieces are missing, sometimes it gets truncated, sometimes both.
I have reproduced this on Windows 10 and Windows 11.
I also tried running msys2.exe as well as others like mingw64.exe, and I even tried running sh.exe from ConsoleZ.
Is there some kind of setting or environment variable to get the old paste behaviour back?
UPDATE
Also tried with Windows Terminal
Tried pasting from different source (Notepad instead of Notepad++)
Tried changing copied source (in Notepad++) to different line endings (CR, LF, CR+LF)
No improvement.
Additionally I noticed sometimes part of the beginning of the copied text are pasted last. So it's not just a matter of missing pieces - the contents get thrown around during paste...
I have not been able to resolve this issue in ConsoleZ or Console2, but when using mintty from MSYS2 the following fixes the paste problem:
bind 'set enable-bracketed-paste off'
As mintty is not a console program (in the Windows application sense) this solution can't be made to work with ConsoleZ or Console2, but it is possible with ConEmu.
Related
After clearing a Mac terminal (via Command K, or the "Clear All" command under the edit menu), is there a way to easily restore the previously cleared text?
Periodically, when I run a long process on a Mac Terminal (such as a suite of unit tests) I prefer to clear the terminal. I do this so when I'm scrolling up to look over the results of the process, I can focus ONLY on the results of that process and not other commands I've recently run. (Such as, say, a different suite of tests)
But, sometimes I do eventually want to go back and look over the previous suit of tests.
Is there a way to restore previous terminal text?
The terminal is not going to help with restoring the text. It is gone.
If you anticipate wanting to review the text, you could (in a more or less transparent manner—not interfering with your work) run your session in script. That records everything sent to the terminal (including escape sequences for vi).
If your use of the terminal is largely just cat'ing files or watching logs, then the resulting typescript file is usable with less -R. It does not work well with cursor-movement, but for those, I use slowcat or similar filters to slowly cat a file, etc. For best results, the terminal emulator interprets escape sequences reliably.
When running the tests why not redirect the output to a file? This keeps your terminal clear and you can cat (or tail or more or less) that file to see only the results of that process. Another advantage is you can keep these log files around for future reference if needed.
I'm using Cygwin and any time I use an Activator command (e.g., activator run or activator "eclipse with-source=true"), any text thereafter is invisible. It's being typed, because if I hit enter, the command will be executed, but I cannot see it.
I've done some searching of this issue, and I'm not the only one to experience it, as I've learned I can blindly type stty sane and I'll get my text visible again, but that's a bit onerous.
Other tips suggest commenting out a certain line in <activator>\minimal\activator, but looking through that file, I see many lines for detecting if the terminal being used is Cygwin and then specific handling for that, so I'm not sure what to edit nor why it isn't already handling the fact that I'm using Cygwin.
Any help would be appreciated, thanks!
I'm the uninformed user. I want to use mercurial for my personal use in terms of writing code and writing papers and have every change be accessible. I'm not a programmer by trade, I run a lot of matlab code and that's it as far as programming experience goes. I've installed the TortoiseHg with Windows Explorer "shell" integration all-in-one package. I already have python 2.7 installed too.
Next I went to this tutorial: https://www.mercurial-scm.org/wiki/TutorialInstall and I got lost right away. They say the mercurial program is called hg, so I type so in the search function and it comes up, I open it and a quick command window opens up and closes in a fraction of a second and that's it, nothing else happens. I read a bit further into the tutorial and they say that you have to type hg in the prompt. I tried windows powershell and this did work but I don't know if I was supposed to be doing this from within some hg prompt or something.
I went to the next step of the tutorial and they go through the steps of making a repository. I blindly typed the commands they have setup and it worked until I typed "ls -a" saying that it's not a recognized cmdlet.
I don't know what I'm doing and I need a better resource that helps me get this set up and running as I don't understand why even opening "hg" does apparently nothing or if even I should be using powershell for the tutorial.
Mercurial is mainly used by people who are programmers by trade...so all the tutorials are written for programmers, and therefore assume a certain understanding of how command line applications work.
I suspect you're not that familiar with the command line, so first of all, I second user694733's comment:
For a beginner, the TortoiseHG GUI is way easier to get started.
(and they have excellent documentation as well)
Anyway, here's why the command line didn't work like you expected:
hg is a command line application. When you directly start it from Windows (which you did by typing hg in the Windows start menu), it behaves like you described: it pops up and immediately disappears. You need it to start from the Windows command line instead.
There are two different command lines in Windows:
a) Windows PowerShell, which you already used
b) the "classic" Windows command line, which you can open by typing cmd into the search box in the Windows start menu
There's no special "hg prompt", it's just that you're supposed to run hg in one of the two command line interfaces I listed above. It doesn't matter which one you use - hg behaves the same in both.
it worked until I typed "ls -a" saying that it's not a recognized cmdlet.
Mercurial does not only work on Windows, but on other operating systems as well (Linux and Mac OS, for example).
The hg commands are the same everywhere, but everything else is different depending on your operating system. For example, ls is the Linux command to list the content of a directory. In Windows, it's dir instead.
Most, if not all, of the Mercurial developers don't use Windows, so their tutorials are not written with Windows in mind.
You should really start with TortoiseHG, as mentioned above (its documentation is Windows friendly, too) or if you really want to use the command line, I'd suggest a different tutorial, Hg Init, which was written by a Windows guy (Joel Spolsky, the CEO of Stack Exchange, the company that runs Stack Overflow).
On the rare occasion that I have to use a windows command prompt rather than bash, it drives me nuts that tab completion doesn't add a slash to the end of directory names. Is there a setting or script that I can run to force the full completion?
The answer these days is PowerShell. It is superset of the windows command line. It has many of the Linux commands. It has an object-based pipeline and has full access to the .NET framework from the command line.
And it adds a trailing slash when using tab to expand a directory name.
No there is no such setting. Your best bet is to use bash through cygwin but I expect you already knew that bit.
this is quite an old thread but I thought it might still be helpful for others.
I could not find a parameter in Windows to do the trick but I found a executable (GNU, with the Pyton source available) named PyCmd which is an improvement (according to my and my work habits) to regular CMD console.
It can be launched by double click it and it starts a regular console with cmd.exe and it loads itself in the memory to allow a lot of command line editing goodies, among them the same TAB completion behaviour I used to have under Unix Korn Shell (including the Emacs-like keys) with the trailing slashes or back-slaches for directories.
You can find it at:
https://sourceforge.net/projects/pycmd/
The last version is a December 2017 snapshot (but stable for me, could not meet any major trouble compared to the 2013 0.9 stable release), at:
https://sourceforge.net/projects/pycmd/files/pycmd/snapshots/
You can also launch it from an existing console, from CMD.EXE and it starts a sub shell with all its editing goodies. You exit this sub-shell by exit or ^D on an empty line.
Note that I have tested it to under an alternative console like "Hyper" (MIT License, at https://hyper.is/ and https://github.com/zeit/hyper), which I prefer compared to Windows default console, and it works perfectly with it too. I think it's fair to assume that it will work well for other consoles like ConEmu or others, but I did not test it with them.
This answer goes perhaps a little far beyond the original question but -- I hope -- still can provide some help to people like me who like to get the same kind of command-line behaviour as they used to have under Unix Korn shell (possibly Linux bash, I don't know).
Have a nice command line interface to all!
GM
At work, I use Cygwin a lot because it offers me a small oasis in the vast desert of Windows. I inevitably end up running some non-Cygwin programs through the bash shell, such as build scripts (batch files created in-house) and the Subversion CLI binaries (I have the Windows ones installed). 99% of the time, I don't have any problems using this setup. The other 1%, however, causes a strange issue:
With both the build scripts and SVN, most of the time the enter key is interpreted correctly. For instance, I'll kick off the database creation script and it will prompt me for the server name. I type in "localhost" and hit enter. Everything's fine. Then it gets to the end, if there are errors, and prints things out using more. No key that I press is recognized by more. I have to Ctrl-C out of it.
Similarly, if I do a Subversion update, normally everything is fine. In the case where the interactive conflict resolution happens, however, I'll usually type in "tf" for "theirs-full" and hit enter, but nothing happens. I have to Ctrl-C out of it and re-run the update with force merge or use TortoiseSVN in Windows to do it.
Any idea why Cygwin seems to randomly not be passing the enter key through to the programs? I considered that it may have something to do with Unix vs Windows style line endings, so I've tried typing those characters manually, but that doesn't seem to make a difference. Thanks.
Edit: I just had this happen to me again and I realized something. It was SVN prompting me for a password. I typed in the password, which it echoed to the screen (bad) and hit enter... nothing. Hit enter a few more times, the cursor moves, but nothing happens. I hit Ctrl-C and it dumps me back to bash, which then says "bash: [my password]: command not found" followed by a number of new prompts equal to the number of times I hit the enter key. So what happened is the input never made it to SVN, but somehow got read by bash after SVN exited. I thought that may help someone figure out what is going on.
Unfortunately, I think you are hitting one of the issues of Cygwin and windows/dos console apps. See "Console Programs" at http://www.cygwin.com/cygwin-ug-net/using-effectively.html.
It is just a limitation on windows console apps. This behavior is common for the windows myqsl cmd client and svn client, for example.
Here are some things to note -- I've successfully used this approach with both the Windows mysql as well as Windows svn clients:
1) Try making sure you do NOT have "tty" in your CYGWIN environment variable and see if that helps (unset it in My Computer->properties->advanced->Environment Variables and close/restart any cygwin bash prompts).
2) Do not use RXVT -- instead, use the basic Cygwin cmd prompt. This is because RXVT implies "tty" and will break #1 above.
3) Try finding a "native" Cygwin package for the cmds you are having issues with instead of using the Windows cmds. (I haven't found a 1.6 svn client for cygwin yet, though.)
Good luck!
Dustin
The lengthy discussion on the mintty project is here - http://code.google.com/p/mintty/issues/detail?id=56
One solution mentioned which worked in my case (entering authentication passwords for native subversion) is conin - http://code.google.com/p/mintty/downloads/detail?name=conin-0.0.2.zip&can=1&q=label%3ADevelopment
$ conin svn list https://{repo}
Password for 'user': ******