Centos7安装vim并配置开发环境

1:用xshell连接虚拟机
xshell是NetSarang开发的一个强大的安全终端模拟软件。使用方便,支持中国字符显示,可以像操作文本编辑器那样直接复制粘贴,而且有免费版。xftp远程上传和下载文件也很好用。
xshell下载链接:https://www.netsarang.com/zh/xshell/
在这里插入图片描述
2:安装vim

yum -y install vim*

在这里插入图片描述
3:配置.vimrc
在root目录下如果没有.vimrc就新建一个。
复制粘贴以下内容,配置来源https://www.cnblogs.com/smallest/articles/2411918.html

"预防手误
nnoremap : :
cnoremap Q! q!
command Q q
command Wq wq
command WQ wq
"文本格式编排
set nocompatible
filetype on
set encoding=utf-8  
set number
syntax on
set confirm
set tabstop=4
set shiftwidth=4
set cindent
set smartindent
set autoindent
set mouse=a
set showmatch
set nohls
set incsearch
"设置= + - * < >前后自动空格
""设置,后面自动添加空格
function! EqualSign(char)
if a:char  =~ '='  && getline('.') =~ ".*("
return a:char
endif 
let ex1 = getline('.')[col('.') - 3]
let ex2 = getline('.')[col('.') - 2]
if ex1 =~ "[-=+><>\/\*]"
if ex2 !~ "\s"
return "\<ESC>i".a:char."\<SPACE>"
else
return "\<ESC>xa".a:char."\<SPACE>"
endif 
else
if ex2 !~ "\s"
return "\<SPACE>".a:char."\<SPACE>\<ESC>a"
else
return a:char."\<SPACE>\<ESC>a"
endif 
endif
endif
endfunction

let g:equ=1
if exists("g:equ")
:inoremap = <c-r>=EqualSign('=')<CR>
:inoremap + <c-r>=EqualSign('+')<CR>
:inoremap - <c-r>=EqualSign('-')<CR>
:inoremap * <c-r>=EqualSign('*')<CR>
:inoremap / <c-r>=EqualSign('/')<CR>
:inoremap > <c-r>=EqualSign('>')<CR>
:inoremap < <c-r>=EqualSign('<')<CR>
:inoremap , ,<space>
endif

set mouse=a是在vim所有模式中使用鼠标,此时鼠标右键无效了,可用鼠标中键实现粘贴功能。
4:安装ctag和taglist

yum -y install ctags

在windows从https://www.cnblogs.com/feichexia/archive/2012/11/05/vim2_taglist.html下载taglist插件
并解压,将解压后得到的doc和plugin复制到虚拟机设置的共享文件夹中,或者通过xftp工具上传到虚拟机中。

在用户的根目录(我用的是root目录)中建立 .vim目录,并将doc和plugin复制到.vim 中。

mkdir /root/.vim
cp -r /root/win/share/doc /root/.vim/
cp -r /root/win/share/plugin /root/.vim/

在vim底行模式下输入Tlist即可开启Tlist
在这里插入图片描述
在这里插入图片描述
5:关于taglist的配置
在.vimrc中加入以下几行

let Tlist_Exit_OnlyWindow=1
let Tlist_Use_Right_Window=1
let Tlist_Auto_Open=1
let Tlist_File_Fold_Auto_Close=1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值