Easy breakpoints and other stuff for python.

This commit is contained in:
sfigato 2019-05-13 16:05:54 +02:00
parent 254203a3df
commit 170060d491
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -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 <leader>d :call InsertBreakpoint()<CR>