使用 vim 粘贴会将内容挤压在先前内容和边距之间

使用 vim 粘贴会将内容挤压在先前内容和边距之间

我正在学习 vim 并开始复制粘贴。或者猛拉粘贴。现在,当我尝试粘贴一段拉出的文本时,它会将之前的内容推到右侧并挤入左侧。我拍了两张屏幕截图来向您展示我的意思。和

粘贴前: 粘贴前

粘贴后: 粘贴后

我不认为我的 .vimrc 影响粘贴行为:

execute pathogen#infect()
set number
set tabstop=3 "tabs are 3 spaces big (smaller than default)
set shiftwidth=3 "3 spaces are also used with auto indent
set smartindent "You'll keep the indentation on the next line when you press enter.

"auto complete brackets
inoremap { {}<Esc>i 
inoremap [ []<Esc>i
inoremap ( ()<Esc>i

let g:solarized_termcolors=256
syntax on
set t_Co=256
colorscheme solarized
set background=light

"remap CTRL-c in visual mode for copy to clipboard
vnoremap <C-c> "+y

"Let vim change the working directory automatically (so you can open files from the current path)
set autochdir

"Open new split panes to right and bottom, which feels more natural than Vim’s default:
set splitbelow
set splitright

"map a key to maximize current screen
map <F5> <C-W>_<C-W><Bar>
map <F6> <C-W>=

答案1

vim多种复制/粘贴的方法。 (在下面的枚举中,我仅使用第一个显示三个变体标记然后复制/粘贴文本。)

  1. 选择整行范围:键入V,移动到范围末尾,键入y。然后转到目标位置并使用p打印当前行下方的文本或使用P打印上方的文本。
  2. 选择字符精度的文本范围:键入v,移动到该区域的末尾(可能位于另一行),然后键入y。然后转到目标位置并使用p打印当前字符之后复制的文本或P之前打印。 (保留现有换行符。)
  3. 选择一个堵塞文本:键入Ctrl-V,移动到矩形块的末尾,键入y。如果将此块粘贴到现有文本中,则现有文本将向右移动,为新文本腾出位置。

您的复制/粘贴方法似乎是 3。 - 使用最适合您需求的其他方法之一。

相关内容