VimPlus配置vim编辑器,并打造python、C++编辑器
在使用vimplus两天后感觉还是挺方便的,毕竟不用自己配(2333)
安装vimplus
git clone https://github.com/chxuan/vimplus.git ~/.vimplus
cd ~/.vimplus
./install.sh
更新vimplus
./update.sh
关于vimplus的插件和快捷键可以去其github上了解
https://github.com/chxuan/vimplus
使用vimplus的插件管理工具vim-plug安装异步代码运行插件asyncrun.vim
github:https://github.com/skywind3000/asyncrun.vim
在~/.vimrc 文件中加入 Plug 'skywind3000/asyncrun.vim'
输入vim命令打开vimplus,输入:PlugInstall 安装插件
配置vim编辑器 “F5”键 运行python和C++脚本
在~/.vimrc 文件中加入以下代码即可
map <F5> :call Runcode()<CR>
func! Runcode()
exec "w"
if &filetype == 'python'
if search("@profile")
exec "AsyncRun kernprof -l -v %"
exec "copen"
exec "wincmd p"
elseif search("set_trace()")
exec "!python3 %"
else
exec "AsyncRun -raw python3 %"
exec "copen"
exec "wincmd p"
endif
elseif &filetype == 'c'
exec "AsyncRun! gcc % -o %<; time ./%<"
elseif &filetype == 'cpp'
exec "AsyncRun! g++ -std=c++11 % -o %<; time ./%<"
exec "copen"
exec "wincmd p"
elseif &filetype == 'java'
exec "AsyncRun! javac %; time java %<"
endif
endfunc