1.一键执行:
使用vim写完python代码后按F5实现一键执行的功能,写完测试不用退出vim
vim /etc/vimrc 将其追加到文件
""""""""""""""""""""""
"Quickly Run
""""""""""""""""""""""
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!g++ % -o %<"
exec "!time ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "!time ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!time java %<"
elseif &filetype == 'sh'
:!time bash %
elseif &filetype == 'python'
exec "!time python2.7 %"
elseif &filetype == 'html'
exec "!firefox % &"
elseif &filetype == 'go'
" exec "!go build %<"
exec "!time go run %"
elseif &filetype == 'mkd'
exec "!~/.vim/markdown.pl % > %.html &"
exec "!firefox %.html &"
endif
endfunc
2.vim 代码补全工具snipmate (使用Vundel插件管理)
使用tab即可进行补全
mkdir -p vim/bundle #创建目录用来放安装包
cd ~/.vim/bundle #链接已经整理完毕
git clone https://gitee.com/vim_runtime_plugins/vim-addon-mw-utils.git
git clone https://gitee.com/vim_runtime_plugins/vim-snipmate.git
git clone https://github.com/tomtom/tlib_vim.git
git clone https://github.com/honza/vim-snippets.git
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim /etc/vimrc
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
call vundle#end()
filetype plugin indent on
let g:snipMate = { 'snippet_version' : 1 }
具体快捷命令可查看
~/.vim/bundle/vimsnippets/snippets/python.snippets文件
3.语法检查插件Syntastic
git clone https://github.com/scrooloose/syntastic.git
cd /etc/vimrc
Plug 'scrooloose/syntastic'
4.编程提示插件jedi-vim
cd ~/.vim/bundle
git clone https://gitee.com/mamamiyear/jedi-vim.git
vim /etc/vimrc
Plugin 'file:///root/.vim/bundle/jedi-vim'
vim
:PluginInstall
即可
本文介绍了如何在Vim中设置一键执行功能,涵盖了多种编程语言,并推荐了Snipmate代码补全、Syntastic语法检查和jedi-vim编程提示插件。此外,还演示了如何安装和配置这些工具以提升编程效率。

400

被折叠的 条评论
为什么被折叠?



