[vim]粘贴到vim的代码,怎样避免向右不断缩进,保持原来的格式?
2012-11-10 00:02
393 查看
一般的vim都默认设置为set nopaste。在粘贴前设置:
set paste使得vim进入粘贴模式,则粘贴过来的内容能够保持原来的格式。
设置前的粘贴效果:
设置set paste后的效果:
但是在粘贴插入模式下代码是不会自动按格式缩进的,需要使用nopaste设置回来
:set nopaste
set paste使得vim进入粘贴模式,则粘贴过来的内容能够保持原来的格式。
设置前的粘贴效果:
You can format/indent an entire file using the gg=G command, where gg - Goto the beginning of the file = - apply indentation G - till end of file For more information, read :help gg :help = :help G :help ''formatprg'' :help C-indenting
设置set paste后的效果:
You can format/indent an entire file using the gg=G command, where gg - Goto the beginning of the file = - apply indentation G - till end of file For more information, read :help gg :help = :help G :help ''formatprg'' :help C-indenting
但是在粘贴插入模式下代码是不会自动按格式缩进的,需要使用nopaste设置回来
:set nopaste
相关文章推荐
- 粘贴到vi/vim的代码,怎样避免向右不断缩进,保持原来的格式?解决vi/vim在粘贴中会在行首多很多缩进和空格的问题。
- vim代码粘贴缩进混乱的问题[Linux]
- vim 使用 smartindent 时,粘贴代码缩进问题
- Vim粘贴代码时缩进混乱
- vim代码粘贴缩进混乱的问题[Linux]
- vim粘贴代码缩进错乱问题
- 对原来的模块修改后,最好在解释器里把修改好的代码重新写再粘贴到py文件里,否则F5运行py模块时,总是出错误,如缩进不对 如for语句没写冒号 就导致cmd sdist和install 出错
- vim粘贴代码格式变乱
- Vim中的鼠标粘贴---怎样避免排版混乱
- vim在插入模式粘贴代码缩进问题解决方法
- vim粘贴代码的时候,恶心的缩进.
- vim粘贴代码格式变乱
- VIM 粘贴代码时恶心的缩进
- 粘贴代码更简单的方法(保持VS.NET中的格式)
- vim粘贴代码时缩进混乱
- vim粘贴代码格式变乱
- vim 粘贴代码格式
- vim编辑时insert模式粘贴代码,造成格式混乱
- vim中键粘贴---导致代码格式混乱 --解决办法!
- 解决vim粘贴代码格式混乱的方法