Tab Vs Space preferences in Vim

前端 未结 7 1046
眼角桃花
眼角桃花 2020-12-07 07:31

Vim is very accommodating when it comes to tab Vs. space preferences. As I understand it, the tabstop setting indicates the width of a tab character. The

相关标签:
7条回答
  • 2020-12-07 08:02

    Are you changing your white space settings so often you really need a function to manage that? If you are messing with tabstop a lot and also setting expandtab, you are probably going to have a mess over time as you change files with different values passed to stab. Today I use :call stab (4), tomorrow it's :call stab (2) and last week it was :call stab (8). Sounds like even if you write it, you'll soon stop using it.

    If you plan to always pass the same value to stab, why not just edit your global settings? In vim:

    :e $MYVIMRC
    

    and add the following:

    set tabstop=4
    set shiftwidth=4  "tabs are 4 spaces wide (default = 8)
    set expandtab     "Convert tabs to spaces
    

    This is how my .vimrc is setup.

    0 讨论(0)
提交回复
热议问题