ITPub博客

首页 > Linux操作系统 > Linux操作系统 > vim 缩进

vim 缩进

Linux操作系统 作者:G8bao7 时间:2015-05-21 13:59:24 0 删除 编辑

方式一: vim 编辑时设置

:set ts=4 sw=4 sts=4 et

方式二: .vimrc

$ vim ~/.vimrc
#paste the configuration below into the file. Once vim is restarted, the tab settings will apply.
# The width of a TAB is set to 4. Still it is a \t. 
# It is just that Vim will interpret it to be having  a width of 4.
# size of a hard tabstop
set tabstop=4

# Indents will have a width of 4
set shiftwidth=4

# Sets the number of columns for a TAB. a combination of spaces and tabs are used to simulate tab stops at a width
set softtabstop=4

# Expand TABs to spaces. always uses spaces instead of tab characters
set expandtab

# make "tab" insert indents instead of tabs at the beginning of a line
set smarttab


参考
http://stackoverflow.com/questions/1878974/redefine-tab-as-4-spaces


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26250550/viewspace-1665380/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-11-04

  • 博文量
    496
  • 访问量
    1259694