diff --git a/ftplugin/python.vim b/ftplugin/python.vim index 88b24d2..29881ef 100644 --- a/ftplugin/python.vim +++ b/ftplugin/python.vim @@ -32,11 +32,11 @@ function! ChangePythonLineLength() abort let &l:colorcolumn = l:line_length + 1 endfunction -call ChangePythonLineLength() +" call ChangePythonLineLength() let b:ale_linters = ['flake8'] let b:ale_fixers = [ -\ 'remove_trailing_lines', +\ 'black', \ 'autopep8', \ 'yapf', \] @@ -63,3 +63,21 @@ if !empty(s:virtualenv) \ . ' ' . ale#Escape(ale#path#Dirname(s:virtualenv) . '/manage.py') . ' test' endif endif + +if !exists("g:python_debugger") + let g:python_debugger = 'ipdb' +endif +let g:python_debug_line = 'import ' . g:python_debugger . '; ' . g:python_debugger . '.set_trace()' + +function! InsertBreakpoint() abort + let l:curr_indent = indent(line(".")) + let l:line = '' + while l:curr_indent > 0 + let l:line .= ' ' + let l:curr_indent -= 1 + endwhile + let l:line = l:line . g:python_debug_line + :put =l:line +endfunction + +nnoremap d :call InsertBreakpoint()