I work at a place where I can't install anything onto my workstation or download anything from the internet onto it. Right now I have to do a significant portion of my work through a very clogged high-latency link. It can take minutes to open a graphical window, so I do whatever editing I'm forced to do through the link in vi. One problem I've been having is if there are 7 compiler errors caused by typos and simple things, I can't fix them all without recompiling. I vi the file and fix one or two errors, and then when I come back the error messages are obliterated by the residual text from vi.
A coworker suggested screen yesterday, which repaints the compiler errors when I exit vi. It also handles terminal resizing properly, which is quite nice.
Problem is, if I run vi through screen on the other side of this link, any mistake I make leads to a 'visual bell'-my whole screen flashes white. It's not unusual for me to press delete and hold, if I want to delete everything on the line but not the line itself. Or hold the left arrow key, etc. Because of the latency of the link, it's hard to judge when to let go, because my screen is 2 seconds behind the keyboard commands. If I hit left arrow or delete when at the start of the line, I get the vbell. If I was holding left arrow or delete and didn't let go fast enough, my screen lights up the room like it's determined to give me an epileptic fit.
I turned off visual bells in screen, and I used the noerrorbells option in vi, but I still get visual bells not related to errors, I guess? The triggers above still flash the screen. These versions of vi don't accept set _vb or set t_vb commands, so any solution involving those doesn't work. Turning off visual bells on the X server didn't work, and xterm doesn't seem to have an option for removing visual bells. The bells don't happen except when I'm using screen... is there any way I can take away vi's ability to visual bell that I haven't tried here?
tl;dr: Screen lets an old version of vi use visual bells when raw xterm or gnome terminal doesn't. Screen is really helpful for other reasons, but these bells are a dealbreaker. Any way to stop vi from being able to use virtual bells?
Posts
Have you tried playing with your $TERM variable? I've seen different behavior depending on if I'm using "xterm" or "xterm-color". Both will allow color, but they differ in the way then handle screen-clearing and other minor operations. I'm going from Terminal.app (OSX) to Debian, so YMMV.
I don't know enough about the guts of term to offer anything else, sorry.
:set errorbells/noerrorbells indeed only applies to errors so other things will still set off the visual bell as you've already noticed
Try the following:
:set noerrorbells
:set visualbell
:set vb t_vb=
If that doesn't work, stop making mistakes :-P
Instead of mashing keys, get good at the keyboard shortcuts, "0" followed by "d$" will clear a line without removing it (move to start of line, delete to the end. If you're at the end of the line you can do "d0x" to delete the line and the last character which will be left over).
Good luck!
Most usefully: starting it using screen -DD -R will resume your last session. CTRL-a+c to create new screens and CTRL-a+n to cycle through them.
Play with me on Steam
so
will output both to the console and the file nameoffile.txt at the same time. The -a option will append.
Then you can just 'cat nameoffile.txt' when you need it.
Thanks, I didn't know about this.
probably because you don't have the worst dev environment in the known universe
None of the above works, and I've already stopped using screen, since the bells bug me way more than doing without screen.
this is obvious and I feel like a moron for not having thought of it! Thanks. I'm going to edit my alias to include this. Will tee overwrite the existing file, or do I need to prepend an 'rm' command to the alias?