Vim与Python的天作之合macOS配置

首先 , 打开电脑终端并执行以下命令安装Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"更多关于Homebrew, 大家可以访问官网:https://brew.sh/
安装Vim:
brew install vim安装Vim插件:Vundlegit clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim如果您的电脑上还没安装git就先执行以下命令安装:
brew install git创建.vimrc文件于根目录touch ~/.vimrc将以下这些代码复制并粘贴至刚刚创建的.vimrc文件中的最顶部
set nocompatible" requiredfiletype off" required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'gmarik/Vundle.vim'" add all your plugins here (note older versions of Vundle" used Bundle instead of Plugin)" ..." All of your Plugins must be added before the following linecall vundle#end()" requiredfiletype plugin indent on" required然后运行:
:PluginInstall之后您就可以以此类推安装各种各样的插件了 , 
此文不能将所有插件一一列出 , 但可推荐对于Python开发非常有用的一些 。
分屏布局:横屏命令:
:sp <文件名>

Vim与Python的天作之合macOS配置

文章插图
 
竖屏命令:
:vs <文件名>
Vim与Python的天作之合macOS配置

文章插图
 
可设置分屏为向下或向右分:
set splitbelowset splitright代码伸缩功能:(详情:https://vim.fandom.com/wiki/Folding)
set foldmethod=indentset foldlevel=99用空格键快速执行伸缩命令:
" Enable folding with the spacebarnnoremap <space> za准确伸缩插件:
Plugin 'tmhedberg/SimpylFold'添加之后执行安装命令:
:PluginInstall添加可见代码伸缩:
let g:SimpylFold_docstring_preview=1支持UTF-8
set encoding=utf-8PEP 8规范查看:
Plugin 'nvie/vim-flake8'美化代码:
let python_highlight_all=1syntax on编辑器主题:
Plugin 'morhetz/gruvbox'文件浏览:
Plugin 'scrooloose/nerdtree'Plugin 'jistr/vim-nerdtree-tabs'let NERDTreeIgnore=['.pyc$', '~$'] "ignore files in NERDTree超级搜索:
Plugin 'kien/ctrlp.vim'Git集成
Plugin 'tpope/vim-fugitive'【Vim与Python的天作之合macOS配置】状态条
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}如果您嫌烦 , 直接访问以下地址粘贴复制设置即可:
https://github.com/wangold/vim-config/blob/master/vimrc




    推荐阅读