处理Linux系统的VIM编辑器不能右键复制粘贴的方法【测试成功】

艺帆风顺 发布于 2025-04-03 20 次阅读


一、故障现象

    在vim编辑文本时,无法执行右击鼠标进行黏贴,需要对其进行解决。

    查看版本:

    root@test:~# lscpu架构: x86_64 CPU 运行模式:32-bit, 64-bit Address sizes: 45 bits physical, 48 bits virtual 字节序: Little EndianCPU: 4 在线 CPU 列表:0-3厂商 ID:GenuineIntel BIOS Vendor ID: GenuineIntel 型号名称: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz BIOS Model name: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz CPU @ 2.4GHz BIOS CPU family: 2 CPU 系列:6 型号: 140 每个核的线程数: 1 每个座的核数: 2 座: 2 步进: 1 BogoMIPS: 4838.40 标记: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse 2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_relia ble nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movb e popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid _fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512 bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid movdiri movdir64b fsrm avx512_vp2in tersect md_clear flush_l1d arch_capabilitiesVirtualization features:  超管理器厂商: VMware 虚拟化类型: 完全Caches (sum of all):  L1d: 192 KiB (4 instances) L1i: 128 KiB (4 instances) L2: 5 MiB (4 instances) L3: 16 MiB (2 instances)NUMA:  NUMA 节点:1 NUMA 节点0 CPU:0-3Vulnerabilities:  Itlb multihit: KVM: Mitigation: VMX unsupported L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Retbleed: Not affected Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence Srbds: Not affected Tsx async abort: Not affected
      root@test:~# cat /etc/os-release NAME="openKylin"FULL_NAME="openKylin"VERSION="1.0 (yangtze)"VERSION_US="1.0 (yangtze)"ID=openkylinPRETTY_NAME="openKylin 1.0"VERSION_ID="1.0"HOME_URL="https://www.openkylin.top/"VERSION_CODENAME=yangtzePRODUCT_FEATURES=3
        root@test:~# uname -r6.1.0-3-generic

        二、临时性解决

            用vim时,鼠标右键不能粘贴而是进入了visual模式,解决方法:

            按esc

            之后输入:set mouse-=a

        三、永久性解决

            vim ~/.vimrc

            加入set mouse-=a参数即可

          set mouse-=aset numbersyntax onset autoindentfiletype onset hlsearchset showmatchset omnifunc=syntaxcomplete#Completeset autowrite