In vim, mouse clicks and scrolls are seen as keystrokes and messing up my text
I am having issues with my vim setup. If I click, or if I scroll with the mouse inside vim, I get a strange behavior. Those actions sometimes change my mode to insert and copy or paste things from the register, or insert random characters.
I do not know when the problem started since I do not use my mouse too often inside vim. However, sometimes I click or scroll on my window, and these commands are messing up my document.
I am using arch with i3 and uxrvt. I would also share my .vimrc file, but I am new here, so I do not know if I should just copy and paste it.
I noticed that if I open vim with xterm instead of uxrvt, the mouse clicks and scrolls refresh the cursor and place it at the middle of the screen and to the left.
I have set the option set mouse=a
in my .vimrc
Please help me :)
Ok, I figured it out what was the issue. At some point, I mapped this command: nnoremap <esc> :noh<return><esc>
to disable the highlighted results of a search after pressing <esc>
When reading :h set ttymouse
, I realized that the mouse clicks and scrolls return <esc>
and some other characters to the editor. This, together with my remapping of <esc>
was messing up the return values of my mouse.
I fixed it by removing my remapping of <esc>
, but I would like to use that mapping without messing my mouse :(
上一篇: 如何在vi编辑器中搜索文本后摆脱棕色背景