Skip to content

Commit fbcb752

Browse files
committed
Fix indentation in python code
1 parent 5b2586a commit fbcb752

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

plugin/debugstring.vim

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ let g:debugStringCounterStep = 1
8383
" By default debugging lines should be of the form <directive_to_print> " <prefix_string><debug_number>
8484
function! g:DebugstringPrefixStr()
8585
let l:debug_str = '[' . fnamemodify(bufname('%'), ':t') . ':'
86-
if getline('.') =~# "^$" " Empty line
86+
if getline('.') =~# '^$' " Empty line
8787
let l:debug_str .= getcurpos()[1]
8888
else
8989
let l:debug_str .= string(str2nr(getcurpos()[1]) + 1)
@@ -144,7 +144,7 @@ function! s:debugFunctionWrapper(mode, ...)
144144
let l:prev_pos = getcurpos()
145145

146146
let l:append_at_same_line = 0
147-
if getline('.') =~# "^$" " Empty line
147+
if getline('.') =~# '^$' " Empty line
148148
let l:append_at_same_line = 1
149149
endif
150150

@@ -156,7 +156,7 @@ function! s:debugFunctionWrapper(mode, ...)
156156

157157
AddDebugString
158158

159-
if &rtp =~ 'vim-repeat'
159+
if &runtimepath =~# 'vim-repeat'
160160
call repeat#set("\<Plug>DumpDebugString")
161161
endif
162162

@@ -165,17 +165,17 @@ function! s:debugFunctionWrapper(mode, ...)
165165
echoerr "Command AddDebugStringExpr isn't implemented for filetype \"" . &filetype . "\""
166166
return 0
167167
endif
168-
let l:expr = ""
168+
let l:expr = ''
169169
if len(a:000) ==# 0
170-
let l:expr = input("Input Expression: ")
170+
let l:expr = input('Input Expression: ')
171171
else
172172
let l:expr = a:1
173173
endif
174174

175175
AddDebugStringExpr(l:expr)
176176

177177
" Make way for repeat.vim
178-
if &rtp =~ 'vim-repeat'
178+
if &runtimepath =~# 'vim-repeat'
179179
execute 'nnoremap <silent> <Plug>DumpDebugStringSpecExpr :<C-U> :call <SID>debugFunctionWrapper(1, "' . l:expr . '")<CR>'
180180
call repeat#set("\<Plug>DumpDebugStringSpecExpr")
181181
endif
@@ -185,17 +185,19 @@ function! s:debugFunctionWrapper(mode, ...)
185185
endif
186186

187187
" correct indentation level
188-
normal ==
188+
if indent(getcurpos()[1] - 1) !=# 0
189+
normal! k0vwhyjP
190+
endif
191+
normal! ==
189192

190193
call s:incrDebugCounter() " increase the counter
191194

192195
let l:new_pos = l:prev_pos
193196
if l:append_at_same_line
194197
" move them to previous line
195198
normal! kJ
196-
let l:new_pos[1] += 1
197199
else
198-
let l:new_pos[1] += 2 " go directly to the next line
200+
let l:new_pos[1] += 1 " go directly to the next line
199201
endif
200202
call setpos('.', l:new_pos)
201203
endfunc

0 commit comments

Comments
 (0)