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 |
时间: 2024-10-10 04:46:51