vim win装_windows10安装配置vim8.2

windows10 安装配置vim8.2

安装64位vim

当python安装的是64位,那么一定要下载和安装64位的vim,因为有些插件会用到python的dll,否者,可能会出现问题。现在大家的电脑应该都是64位了,建议大家统一64位。

安装vim,假设安装在D:\Software\Vim\下

下载vim-plug这个插件

修改vim配置文件,windows下是~\_vimrc

" Vim with all enhancements

source $VIMRUNTIME/vimrc_example.vim

source ~\vimfiles\autoload\plug.vim

" 之后通过vim-plug安装的插件就会安装到`~\vimfiles\plugged`这个目录下

" vim-plug的README上说,要避免使用`plugin`这个目录的名称,防止和vim标准的插件混淆

call plug#begin('~\vimfiles\plugged')

" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align

Plug 'junegunn/vim-easy-align'

" Any valid git URL is allowed

Plug 'https://github.com/junegunn/vim-github-dashboard.git'

" Multiple Plug commands can be written in a single line using | separators

Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'

" On-demand loading

Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }

" Using a non-master branch

Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }

" markdown-preview

Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }

call plug#end()

" 设置配色方案

colorscheme morning

" 字体类型和大小

set guifont=Consolas:h12

set nu

set relativenumber

" 换行时,自动缩进4列; 使用``缩进时,缩进4列

set shiftwidth=4

set tabstop=4

" 把输入的tab字符替换空格,具体空格数,跟tabstop设置的值有关

expandtab

" 会影响到Backspace键删除多个空格和删除tab字符的行为

set softtabstop=4

set fileencodings=utf-8,chinese,latin-1

set encoding=utf-8

set belloff=all

syntax on

if has("win32")

set fileencoding=chinese

else

set fileencoding=utf-8

endif

" 解决菜单乱码

source $VIMRUNTIME/delmenu.vim

source $VIMRUNTIME/menu.vim

" Use the internal diff if available.

" Otherwise use the special 'diffexpr' for Windows.

if &diffopt !~# 'internal'

set diffexpr=MyDiff()

endif

function MyDiff()

let opt = '-a --binary '

if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif

if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif

let arg1 = v:fname_in

if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif

let arg1 = substitute(arg1, '!', '\!', 'g')

let arg2 = v:fname_new

if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif

let arg2 = substitute(arg2, '!', '\!', 'g')

let arg3 = v:fname_out

if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif

let arg3 = substitute(arg3, '!', '\!', 'g')

if $VIMRUNTIME =~ ' '

if &sh =~ '\

if empty(&shellxquote)

let l:shxq_sav = ''

set shellxquote&

endif

let cmd = '"' . $VIMRUNTIME . '\diff"'

else

let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'

endif

else

let cmd = $VIMRUNTIME . '\diff'

endif

let cmd = substitute(cmd, '!', '\!', 'g')

silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3

if exists('l:shxq_sav')

let &shellxquote=l:shxq_sav

endif

endfunction

然后执行:PlugInstall 安装这些插件,过程有点慢,如果等不了,可以先把插件download下来,

直接放在~\vimfiles\plugged\这个目录下

后期再记录一些vim有用的一些技巧和插件

技巧1

vim new_dir/new_file.md

当保存文件时,提示E212: Can't open file for writing

解决方法:

windows下

:!MD -p %:h

linux下

:!mkdir -p %:h

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值