Using vim along with screen - bash

When I'm using vim alone, it's fine. I can suspend it by pressing Ctrl+z, work with bash, then return by typing fg.
When I'm trying to use vim along with gnu-screen, it's buggy.
First, pressing Ctrl+z does not show me all previous commands in console, it shows remains of vim screen instead(see pic).
Second, and worse, hotkeys, starting with Ctrl does not work in Vim. For example, Ctrl+PgUp to see previous tab.
Am I doing something wrong?

Related

What does cmd + up-arrow do in the terminal?

While using the terminal I accidentally typed Cmd + up-arrow and saw that my previous commands got highlighted. I was wondering if I accidentally discovered a cool hack for something (other than just highlighting previous commands), but I wasn't able to figure out what exactly the hot key is doing.

PowerShell Ctrl+L not working as expected, how to debug?

Previously, my PowerShell client would clear all text upon pressing Ctrl+L, effectively executing a clear/cls.
Seemingly out of the blue Ctrl+L clears the terminal but upon typing, all the text comes back to fill the prompt.
How may I go about debugging this issue? Using "Enable legacy console" fixes it, but I'd rather use latest. I could always override the Ctrl+L chord but I'd rather try and determine how it got to this state in the first place.

Scrolling up one line in bash, when opened via the PyCharm IDE

PyCharm offers the option to use the bash terminal (see File->Setting, where this screen comes up:)
Now when I have the bash terminal open while coding in PyCharm, like so
and want to scroll up line by line with the keyboard (in this case to view line by line the output of the previous command, pytest, that I ran that output the error message), I can't, no combination of Ctrl, Sift, Alt, Super, Up, Page Up will work (only Shift+Page Up scrolls up - but by a whole page, not a line, which is too much).
I'm not sure, is this because of bash or because of Pycharm (I'm using Ubuntu (16.04), if that matters).
This issue is really driving me nuts!

Control key auto pressed when using vim over SSH through cygwin

I'm using cygwin and sometimes, when I am typing in vim on a file over ssh and I switch to a different window and minimize cygwin and then come back to cygwin sometime later, I get a problem.
The problem is that for some reason, my keyboard doesn't work normally anymore, and it appears that for some reason, it thinks that my Control key on my keyboard is always being pressed. I know this because when I press just the 'V' key on my keyboard, vim says it's in Visual Block mode, and when I just press the 'R' key, it tries to Redo any changes.
The bad thing is that this also means that I can't actually exit from vim because I can press the : key, but then pressing wq doesn't actually enter in the normal wq symbols because it's interpreting it as ctrl w, ctrl q.
The only way I can fix it is by closing the entire window and restarting cygwin, but this means I lose any unsaved work, which is annoying.
Note: This doesn't happen when I use vim locally in cygwin (not over SSH)
What is causing this problem?

leave vim split window in insert mode

I want to view the output of a bash command in a vim split window :split. To this end I installed "Conque Shell" which displays bash in a split window upon :ConqueTermSplit bash. I can then run my shell command and watch the output in insert mode. However, to return to the other window I need to type <CTRL-W> <Up> in command mode, so I need to leave insert mode. Hence the display of the command output freezes and continues only if I return to this window and enter insert mode. So how can I leave "Conque Shell" without leaving insert mode.
Note that other ways of viewing the bash output in a second window might solve my problem as well. However it should update while I am working in the other window and allow me to signal e.g. <CTRL-C> to the application.
The ConqueTerm documentation says:
3.1.5 Keep updating terminal buffer *ConqueTerm_ReadUnfocused*
If set to 1 then your Conque buffers will continue to update after you've
switched to another buffer.
Note: Conque buffers may continue to update, but they will not scroll down as
new lines are added beyond the bottom of the visible buffer area. This is a
limitation of the Vim scripting language for which I haven't found a
workaround.
>
let g:ConqueTerm_ReadUnfocused = 1
AFAIK Vim has no support for asynchronous sessions, so this is more of a response to your request for potential alternative options.
The way that I currently get around this issue is by using tmux, which is described as:
a terminal multiplexer: it enables a number of terminals (or windows),
each running a separate program, to be created, accessed, and
controlled from a single screen.
So, basically, instead of splitting your screen in Vim you would split it using tmux, and then in one window run Vim and in the other run whatever other program you want which will update completely independently of Vim. And just like Vim you can switch between the windows (or panes as they are called in tmux lingo) using a couple of key strokes.
There is another terminal multiplexer available called GNU screen, which is also quite popular. And the reason I mention that is because I like to have options, and also there are two plugins for Vim that allow you to send output directly to an attached screen or tmux session. For GNU screen, slime.vim, and for tmux, tslime.vim.
Using VIM and ConqueTerm you can use CTRL + W and UP / Down to change windows in split mode.
Just click on ESC first to exit the insert mode.
It works well on my side.

Resources