A while ago, with the help of the answers in this Question, I managed to write two macro's to create debug prints:
autocmd Filetype python nnoremap <buffer> \p "=[printf('print("(%s)\u001b[35m %s:", %s, "\u001b[0m")', expand(line(".")), expand('<lt>cword>'), expand('<lt>cword>'))]<cr>]p
autocmd Filetype python nnoremap <buffer> \o "=[printf('print("(%s)\u001b[35m %s:", %s, "\u001b[0m")', expand(line(".")), expand('<lt>cword>'), expand('<lt>cword>'))]<cr>]P
For the past two months I've been using these extensively.
One thing that still bothered me though, was the automatic deletion of indents when starting a comment in Python.
Another Vi/VimSE post suggested disabling smartindent for Python file:
au! FileType python setl nosmartindent
This indeed did the tricks. I can now type comments without having my indentation ruined.
However... I noticed that when adding this line, my previous macro's no longer work...
When I use them, it acts as a regular p
press (paste).
Anyone know why this is? And how can I fix it?