I recently started working with a windows machine and installed gVim, but somehow the escape key does not work - rendering gVim practically useless.
Is it possible that my computer sends out an unusual character for the escape key? Is there any way to test this hypothesis?
Or is it a common Windows (10) issue, that escape does not work as on other devices? Did anyone else encounter this strange behaviour?
I tried on linux4windows terminal and there it had the same result yesterday, but now the escape key works fine.
I know this is an old question, but I've been suffering this and finally found some time to dedicate to it.
The answer seems to be (for me at least), that if you hit Win to open the Start Menu and then type gvim, the first option is actually gVim Easy not gVim.
The difference is 'gVim Easy' starts with the -y switch:
-y Easy mode (like "evim", modeless)
If you launch gVim (as opposed to gVim Easy) then ESC works as expected.
I guess the "modeless" in 'Easy Mode' means there aren't normal (command) or insert modes, so there's no need to use ESC to switch between them.
I had the same issue with gVim 8.0. I updated to 8.1 and left all default settings (no remapping etc..). Now the escape key works again.
Related
So it seems like ctrl-space is being incorectly translated into ctrl-# by the Windows Terminal and I was wondering if there's any workaround for this? I've seen answers to this similar problem for other terminals but they don't seem to work.
This is fundamentally a limitation of the way that most Unix terminals work. The control keys map onto a limited set of characters, so Ctrl-#, Ctrl-Space, and Ctrl-` all map to the same thing and work the same way. This occurs in terminal emulators and the VT running on real Linux systems as well.
It is possible that other terminal emulators have an option for this, but the Windows Terminal attempts to emulate the xterm-256color terminal type, which implements the behavior you're noticing. Even if other terminal emulators do support it, that doesn't mean that programs running in them do; they might receive such a sequence and not know what to do with it, especially if TERM is set to a terminal type that doesn't support the distinction.
According to the Windows Terminal issue tracker, they are aware of this and there is a possibility they may pass these keys in the future using some xterm-specific sequences, but currently this doesn't work. I'm not sure that even if they did implement it that it would work as you expect in Vim, although it's possible it might.
You can either remap Ctrl-# if you aren't using the existing functionality or just use another key.
Autohotkey is a good company for vim in Windows. It can map ctrl-space to any other keys and send them to vim by running scripts.
https://www.autohotkey.com/docs/Hotkeys.htm#Intro
AHKscript like(not tested)
^Space::
send {Ctrl}g
return
Then in vimrc
nnoremap <c-g> ...
I am trying out VimWiki. So far so good, but on Ubuntu 18.04, the Shift-Enter and Ctrl-Enter do not work [1]. Search on the net says Gnome Terminal interprets these key combos as the regular Enter key. So I believe I have to remap these keys to something else or find another terminal program. I have tried Terminator, but it works the same as Gnome Terminal.
[1] https://github.com/vimwiki/vimwiki
You can change the key mappings, or you can run Vim as a graphical application (gvim). You may have to install the relevant distribution package (such as vim-gtk3), it is sometimes split from the pure terminal application.
I suspect the author of this extension is using Vim as a GUI application because I don't think there are many terminals which preserve these key combinations.
I have been using iTerm2 and vim for a while. I have experienced some issues when I needed to use key combinations such as CTRL-F10 and SHIFT-F10 inside a vim session running inside iTerm2. It is straight forward to define key bindings such as <C-F10> and <S-F10> for the GUI version of MacVim. No problems there.
However, it proved to be difficult to get the same key combinations in the terminal version of MacVim. I have solved this by using iTerm2's Send Escape Sequence functionality. Once I have defined CTRL-F10 as [21;5~ and SHIFT-F10 as [21;2~ in my iTerm2 profile, those were now working inside the terminal MacVim without any issues.
Recently, I have hit a new wall, when I decided to add tmux to the equation. I have noticed that those escape sequences are no longer working for a terminal MacVim running inside a tmux pane. That is my problem.
I have been focusing on the Send Hex Code option, which seems to be working. I tested it with some known hex codes such as 0x04 which is Ctrl-d and it works. The problem is that I could not find the hex codes for CTRL-F10 and SHIFT-F10.
So the solution is either make tmux receive my escape codes coming from iTerm2 or find the hex codes for the keys that I need to be working inside tmux.
I'm having a problem with Vim (I've had it many times before, and now I finally must post it). I don't believe its just a vim thing, but maybe a combination with running it on ssh. Here is a video showing my problem:
http://screencast.com/t/gGoOuJ7wcLA5
I didn't know a way to explain it, so I took the video. If you can't tell, in the video all I do is move my cursor up and down with the j and k keys for vim. For some reason, vim adds on other { signs when my cursor is over the { sign. Vim garbles a lot of other code that I write too, but I'm hoping this example is good enough. Btw, vim does not actually change this. If I quit vim and reopen the text, the characters written are not there. Could it have anything ot do with my $TERM? I have xterm-256color. I've tried xterm originally too.
I'm running this in iTerm on Mac OSX Lion 10.7 accessing a machine over ssh with a Debian OS.
The problem was that the $TERM in in the Debian OS I was accessing was different than the $TERM for iTerm. Once I made them the same (xterm-256color in my case), the weird problem I had went away.
In case anyone doesn't know how to change that, I ran the following command in my Debian/Ubuntu machine:
export TERM=xterm-256color
and for iTerm on Mac, I went to Preferences -> Profiles -> Terminal -> Report Terminal Type -> Choose xterm-256color or xterm.
Since the check for TERM is done at the beginning of logging onto ubuntu, you may want to include the export command into your bashrc (or equivalent file for another terminal shell).
Does :redraw! remove the rubbish characters?
If so, I would try to solve your problem by trying to download the source of the matchparen.vim plugin (easy to find on google), add redraw! to it, just after the critical bit, where it says "setup match highlighting" and try to load it and use it instead of the original one.
I've been getting more and more comfortable using vi on a daily basis, but one thing that bothers me is that when I use it on Ubuntu it behaves differently than when I use it on CentOS (and probably other places). I actually prefer the way it works in CentOS.
Here are three things that are really bothering me on Ubuntu:
In CentOS insert mode there is a big bold notice at the bottom that I'm in INSERT mode, but in Ubuntu there is no notice so I can never tell which mode I'm in.
In CentOS insert mode I can press the up/down keys and the cursor will move up and down. But when I'm in Ubuntu pressing up and down inserts the letters A and B respectively on new lines.
In CentOS insert mode I can use the backspace key and it will delete the character that is before the cursor, but in Ubuntu I just hear a beep sound and nothing happens. I can press the delete key in command mode, but I'd rather be able to press the backspace key.
Are these differences something that I have to live with or is it an easy fix?
In ubuntu, the default vim install comes from the package vim-tiny, which isn't the whole thing.
You probably want to:
apt-get install vim
or
apt-get install vim-full
Some of your other problems sound like issues with the backspace key and other things. Once you get the full version of vim, try adding these to your .vimrc:
set nocompatible
set t_kb=^H
fixdel
(IMPORTANT NOTE: that ^H is a literal ctrl-H character, which you'll get by doing Ctrl-V Ctrl-H in insert mode)
The previously offered answers did not work for me.
I tend to prefer leaving OS installations as stock as possible and keeping config files as simple as possible. In order to fix these three issues in Ubuntu 12.04, I did the following:
In "~/.vimrc", insert the lines -
set nocp
set bs=2
In addition to installing vim-full, if you do not already hava a ~/.vimrc:
$ cp /usr/share/vim/vimcurrent/vimrc_example.vim ~/.vimrc
This example .vimrc already makes the most important settings and is a good start for customization.
I'll assume you mean VIM when you say VI? And at least, the 2nd point seems to be a console/terminal issue with VIM/term combo. The page below suggests some fixes, but none that I could make work (I use vim over putty to an Ubuntu dev box)
http://vim.wikia.com/wiki/Fix_broken_arrow_key_navigation_in_insert_mode
3rd point can be overwritten by using the following in your .vimrc
set backspace=indent,eol,start
(1) Check if showmode setting is different on both.
(2) Don't know about this one, I think this has more to do with the terminal than Vi itself.
(3) Maybe try using :map <BS> :normal d ?
In CentOS, vi is an alias for a different program, vim, but in recent versions of Ubuntu, vi means just vi, not vim. The difference you see if the difference between two different programs, vi and vim.
If you like vim, just run vim, not vi. This works in Ubuntu too
Setting this in my .vimrc worked for me..
set term=builtin_ansi
I Have WDMyCLoud with Debian 7 inside, im using like:
cp /usr/share/vim/vimcurrent/debian.vim ~/.vimrc
In my case, the .vim file is created as follows:
set nocompatible
fixdel
If I add set t_kb=^H, the backspace key just hehaves as delete key.