Cygwin scrolling problem - scroll

When i run a command in cygwin when scrolled up it starts writing the output to that screen, so everything gets written over.
How can I change settings so that output will always be appended to the end not to where I have currently scrolled my window.
I found that rxvt doesn't do that but it also doesn't show me äöõü characters:(

Are you sure it's overwriting where you've currently scrolled to? I find the console just jumps back to the cursor position when there's new output. Still annoying though, and I don't know of a way to switch off that behaviour.
Anyway, have a look at 'mintty'. Like rxvt, it doesn't need an X server, but it does support Unicode, so the umlauts should be fine.

Related

TMux Scrollback Becomes Static

I have a kinda weird question. Sometimes in some of my long-lived tmux sessions I'll have a window where the history will get kinda "stuck"
So, to clarify, that's a (bash) shell, inside a pane, inside tmux, and that shell has been running for a while.
I have my scrollback set high and I use it all the time, so I know how to use it and how it works in tmux. But sometimes something will happen and I'll always get the same history when I scroll back no matter what I print.
So for example, I'll run something like seq 1 100 and I'll only see the numbers 76 to 100 in the pane, but when I scroll up I don't see 75, I'll see the result of some git command I ran a while back. No matter what I run, when I scroll up it's that same output of that same git command, or whatever happens to have been up there when it broke.
I can exit the shell and re-open it, that works, but I'd rather not. I'm wondering if there's some kind of term control character or something, or broken curses code, or something that maybe didn't clean up properly in my terminal that would have left me in this in-between state where new lines are shown, but not added to the history? Any idea? I tried running reset, but it doesn't seem to have fixed it.
Does this make sense to anybody? I'd love to learn something new about how shells communicate with terminal emulators that makes this make sense.
Thanks!

How can I get quickfix to open results in the previously focused window?

I wrote the following command to search Vim's help files:
command! -n=1 -complete=help SearchHelp \
help | execute "grep! -i <args> $VIMRUNTIME/doc/ -r" | botright copen
Now, for example, when I have forgotten the key to increment the number under the cursor, I can do:
:SearchHelp increment
to search through the help files. (The answer turned out to be <Ctrl-A>.)
The problem is ... I have a few windows open, and I want quickfix to leave them alone. When I hit <Enter> in the quickfix list, I want it to open the result in that help window which I split open at the beginning of the command.
But it doesn't do this. It seems to prefer to always open the result in the bottom-most of all my editing windows, regardless of which window I was focused on, and with complete disinterest for the help window I opened. Obviously this moves away from whatever file I happened to be editing in that window (yes I have :set hidden), requiring an arbitrary number of <Ctrl-O> keys to get back to the file when I have finished browsing the help files.
So how can I get quickfix to open in the previously focused window (ideally that help window that was split open)?
(Incidentally, I sometimes use a patched version of Yegappan Lakshmanan's old grep.vim plugin, and somehow this does open :cope results in the window that had focus before I ran :Grep. I am not sure what's different in the two situations.)
The behavior (among others like :sbuffer) is controlled by the 'switchbuf' option. With a value of useopen, you can make it re-use a window if it already displays that help page. If you need more control than what is offered by that option, you do need to use a custom command / mapping.
So far what I have come up with is to replace that help command with:
99wincmd j | wincmd s
This splits whatever window happens to be at the bottom of the screen, so that when the quickfix clobbers the bottom one, I still have a window that keeps the file visible.
This solution is workable, but not quite as neat as my preferred result, which is to open results in the help window which was split just above the window I was focused on when I ran the command.

Can I make emacs grep windows just use the other window to open files in?

I've got emacs in front of me.
I've run a find-grep, and it's got many hits, which are displayed in a window. The file names are displayed in green as hyperlinks.
I make that the only window, with C-x 1.
If I click on a file name, the window splits vertically, and the file with the found text is displayed in the other window.
If I click on further filenames, then the new file replaces the old file, which is what I want to happen.
So far, so good...
However if I resize the windows, then emacs will periodically (when I click) split one of the two windows again, rendering the display difficult to read. It will then cycle opening new files between the two new windows. Occasionally it will open more windows and make the situation worse. If I close any of these new windows they just get reopened again.
In fact sometimes this perverse behaviour happens even if I don't resize anything. It just seems to happen more often if I do.
I would like emacs to stop buggering around and just have one find-grep window and one 'display' window, and always replace the display window with the new file. I would also like to be able to set these windows to the sizes that seem most convenient.
Is there any way to achieve this?
Or can anyone point me to an essay on how the whole (replace the contents of this window/replace the contents of a different window/create another window by splitting) thing works, so I can go and hack it sane.
Short fix:
Try doing this
(setq split-height-threshold nil
split-width-threshold nil)
This will prevent Emacs from splitting windows automatically (horizontally or vertically). This might be undesirable in other situations, but this should do the job. Try it for a week or so and see if it disrupts your flow.
Also, I found that if the point was in one of the windows, and I clicked on a link, the file opened up in the next window (if any).
So, if you want to make the file open in the right window (when you have more than one window), you can ensure that the point is in the window before the window you want.
Longer answer:
OK. I was able to reproduce the problem. The thing is the window showing the files is pretty big (wide or tall) because you resized it and Emacs sees that the width or height is greater than the respective threshold and splits it likewise. So, we have to either make the threshold higher or disallow the behaviour completely.
And, just to answer the last few questions:
To get current window - (selected-window)
To get next window - (next-window)
To select a window - (select-window foo-window)
To get the buffer of the current window - (current-buffer)
To get the buffer of some window - (window-buffer foo-window)
To set a buffer for a window - (set-window-buffer foo-window bar-buffer)
I'm sure you can hack together decent window/buffer management functions using these functions.
You can use C-h f to get more details on each of these functions.
Also check out the Elisp manual - http://www.chemie.fu-berlin.de/chemnet/use/info/elisp/elisp_26.html

Adding informative statusbar to fullscreen terminal window

Briefly:
I would love to add a status bar that sticks to either the bottom or top of my terminal window that provides glancible information (e.g. battery life, signal strength, email count, $PROMT_COMMAND, etc.). Essentially, this will allow the terminal to be opened up to fullscreen and have all the information I could possibly want easily glancible while letting me continue all of my necessary terminal work as normal. I use a mac primarily, but would prefer a *nix compatible solution.
More detail (and what I already tried):
I am a big terminal user and only recently (within a day or two) started using tmux, so I understand that many of you may suggest that I try to use a multiplexer like screen or tmux. While tmux is starting to get very useful to me, it has it's limitations such as a limit to a single-row status bar, which is not ideal since I would want to keep the tab's bar clean without half of it being eaten up by information. Also, I would want to add $PROMPT_COMMAND which displays the current directory, and that could easily eat up most of the status bar depending on where I am in the system.
Also, I tried screen for a bit, which let's you have a hardstatus and a caption which is close to what I want, but it's development seems to have halted. Furthermore, the patch for vertical split panes messes up the graphics of a two-row status bar (very ugly).
Therefore, I think it would be preferable to have a background process running that updates a status bar on part of the screen above my multiplexer ... unless of course tmux has a multi-row status bar implementation that I haven't figured out yet.
I would love to hear about any of your possible solutions, or even your own personal setups if you think it works well for you. Thank you all for any possible help.
A couple of options:
You could run tmux inside tmux (with different configurations; you can use -f to specify a configuration file.)
You could use the tab title, though that's probably not wide enough to include everything you want. (Even if there's only one tab, you can show the tab bar in fullscreen mode). You need to tell tmux to pass the title through; see set set-titles and set set-titles-string.
I'd suggest you use both - put the current directory in the tab title and all the other status info in a separate line maintained by tmux, that way you can just skip the second part when you're not using a full-screen terminal.
I have battery info in mine,
You can get copies of the files you'll need at
https://github.com/richo/dotfiles/blob/master/tmux.conf
and
https://github.com/richo/dotfiles/blob/master/bin/battery
(Make sure that battery is executable and in your PATH)
It'll show you battery percentage in blue (charging), red (discharging) or not at all (fully charged)

