简体   繁体   中英

Vim on windows works weirdly when using it as git editor

When I'm using git and running any command which intends to open an editor (like git commit or git rebase -i ) it opens up vim as expected in powershell but it behaves very strangely.
If i press <Ctrl + Right arrow> it erases a lot of content in the file and turns insert mode on but it should advance the cursor to the end of the next word keeping the current mode
If i open COMMIT_EDITMSG in another terminal with powershell and proceed with E (Forcing it not to use swap) it works just fine. I tried different terminal emulators like cmd and powershell terminal but it works the same (weird) way in all of them

Fixed it using neovim instead of vim

Note that it also act strangely when leaving vim, displaying the commit message poorly:

https://user-images.githubusercontent.com/929932/110089418-6354cb80-7d96-11eb-8544-22c30c4a3a35.png

This is followed by microsoft/terminal issue 9359 , and mentioned in the latest Git For Windows release 2.34 : check if Git 2.34 would behave better with vim in your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM