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
Post a Comment