How do I make bash reverse-search work in Terminal.app without it displaying garbled output?

Using Terminal.app on OS X 10.5, often you see the commands get garbled when you do a reverse-search with Bash. Is there some kind of termcap or perhaps a bash shopt command that can fix this? It is very annoying.
Steps to reproduce: Open Terminal.app, reverse-search to a longish command. Hit <ctrl>-E once you've found the command. The cursor goes to the end of the line, but the display doesn't update.
I'm guessing this is some kind of problem with the readline library on OS X. It's more of a problem with updating the cursor position after a search than anything else. Basically, ctrl-a and ctrl-e tend to break the search output.
os x terminal failure image http://involution.com/images/osxterminal.png
In the above, the first part of the command should be displayed, and the cursor should be at the end of the line, but it isn't. You literally can't see what you're editing when this happens.
I was able to set my TERM to xterm instead of xterm-color and it solves the problem. (export TERM=xterm).
You may want to look at this post.
bash-prompt-in-os-x-terminal-broken
I had the same problem and it had to do with the PS1 variable. Let me know if this helps.
If the prompt has colors, then this is an acknowledged bug.
See bug report msg#00019.
I've encountered this bug, and while I don't know how to solve it, you can work around it by pressing <down><up>
Not sure whether this is the problem here, but a very common cause of a messed up screen in bash (with any terminal emulator, not just Terminal.app) is the window being resized.
Bash will read the window size when it starts up, and then assume it hasn't changed. When the window is resized a signal will be sent to whatever app is currently reading from the console. If this isn't bash (because you're running a text editor at the time, perhaps), then bash won't know about it.
Solution in this case is to resize the window again so that bash gets the signal and notices the new size.
I can't reproduce this, hitting either Ctrl+E, Ctrl+A or the arrow keys updates the command line correctly. Are you running 10.5.4? Is it perhaps a bug in earlier versions?
In worst case, you could launch the X server (somewhere under utilities) and launch a real xterm.

Resources