我想在复制时匹配顶部缩进。复制的内容可以根据top的缩进进行粘贴吗?
源文件call plug#begin('~/.config/nvim/plugged')
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' }
call plug#end()
复制内容Plug '.../...'
Plug '.../...'
我想做什么
call plug#begin('~/.config/nvim/plugged')
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' }
| <- cursor
Plug '.../...'
Plug '.../...'
call plug#end()
实际
call plug#begin('~/.config/nvim/plugged')
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' }
| <- cursor
Plug '.../...'
Plug '.../...' <- need to match the indentation of copying top.
call plug#end()
:设置粘贴
call plug#begin('~/.config/nvim/plugged')
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' }
| <- cursor
Plug '.../...'
Plug '.../...'
call plug#end()
我认为你想要的是自动重新缩进粘贴的文本,你可以通过这些重新标记:
nnoremap p p=']^
nnoremap P P='[^
p=']^
做什么:
p
-按预期粘贴=']
-缩进到粘贴文本的末尾^
-行第一个非空白字符(像普通粘贴一样)
对于P
,它是相同的动作,但向后-因为它粘贴在光标之前。