tpope / vim-sleuth

sleuth.vim: Heuristically set buffer options
https://www.vim.org/scripts/script.php?script_id=4375
1.92k stars 86 forks source link

Use shiftwidth 0 instead of copying tabstop #20

Closed axiom closed 9 years ago

axiom commented 9 years ago

Instead of copying the current tabstop value to shiftwidth when hard tabs are used consistently, set shiftwidth to 0. This makes it possible to change the tabstop value manually (e.g. for a file that is highly indented) and shiftwidth will follow automatically.

tpope commented 9 years ago

That's a super recent addition to Vim, no?

axiom commented 9 years ago

Relatively recent, yes. It was added in version v7-3-703, which should have been around October 2012 (unless I made some goof in my mercurial digging).

bram 3893 Sun Oct 21 03:02:54 2012 +0200:6122:  When zero the 'ts' value will be used.  Use the |shiftwidth()|
bram 3893 Sun Oct 21 03:02:54 2012 +0200:6123:  function to get the effective shiftwidth value.
tpope commented 9 years ago

That's older than I thought, but I'd still rather have an exists('*shiftwidth') so that we don't break older versions.

axiom commented 9 years ago

I've added a function exist check now.

tpope commented 9 years ago

Looks good.