When I type :!ls, for example, and see the result, it shifts up the current window to make space for it.
I've been annoyed by how the whole content moves up and down. I'm wondering if there's a way to fix that in either vim or gvim 7.3 - like in Emacs.
So for example, if I have lines 1~30, and the message area takes up 5 lines, I want my code window to show lines 1~25 instead of 6~30. That's what Emacs does, I think.
Thanks.
As far as I am aware, this is not possible in vim. However, there are ways to get around it. You can use screen or tmux and use that to create a lower window to execute commands in. You can also take a look into conque, which simulates a terminal within vim.
Related
When using vim in a non-English language environment, mistakes in mis-entering command often occur.
To prevent this, is there a way to view the current input source on the statusline?
For example, EN or JP.
like MS word bottom bar
Vim doesn't have that information so it can't expose it, which is not exactly a problem since your desktop environment already does.
If you really want to duplicate that information in your Vim status line, then you will have to find what external command to call, and then find a way to consume the information that doesn't slow Vim to a crawl because the status line is refreshed several times per second.
Now, your question is really two questions:
How to get the information?
How to show it in the statusline?
The answer to the first question depends on your desktop environment, which you didn't disclose. You will have to look around on your own, on more specialised forums.
The answer to the second question is irrelevant without an answer to the first one but you can look up :help 'statusline' and :help system() if you are curious.
Anyway, you already have the information in your desktop environment's menu bar/task bar/whatever, so why bother?
Vim has modes. In Normal mode where it is supposed to stay most of the time all commands consist of latin letters by default. Therefore, using OS level keyboard layout switch cannot be recommended. Instead, Vim has a feature called "keymap". Vim keymap is only active in Insert or Command-line mode never affecting the Normal mode.
So, Vim never cares what is your active keyboard layout on OS level and you won't expect an easy way showing it. On the other side, Vim keymap name is accessible either as b:keymap_name variable or %k format specifier for the statusline option. So it is pretty easy to add it.
I've started using Neovim on Windows/WSL through ConEmu. It all works pretty amazingly except one pretty major flaw:
When I paste content into Neovim and forget to enter insert mode before, Neovim will register the input as keyboard strokes and execute them as commands. Needlessly to say, this can get pretty ugly, pretty fast.
A contrived example for clarity: I need to copy some text from my browser. The text in question is "sp" (yes, this is completely stupid, but bear with me). As I paste this into ConEmu (CTRL-V), the terminal transfers the input to Neovim that parses it as commands because it's in normal mode. In this example Neovim will replace whatever character is at the cursor at the time with p.
Vim for Windows has this solved and will paste the content without changing mode (how does a pure Linux environment handle this?). The problem with that solution is that it is dependent on the Windows file system which is a lot harder to tweak/maintain compared to apt-get/Ubuntu/WSL as well other annoyances.
So, initially I thought I'd try to make Neovim detect if the input was directly from the keyboard and not any other source, if it was, switch to insert mode and handle it from there. But I'm frankly not sure if this is even possible (especially though WSL). I also tried to add a shortcut that makes Neovim enter insert mode on CTRL-V in the hopes that is would trigger first and then correctly paste the content.
Maybe I need another terminal than ConEmu?
Anyway, I'm out of ideas, hope you guys can help.
ConEmu shall not detect any "internal" modes of the application you run in the terminal. Actually, when you "paste" something, terminal does almost the same thing if you press same keys manually.
Well, except one major difference: ConEmu uses "bracketed paste mode", so the console application may determine if user paste something or press keys manually.
So, it's the question to Neovim how to process/configure bracketed paste mode inside it.
In ConEmu settings, Keys & Marco -> Paste
There is an option:
Multi-line paste: avoid unexpected command execution by < Enter >
keypress
That's what you need.
In insert mode, whenever I move the cursor up or down, the top of the display window immediately follows the cursor, not letting me see any lines above. Is there any commands to fix this?
If I understood you well, I don't see any problem there. I mean as you write more, it's part of the usability of Vim, you wont see lines above. On the either hand, if you can see only the line where you are in , there is a problem. It this happen using other kind of editors like VI, Cat, or gedit ?
The screens plugin turns vim into a kind of dreampie, only its a whole lot better because you have more control over what gets send even when you have multiple buffers and specific text within those buffers.
To follow my environment setup, merely install screens with vim, and then at the command line, do screen, reach the shell, then type vim in. Edit a shell script of some kind with it, then do :ScreenShell *shell type here, eg python/bash/irb* which spawns a shell below. You can use :ScreenShellSend to send the visually selected text to the shell or all of the file if none is selected.
My problem is, say I want to restart the shell that I'm running using this plugin and sending it some text. I need to do :ScreenShellFocus, call exit, and then start it up again. But then I need to be able to return to the same vim session that is directly above the shell that I'm affecting. I realize that I can use screen to just reach the vim session, but the only way I can do that now is to select it with ^a 1, which really only replaces the lower portion, the one that supposed to be the shell, with the vim buffer being edited. This is stupid because now you have vim buffer on top of vim buffer.
So my question is, how do I return the cursor to the vim session above after doing :ScreenShellFocus?
(yes I know my example of killing and restarting a shell may be circumvented by other logic, but I'm not that acquainted with the GNU screen util, and I think there's a way to do it like this, which I think preserves the workflow of the programmer)
<C-a><Tab>
is the mapping used in screen to cycle through "regions". Since you have only two, it moves the focus to the other region.
Since you are effectively using screen, you should learn how to use it to make this plugin really useful.
$ man screen
I'm not sure if this is the default behavior, but when I open multiple windows, I get multiple status bars (see below). This is ideal when I have multiple windows open. However, when I try to search, or issue a command, it goes all the way down to the bottom (see below). Is there any way to force it to show in, over or under the status bar of each window?
I think you are confusing status-line and command-line. Type:
:help status-line
and:
:help command-line`
There's no way to move command-line somewhere else, unfortunately, nor combine these two. You can even turn the status line for "last" window (the bottom ones) by using:
:set laststatus=0
just to emphasize the difference.
No, there is no way to show the command line anywhere but at the bottom.
The statuslines can be modified in that way that you can turn them off completely, all of them (the laststatus option modifies this), have them show only when there are at least two windows open (laststatus=1 behaviour, the one you have), or have them show all the time for all windows (laststatus=2).
One last thing ... regardless of where it is, the command line (at the bottom) issues buffer specific commands to the active buffer (the one with the green statusline), so there really isn't a need for let's say, four of them ...