Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.1k views
in Technique[技术] by (71.8m points)

visual studio code - (Python) cursor jumps to the end of a function

Python doesn't use {} to enclose a function, resulting that it's hard to move the cursor to the end of a function.

For example, in visual studio code (Mac), we could use command + shift + to go from { to } and } to {.

Have googled a lot but not yet found a good way, thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

VS Code is not my preferred editor and I don't use Mac, so I have no idea if it supports such a hotkey for Python on that OS. I use PyCharm on Win10, which per it's default hotkey layout has Ctrl + ] to jump to the end of a code block. It works for jumping to the end of a function so long as your whitespace is correct throughout and your cursor is on a line that starts on the outermost indent of the function's scope. If it is on an inner indented line (like in a loop or context manager) then it jumps to the end of that indented block.

Edit: Just found the mac keybindings for PyCharm. On that OS the hot key for jumping to an end of a block is ? ??] whatever the heck that is.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...