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

How to ignore comment lines? #6

Closed lodagro closed 10 years ago

lodagro commented 11 years ago

Is there a way to ignore comment lines when computing shiftwidth? Putting the code below in a file (in an otherwise empty directory) results in a shiftwidth=2. Note that the indent in the docstring is 2, and 4 in the actual code. If you wonder why i use only an indent of two in the docstring, this was in a case where the docstring was ment as input for docopt. Below is just a short and simpified example.

"""
A docstring.

Some items:
  * item1
  * item2

"""

def myfunc1(a, b):
    return a + b

def myfunc2(a, b):
    return a - b
lodagro commented 10 years ago

Thanks

:+1: