In the apha and preview releases of ConEmu Backspace deletes characters forward from the cursor like the delete key when I switch to xterm in vim.
When I do :echo getchar() I get the following sequence back in vim: <80>
This is not the case in the Stable version. There I get back the correct sequence: <80>kb
Windows 8.1 64bit
Shell is cmd.exe
vim version is 7.4.1721, the latest 64bit windows version downloaded http://www.vim.org/download.php not the cygwin version.
The bundle is my own vim config, but I removed it and applied only the settings that you can see in the screenshots below. Let me know if you need anything else.
Alpha:
Stable:
Regardless of the 67b809d5f, I consider this is a bug (or configuration problem) of the official vim.
Both cygwin and msys2 versions do not have problems with <BS> key. With or without connector - does not matter.
BTW, strange that my "official" vim prints weird characters on :echo getchar().
| Key | echo result |
| :-- | :-- |
| <Del> | ΠΡP |
| <BS> | ΠkD |
Just tested it, vim reports back <80>kD now, instead of <80>^D<80>kD. The problem is that kD is the delete key and it still deletes characters forward from the cursor when you press backspace.
Btw I just had a look and it seems that 0x7F is ASCII Delete in xterm, Backspace is 0x08. I'm not sure if this would help.
Screenshot:
seems that 0x7F is ASCII Delete in xterm, Backspace is 0x08
Show the proof link.
0x7F is equivalent for ^? which may be "typed" with BS hey. This is so on every terminal I've tried.
Proof: https://en.m.wikipedia.org/wiki/Delete_character
As I said, it seems like a bug in the official vim bundle.
Show the proof link.
https://en.wikipedia.org/wiki/Control_character#In_ASCII
Gvim shows <80>kb same as wtih the stable verson of Conemu
screenshot from gvim:
True for Windows consoles. But seems like Unix terminals (which vim was developed for) uses other notation, not just a ASCII codes. For example Del is represented with \e[3~. And BS - 0x7F. Link above.
Gvim shows <80>kb
What do you mean?
What do you mean?
In gvim when I do :echo getchar() and press backspace I get back <80>kb as shown on the screenshot.
True for Windows consoles. But seems like Unix terminals (which vim was developed for) uses other notation, not just a ASCII codes.
Yes I understand and I have no idea how the mapping is done between conemu and vim when run in cmd.exe.
I am just saying that the backspace key is working as expected when I run the stable conemu version(150813g), it may very well be a bug in the official vim bundle,
backspace key is working as expected when I run the stable conemu version(150813g)
Sure it was. Stable had a bug, the BS key was not translated to corresponding xterm sequence. It is translated now, but vim do not understand it. BTW, googling shows a lot of problems with configuring BS/Del in vim in different terminals.
Thanks for your time investigating this. I'll have a look if I can dig out something about it.
I did some experimenting and got the following results, I used ctrl+v in vim to capture the raw character:
In all terminals that I tested the delete key sends the correct sequence: ^[[3~
In linux using the gnome terminal, the character I got when I press backpace is: ^?
In windows using cmd.exe without conemu I got: ^H
When using cmd.exe with conemu stable I got back also ^H.
When using cmd.exe with the latest conemu I got the 0x07f character.
With cygwin terminal I got ^H
I hope this would help.
Anyway I managed to work around this by setting the following option in vim:
inoremap <Char-0x07F> <BS>
nnoremap <Char-0x07F> <BS>
@etheralm thank you for investigating. I had this exact same problem with ConEmu version 160515. I just copy and pasted
inoremap <Char-0x07F> <BS>
nnoremap <Char-0x07F> <BS>
into my .vimrc and it fixed the issue.
Thanks a lot! Exactly the same issue over here with ConEmu 160522.
Just updated to the stable version 160612 [64 bit], was experiencing the same Backspace / Delete issue here. The @etheralm suggestion of adding:
inoremap <Char-0x07F> <BS>
nnoremap <Char-0x07F> <BS>
to my _vimrc fixed the behavior! :+1:
Can repro but @etheralm 's fix worked for me. Thanks!
same happening with gitbash 2.9.1 X64
@etheralm's fix didn't quite do it for me, but this seems to work just fine for me:
set backspace=indent,eol,start
inoremap <Char-0x07F> <c-r>=Backspace()<CR>
inoremap <BS> <c-r>=Backspace()<CR>
func Backspace()
if col('.') == 1
if line('.') != 1
return "\<ESC>kA\<Del>"
else
return ""
endif
else
return "\<Left>\<Del>"
endif
endfunc
Do any of you use the CtrlP plugin? I'm not able to backspace in the CtrlP prompt. π
I was able to backspace in CtrlP by pressing Ctrl+H.
On Jan 12, 2017 4:16 PM, "Austin Craft" notifications@github.com wrote:
Do any of you use the CtrlP plugin https://github.com/ctrlpvim/ctrlp.vim?
I'm not able to backspace in the CtrlP prompt. πβ
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Maximus5/ConEmu/issues/641#issuecomment-272285898,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAReCpxrmukcmssuovJzVGz2OXFAwYPcks5rRpgggaJpZM4IIP3b
.
Ah, it's because we remapped <BS> to get it working in normal and insert mode. This makes backspace work in the prompt for me.
Note that you'll want to wrap a if !empty($CONEMUBUILD) or if has('win32') around this if you share your vimrc across operating systems.
let g:ctrlp_prompt_mappings = {
\ 'PrtBS()': ['<Char-0x07F>', '<c-h>']
\ }
The solutions mentioned above
inoremap <Char-0x07F> <BS>
nnoremap <Char-0x07F> <BS>
and
set backspace=indent,eol,start
inoremap <Char-0x07F> <c-r>=Backspace()<CR>
inoremap <BS> <c-r>=Backspace()<CR>
func Backspace()
if col('.') == 1
if line('.') != 1
return "\<ESC>kA\<Del>"
else
return ""
endif
else
return "\<Left>\<Del>"
endif
endfunc
doesn't work, backspace deletes one character and does not move left, but just stays at the same position, does anyone know a fix for that??
So what does one have to do to get this fixed? It used to work on my old machine, but I had to reinstall on a new laptop and now BACKSPACE does DELETE and none of the "fixes" make any difference.
Read the links I've posted here. Especially this one: http://conemu.github.io/en/VimXterm.html#vim-bs-issue
Actually, if you have access to your old machine, it would be easy to compare configs or anything else.
For people who are still having the problem, a vim plugin is likely mapping backspace or ctrl-h
Check which script is doing it by looking at the output of:
:verbose map <bs>
:verbose map <c-h>
Disable the problem plugins. This is what I had to do.
Looks like vim indeed selects the wrong terminal sequences for both backspace and delete at startup, ConEmu is sending the correct codes..
I fixed with the following in vimrc:
let &t_kb = nr2char(127)
let &t_kD = "^[[3~"
let &t_kb = nr2char(127)
let &t_kD = "^[[3~"
This will make ^(to the first non-blank character of the line) extermely slow
Vim 8.2 totaly broke BS. Comparing 8.1 and earlier.
ΠΠΎΡΠΎΡΠ΅ Π³ΠΎΠ²ΠΎΡΡ, Π²ΠΈΠΌ 8.2 Ρ ΠΎΠ΄Π½ΠΎΠΉ-Π΅Π΄ΠΈΠ½ΡΡΠ²Π΅Π½Π½ΠΎΠΉ ΡΡΡΠΎΡΠΊΠΎΠΉ Π² ΠΊΠΎΠ½ΡΠΈΠ³Π΅ set term=xterm ΡΠ²ΠΎΡΠΈΡ Ρ Π±ΡΠΊΡΠΏΠ΅ΠΉΡΠΎΠΌ ΡΡΠ΄Π΅ΡΠ°, ΠΈ Π½Π΅ ΠΏΠΎΠΌΠΎΠ³Π°Π΅Ρ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ inoremap <Char-0x07F> <BS> Π ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠΈΡ
Π²Π΅ΡΡΠΈΡΡ
β 8.1 - 7.4 ΠΏΡΠΎΠ±Π»Π΅ΠΌ Π½Π΅ Π±ΡΠ»ΠΎ, Π° ΡΡΡ ΡΠ°ΠΌΠΎΠ΅ ΠΌΡΠ³ΠΊΠΎΠ΅ β Π²ΡΡΠ°Π²Π»ΡΠ΅Ρ Π²ΠΌΠ΅ΡΡΠΎ Π±ΡΠΊΡΠΏΠ΅ΠΉΡΠ° ΠΊΠΎΠΌΠ±ΠΈΠ½Π°ΡΠΈΡ Γx. Π― Π΄Π°Π»Π΅ΠΊΠΎ Π½Π΅ ΠΏΡΠΎΠ΄Π²ΠΈΠ½ΡΡΡΠΉ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ Π²ΠΈΠΌΠ°, Π½ΠΎ Π°Π±ΡΠΎΠ»ΡΡΠ½ΠΎ Π·Π°ΠΊΠΎΠ»Π΅Π±Π°Π»ΡΡ, ΠΏΡΡΠ°ΡΡΡ ΡΠ΅ΡΠΈΡΡ ΡΡΡ ΠΏΡΠΎΠ±Π»Π΅ΠΌΡ ΡΠ°ΠΌΠΎΡΡΠΎΡΡΠ΅Π»ΡΠ½ΠΎ. ΠΡΠ³Π»ΠΈΠ», ΠΌΠ΅ΡΠΎΠ΄ΠΎΠΌ ΠΏΠΎΠ»ΠΎΠ²ΠΈΠ½Π½ΠΎΠ³ΠΎ Π΄Π΅Π»Π΅Π½ΠΈΡ ΠΎΡΠΊΠ»ΡΡΠ°Π» ΠΊΡΡΠΊΠΈ ΠΊΠΎΠ½ΡΠΈΠ³ΠΎΠ² ΠΈ ΠΏΠ»Π°Π³ΠΈΠ½Ρ, ΠΈΡΠΊΠ°Π», ΠΊΠ°ΠΊΠ°Ρ ΡΠ²ΠΎΠ»ΠΎΡΡ ΡΠ°ΠΌΠ° ΠΌΠ°ΠΏΠΈΡΡΡ Π½Π° Π±ΡΠΊΡΠΏΠ΅ΠΉΡ :verbose map <bs> (ΡΠΏΠΎΠΉΠ»Π΅Ρ: Π½ΠΈΠΊΠ°ΠΊΠ°Ρ), ΠΈΡΠΊΠ°Π», ΠΊΠ°ΠΊ ΠΏΠ΅ΡΠ΅ΠΌΠ°ΠΏΠΈΡΡ ΡΠ°ΠΌΠΎΠΌΡ, ΠΏΠΎ ΠΏΡΠΈΠΌΠ΅ΡΡ Π²ΡΡΠ΅ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠ³ΠΎ inoremap <Char-0x07F> <BS> Π½ΠΎ ΡΠ°ΠΊ ΠΈ Π½Π΅ Π½Π°ΡΡΠ», ΠΊΠ°ΠΊΠΈΠΌ ΠΎΠ±ΡΠ°Π·ΠΎΠΌ Π½ΡΠΆΠ½ΠΎ Π·Π°ΠΏΠΈΡΡΠ²Π°ΡΡ ΡΡΠΎΡ Γx, ΡΡΠΎΠ±Ρ Π²ΠΈΠΌ ΠΏΠΎΠ½ΠΈΠΌΠ°Π», ΡΡΠΎ Ρ ΠΎΡ Π½Π΅Π³ΠΎ Ρ
ΠΎΡΡ.
ΠΠΎΠΊΠ° ΡΡΠΎ Ρ ΠΌΠ΅Π½Ρ Π΄Π²Π° Π²ΡΡ ΠΎΠ΄Π°: ΠΏΡΠΈΠ²ΡΠΊΠ½ΡΡΡ ΠΊ Ρ ΠΎΡΠΊΠ΅ΡΠΌ Ctrl+H ΠΈ Ctrl+W ΠΈΠ»ΠΈ ΡΠΈΠ΄Π΅ΡΡ Π½Π° Π²Π΅ΡΡΠΈΠΈ 8.1.
P.s. ΠΠΎ Π½Π΅ΠΊΠΎΡΠΎΡΡΠΌ ΠΏΡΠΈΡΠΈΠ½Π°ΠΌ Π² ΠΊΠΎΠ½ΡΠΈΠ³Π΅ ConEmu Ρ ΠΌΠ΅Π½Ρ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΎ chcp 65001 ΠΈ ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΡΡΡΠΈΠ΅ ΠΏΡΠ°Π²ΠΊΠΈ Π² ΠΊΠΎΠ½ΡΠΈΠ³Π΅ Π²ΠΈΠΌΠ°: set encoding=utf-8 ΠΈ set termencoding=utf-8
Getting the same in 8.2
None of the fixes work. Extremely annoying.
Vim 8.2 totaly broke BS. Comparing 8.1 and earlier.
I confirm the problem still exists. Just upgraded to Vim 8.2 and having exactly the same experience. This is not related to ConEmu, it's the same in Windows Terminal.
Most helpful comment
I did some experimenting and got the following results, I used ctrl+v in vim to capture the raw character:
In all terminals that I tested the delete key sends the correct sequence: ^[[3~
In linux using the gnome terminal, the character I got when I press backpace is: ^?
In windows using cmd.exe without conemu I got: ^H
When using cmd.exe with conemu stable I got back also ^H.
When using cmd.exe with the latest conemu I got the 0x07f character.
With cygwin terminal I got ^H
I hope this would help.
Anyway I managed to work around this by setting the following option in vim:
inoremap <Char-0x07F> <BS>nnoremap <Char-0x07F> <BS>