jump to the next python class or function in vim -


i'm trying jump next python class or function in vim following commands:

autocmd filetype python nnoremap <buffer> [[ ?^class|^\s*def<cr> autocmd filetype python nnoremap <buffer> ]] /^class|^\s*def<cr> 

but doesn't work. vim prompted:

error detected while processing filetype auto commands "python": e492: not editor command: ^\s*def<cr> 

how fix this?

after lots of trying, found following code worked. need add \\ before |

autocmd filetype python nnoremap <buffer> [[ ?^class\\|^\s*def<cr> autocmd filetype python nnoremap <buffer> ]] /^class\\|^\s*def<cr> 

as alternative way, found putting 2 lines in ~/.vim/ftplugin/python.vim more convenient

nnoremap [[ ?^class\|^\s*def<cr> nnoremap ]] /^class\|^\s*def<cr> 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -