@@ -18,6 +18,11 @@ let g:pydocstring_doq_path = get(
18
18
19
19
let s: results = []
20
20
21
+ function ! s: get_indent_width () abort
22
+ " Get indentation width
23
+ return &smarttab ? &shiftwidth : &softtabstop
24
+ endfunction
25
+
21
26
function ! s: get_range () abort
22
27
" Get visual mode selection.
23
28
let mode = visualmode (1 )
@@ -147,7 +152,7 @@ function! s:create_cmd(style, omissions) abort
147
152
\ expand (g: pydocstring_doq_path ),
148
153
\ a: style ,
149
154
\ g: pydocstring_formatter ,
150
- \ & softtabstop
155
+ \ s: get_indent_width ()
151
156
\ )
152
157
else
153
158
let cmd = printf (
@@ -156,7 +161,7 @@ function! s:create_cmd(style, omissions) abort
156
161
\ a: style ,
157
162
\ g: pydocstring_formatter ,
158
163
\ a: omissions ,
159
- \ & softtabstop
164
+ \ s: get_indent_width ()
160
165
\ )
161
166
endif
162
167
if g: pydocstring_templates_path !=# ' '
@@ -169,7 +174,7 @@ endfunction
169
174
function ! pydocstring#format () abort
170
175
let lines = printf (" %s\n " , join (getbufline (bufnr (' %' ), 1 , ' $' ), " \n " ))
171
176
let cmd = s: create_cmd (' string' , ' ' )
172
- let indent = & softtabstop
177
+ let indent = s: get_indent_width ()
173
178
let end_lineno = line (' .' )
174
179
call s: execute (
175
180
\ cmd,
@@ -188,7 +193,7 @@ function! pydocstring#insert(...) abort
188
193
let line = getline (' .' )
189
194
let indent = matchstr (line , ' ^\(\s*\)' )
190
195
191
- let space = repeat (' ' , & softtabstop )
196
+ let space = repeat (' ' , s: get_indent_width () )
192
197
let indent = indent . space
193
198
if len (indent ) == 0
194
199
let indent = space
0 commit comments