Two problems with Vim under Windows
巴扎黑
巴扎黑 2017-05-16 16:39:35
0
4
652

Question 1: How to solve garbled characters

On Windows 8, there are two types of garbled characters:
- The first is garbled characters
when starting the welcome interface. - The second manifestation is (for example) when you perform a certain search and the search has reached the end, Vim will display the prompt message "It has reached the end" in the command bar, but most of the time the command bar appears as garbled characters.

In addition, my settings for file encoding in .vimrc are as follows: Complete .vimrc configuration

shellset nocp
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,big5,gb2312,latin1,cp936,gb18030
set ffs=unix,dos,mac
set mousehide
set showcmd

Question 2: Copy and Paste with Clipboard

I set the mouse to be disabled in .vimrc, so the mouse has no effect, so how do I interact with the clipboard when copying and pasting?

巴扎黑
巴扎黑

reply all(4)
漂亮男人

My settings for this section are

vimrcif has("gui_running")
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1

if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif

let &termencoding=&encoding

"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim

"解决consle输出乱码
language messages zh_CN.utf-8
endif

It is normal under the command line or in gvim. Including the menu, the following prompts, etc. can all display Chinese correctly. You can try it. I am using win8.1 system.


Copy and paste, I use "+y"+p.

仅有的幸福

How do I remember that after 7.4, Chinese will be supported without special settings
Interact with the clipboard if ms-win is enabled in vimrc. You can enter selection mode with v, Ctrl-c v. A more vi-friendly approach is to first use "+ or "* to select the system register, which is the clipboard, when y or p.

習慣沉默

Not to mention other configurations, this sentence alone must have a big problem:

set termencoding=utf-8

This setting is the encoding of the interface, and WINDOWS is definitely not UTF-8. Try removing this setting

刘奇

CMD is GBK encoded by default. It’s not convenient for you to use termencoding设置为utf-8不乱码才怪了,解决的办法 …… 改termencoding, so just use gvim.

In addition, the problem of interoperability with the system clipboard can be configured clipboard. My configuration is copied from spf13-vim:

vimlif has('clipboard')
    if has('unnamedplus')  " When possible use + register for copy-paste
        set clipboard=unnamed,unnamedplus
    else         " On mac and Windows, use * register for copy-paste
        set clipboard=unnamed
    endif
endif

For details, please refer to: http://vim.wikia.com/wiki/Accessing_the_system_clipboard

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!