3 ms·
Vim python-mode: https://github.com/python-mode/python-mode/blob/e01c27e8c17b3af2b9df7f6fc5a8a44afc3ad020/doc/pymode.txt#L556 https://github.com/python-mode/pyt
by westurner 2y ago
Vim python-mode: https://github.com/python-mode/python-mode/blob/e01c27e8c17b3af2b9df7f6fc5a8a44afc3ad020/doc/pymode.txt#L556 https://github.com/python-mode/python-mode/blob/e01c27e8c17b... :
> Pymode can rename everything: classes, functions, modules, packages, methods,
variables and keyword arguments.
> Keymap for rename method/function/class/variables under cursor
let g:pymode_rope_rename_bind = '<C-c>rr
python-rope/ropevim also has mappings for refactorings like renaming a variable: https://github.com/python-rope/ropevim#keybinding https://github.com/python-rope/ropevim#keybinding :
C-c r r :RopeRename
C-c f find occurrences
https://github.com/python-rope/ropevim#finding-occurrences https://github.com/python-rope/ropevim#finding-occurrences
Their README now recommends pylsp-rope:
> If you are using ropevim, consider using pylsp-rope in Vim
python-rope/pylsp-rope:
https://github.com/python-rope/pylsp-rope https://github.com/python-rope/pylsp-rope :
> Finding Occurrences: The find occurrences command (C-c f by default) can be used to find the occurrences of a python name. If unsure option is yes, it will also show unsure occurrences; unsure occurrences are indicated with a ? mark in the end. Note that ropevim uses the quickfix feature of vim for marking occurrence locations. [...]
> Rename: When Rename is triggered, rename the symbol under the cursor. If the symbol under the cursor points to a module/package, it will move that module/package files
SpaceVim > Available Layers > lang#python > LSP key Bindings: https://spacevim.org/layers/lang/python/#lsp-key-bindings https://spacevim.org/layers/lang/python/#lsp-key-bindings :
SPC l e rename symbol
Vscode Python variable renaming:
Vscode tips and tricks > Multi cursor selection: https://code.visualstudio.com/docs/getstarted/tips-and-tricks#_multi-cursor-selection https://code.visualstudio.com/docs/getstarted/tips-and-trick... :
> You can add additional cursors to all occurrences of the current selection with Ctrl+Shift+L. [And then rename the occurrences in the local file]
https://code.visualstudio.com/docs/editor/refactoring#_rename-symbol https://code.visualstudio.com/docs/editor/refactoring#_renam... :
> Rename symbol: Renaming is a common operation related to refactoring source code, and VS Code has a separate Rename Symbol command (F2). Some languages support renaming a symbol across files. Press F2, type the new desired name, and press Enter. All instances of the symbol across all files will be renamed
- morningsam 2y agoBut does Rope understand pytest fixtures? I doubt it, but would be happy to be proven wrong.
- westurner 2y agoYeah, there `sed` and `git diff` with one or more filenames in a variable might do. Because pytest requires a preprocessing step, renaming fixtures is tough, and also for jupyter notebooks %%ipytest is necessary to call functions that start with test_ and upgrade assert keywords to expressions; e.g `assert a == b, error_expr` is preprocessed into `assertEqual(a,b, error_expr)` with an AssertionError message even for comparisons of large lists and strings.