Ⅰ. 插件描述
:snake: Text objects, folding, and more for Python and other indented languages.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'tweekmonster/braceless-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'tweekmonster/braceless-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'tweekmonster/braceless-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/tweekmonster/braceless.vim
Ⅳ. 文档说明
Text objects, folding, and more for Python and other indented languages.
CoffeeScript support is already baked in, but mainly as an incomplete proof of
concept.
Usage
Use your favorite plugin plugin of choice to installtweekmonster/braceless.vim
, then add a line like this to your vimrc file:
autocmd FileType python BracelessEnable +indent
The command arguments are:
Option | Description |
---|---|
+indent | Enable indent handling |
+fold | Enable folding |
+fold-slow | Enable indentexpr folding, which is depreciated and slow |
+highlight | Enable indent guide |
+highlight-cc | Enable indent guide, but use colorcolumn |
+highlight-cc2 | Enable indent guide and use colorcolumn |
The default motion of interest is P
. It can be used for things like vaP
,ciP
, >iP
, etc. :h braceless
Covers the details of this plugin.
Text objects
Braceless doesn't give you similarly indented blocks as text objects. You get
actual code blocks using iP
and aP
.
Object motions
Moving to recognized blocks is done with [[
and ]]
. In Python, [m
and]m
moves to def
and class
blocks, while [M
and ]M
moves to the end of
those blocks.
Folding
Get useful code folding by adding +fold
. ~~Unfortunately, this can be a
little slow on large scripts.~~ Folding is now much faster! Read theboring exciting details in :h braceless-folds
!
Indent guide
See what indent level you're operating on with +highlight
. You can also
enable colorcolumn
so the guide can span the height of the window. If you
would like this kind of indent highlighting in other files that don't need
Braceless, take a look at
local-indent.vim
Somewhat intelligent auto-indent
Ever wished for autoindent that didn't make you fix the indent? Wish no more,
- Just add
+indent
. It's not perfect, but it's definitely better. There - even PEP 8 indentation built in, and if you use
delimitMate with the expand_cr
option enabled, Braceless will disable it temporarily when you're messing with
block arguments.
(The backspace key was never used in the image above)
EasyMotion
Built-in support for EasyMotion.
Not just Python!
Braceless can simply recognize indentation.
The above GIF was using:
autocmd FileType haml,yaml,coffee BracelessEnable +indent +fold +highlight
You can extend Braceless to give full support to other indented languages.
See :h braceless-custom
License
MIT