vim easy-align插件使用

Posted juandx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vim easy-align插件使用相关的知识,希望对你有一定的参考价值。

https://github.com/junegunn/vim-easy-align

 

用vundle安装, 添加下面到vimrc

Plugin ‘junegunn/vim-easy-align‘

" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)

" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)

  

 

我感觉就是使用有点难学

 

先用v选择多行

ga进入easyalign模式

默认向左对其,比如按照空格对其  *<space>

向右对其 <enter>*<space>

居中对其 <enter><enter>*<space>

如果遇到其他字符比如 | , = 啥的,都把空格替换为对应的即可

*可以换成数字,对应后面的第几个字符,*就是全部都指定

 

比如这个

| Option| Type | Default | Description |
|--|--|--|--|
| threads | Fixnum | 1 | number of threads in the thread pool |
|queues |Fixnum | 1 | number of concurrent queues |
|queue_size | Fixnum | 1000 | size of each queue |
|   interval | Numeric | 0 | dispatcher interval for batch processing |
|batch | Boolean | false | enables batch processing mode |
 |batch_size | Fixnum | nil | number of maximum items to be assigned at once |
 |logger | Logger | nil | logger instance for debug logs |

试试vipga*|

vip是选择多行,ga是进入easyalign模式,*|是指对|对齐

就变成了这样

vipga*|
| option     | type    | default | description                                    |
| --         | --      | --      | --                                             |
| threads    | fixnum  | 1       | number of threads in the thread pool           |
| queues     | fixnum  | 1       | number of concurrent queues                    |
| queue_size | fixnum  | 1000    | size of each queue                             |
| interval   | numeric | 0       | dispatcher interval for batch processing       |
| batch      | boolean | false   | enables batch processing mode                  |
| batch_size | fixnum  | nil     | number of maximum items to be assigned at once |
| logger     | logger  | nil     | logger instance for debug logs                 |


vipga<enter>*|
 |     option |    type | default |                                    description |
 |         -- |      -- |      -- |                                             -- |
 |    threads |  fixnum |       1 |           number of threads in the thread pool |
 |     queues |  fixnum |       1 |                    number of concurrent queues |
 | queue_size |  fixnum |    1000 |                             size of each queue |
 |   interval | numeric |       0 |       dispatcher interval for batch processing |
 |      batch | boolean |   false |                  enables batch processing mode |
 | batch_size |  fixnum |     nil | number of maximum items to be assigned at once |
 |     logger |  logger |     nil |                 logger instance for debug logs |
 

vipga<enter><enter>*|
 |   option   |  type   | default |                  description                   |
 |     --     |   --    |   --    |                       --                       |
 |  threads   | fixnum  |    1    |      number of threads in the thread pool      |
 |   queues   | fixnum  |    1    |          number of concurrent queues           |
 | queue_size | fixnum  |  1000   |               size of each queue               |
 |  interval  | numeric |    0    |    dispatcher interval for batch processing    |
 |   batch    | boolean |  false  |         enables batch processing mode          |
 | batch_size | fixnum  |   nil   | number of maximum items to be assigned at once |
 |   logger   | logger  |   nil   |         logger instance for debug logs         |

  

以上是关于vim easy-align插件使用的主要内容,如果未能解决你的问题,请参考以下文章

vim代码片段插件ultisnips的使用

从零开始配置vim(27)——代码片段

从零开始配置vim(27)——代码片段

从零开始配置vim(27)——代码片段

latex在vim中的代码片段

使用pep8 vim插件规范Python代码