轉載自本人獨立博客:https://liushiming.cn/2020/01/18/vim-copy-issue-in-iterm2/git
最近發如今iterm2
中打開vim
,用鼠標選中文字,並用command + c
複製選中的文字,但粘貼出來是空的。查了一圈終於在iterm2的官方gitlab issue庫裏發現瞭解決辦法。將Enable mouse reporting這個設置去掉便可。vim
操做系統
Mac os 10.15.2gitlab
iterm2
iterm2 3.3.6
iterm2 3.3.7操作系統
vim
Vi IMproved 8.1 (2018 May 18, compiled Dec 26 2018 02:33:06)code
iterm2
中使用cat
命令打印文件,而後用鼠標選中command + c
能夠正常複製。vim
打開文件,選中文字用command + c
複製,卻不能複製。vim
中的文字後,vim
會自動變爲visual
模式。iterm2 > Preferences > Profiles > Terminal > Enable mouse reporting 去掉勾選
terminal
mouse reporting的做用是在vim編輯時識別鼠標,能夠支持鼠標滾輪查看文件內容(須要在.vimrc中加入設置支持鼠標set mouse=a
)。關閉了mouse reporting後就不支持鼠標滾輪了。get
那要使用鼠標滾輪怎麼辦?博客
可在iterm2 > preferences > advance > 搜索mouse > scroll whell down 那裏寫\j > scroll whell up那裏寫\k
,做用就是發送j/k鍵到vim實現滾動效果。
it
Mac自帶的terminal也會有這個問題,在View > Allow Mouse Reporting 去掉勾選
便可
class