{"id":26022335,"url":"https://github.com/python-rope/ropevim","last_synced_at":"2025-03-06T09:55:01.301Z","repository":{"id":45776120,"uuid":"14847006","full_name":"python-rope/ropevim","owner":"python-rope","description":"vim mode that uses rope library to provide features like python refactorings and code-assists","archived":false,"fork":false,"pushed_at":"2022-12-14T11:50:28.000Z","size":214,"stargazers_count":250,"open_issues_count":6,"forks_count":34,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-09T16:21:52.164Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-rope.png","metadata":{"files":{"readme":"README.rst","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-01T21:56:11.000Z","updated_at":"2025-02-01T21:33:13.000Z","dependencies_parsed_at":"2023-01-28T23:01:02.172Z","dependency_job_id":null,"html_url":"https://github.com/python-rope/ropevim","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropevim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropevim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropevim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-rope%2Fropevim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-rope","download_url":"https://codeload.github.com/python-rope/ropevim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242187661,"owners_count":20086218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-06T09:54:59.328Z","updated_at":"2025-03-06T09:55:01.252Z","avatar_url":"https://github.com/python-rope.png","language":"Python","readme":"======================\n ropevim, rope in vim\n======================\n\n.. csv-table::\n\n   \"❗If you are using ropevim, consider using `pylsp-rope`_ in Vim. Also see, `setup guide for pylsp-rope in Vim`_.\"\n\n.. _pylsp-rope: https://github.com/python-rope/pylsp-rope\n.. _setup guide for pylsp-rope in Vim: https://github.com/python-rope/rope/wiki/Rope-in-Vim-or-Neovim\n\nOverview\n========\n\nRopevim is a vim mode that uses rope_ library to provide features like\npython refactorings and code-assists.  You should install rope_\nlibrary before using ropevim.\n\n.. _rope: https://github.com/python-rope/rope\n\n\nNew Features\n============\n\n* works only with python3 ATM (python2 is not supported anymore)\n* improved support of multibyte sources\n* implemented `extended complete` feature (disabled by default)\n* ropemode is not part of the distribution now\n\n\nInstallation\n============\n\nUsing Minpac\n------------\n\n.. code:: vim\n\n    filetype plugin on\n    call minpac#add('python-rope/ropevim')\n\n.. code:: bash\n\n    $ pip install ropevim\n\nIf you're using **Neovim**, you will also need to \n`install neovim python providers`_ using ``pip install pynvim``.\n\nUsing Packer\n--------------\n\n.. code:: lua\n\n    use({\n      'python-rope/ropevim',\n      ft = \"python\"\n    })\n\n.. code:: bash\n\n    $ pip install ropevim\n\nIf you're using **Neovim**, you will also need to \n`install neovim python providers`_ using ``pip install pynvim``.\n\nUsing Vim-Plug\n--------------\n\n.. code:: vim\n\n    filetype plugin on\n    Plug 'python-rope/ropevim'\n    \n.. code:: bash\n\n    $ pip install ropevim\n\nIf you're using **Neovim**, you will also need to \n`install neovim python providers`_ using ``pip install pynvim``.\n\nUsing Vundle\n------------\n\n.. code:: vim\n\n    filetype plugin on\n    Plugin 'python-rope/ropevim'\n\n.. code:: bash\n\n    $ pip install ropevim\n\nIf you're using **Neovim**, you will also need to \n`install neovim python providers`_ using ``pip install pynvim``.\n\nBasic Installation\n------------------\n\nA simple way to download and install, which does just uses native \npackaging system (requires Vim 8):\n\n.. code:: bash \n\n    $ mkdir -p ~/.vim/pack/plugins/start/\n    $ git clone https://github.com/python-rope/ropevim.git ~/.vim/pack/plugins/start/ropevim\n    $ pip install ropevim\n\nOr on older Vim:\n\n.. code:: bash\n\n    $ sudo pip3 install ropevim \n    $ wget -P ~/.vim/ https://raw.githubusercontent.com/python-rope/ropevim/master/ftplugin/python_ropevim.vim \n    $ echo \"source ~/.vim/python_ropevim.vim\" \u003e\u003e ~/.vimrc\n    $ pip install ropevim\n\n(rope, ropemode and ropevim are pure python libraries which do \nnot need to talk to vim directly, they are installed by pip into \nthe usual Python path.   Only python_ropevim.vim needs to be seen \nby vim, and it handles loading the pure python modules.)\n\nIf you're using **Neovim**, you will also need to \n`install neovim python providers`_ using ``pip install pynvim``.\n\nInstallation with pathogen\n--------------------------\n\nIf using pathogen.vim, and then simply copy and paste:\n\n.. code:: bash\n\n    $ cd ~/.vim/bundle\n    $ git clone https://github.com/python-rope/ropevim.git\n    $ pip install ropevim\n\n(or even add this repo as a submodule to ``~/.vim/bundle`` git repo if\nyou have setup ``~/.vim/bundle`` in this way and you should)\n\nOnce help tags have been generated, you can view the manual with ``:help\nropevim.``\n\nIf you're using **Neovim**, you will also need to \n`install neovim python providers`_ using ``pip install pynvim``.\n\nInstallation of repo version\n----------------------------\n\nFor using the repository version of rope, see ``docs/ropevim.rst`` (or\nvim command ``:help ropevim``)\n\n.. _install neovim python providers: https://neovim.io/doc/user/provider.html\n\nGetting Started\n===============\n\nRefactoring Dialog\n------------------\n\nRopevim refactorings use a special kind of dialog.  Depending on the\nrefactoring, you'll be asked about the essential information a\nrefactoring needs to know (like the new name in rename refactoring).\n\nNext you'll see the base prompt of a refactoring dialog that shows\nsomething like \"Choose what to do\".  By entering the name of a\nrefactoring option you can set its value.  After setting each option\nyou'll be returned back to the base prompt.  Finally, you can ask rope\nto perform, preview or cancel the refactoring.\n\nSee keybinding_ section and try the refactorings yourself.\n\n\nFinding Files\n-------------\n\nBy using ``RopeFindFile`` (``C-x p f`` by default), you can search for\nfiles in your project.  When you complete the minibuffer you'll see\nall files in the project; files are shown as their reversed paths.\nFor instance ``projectroot/docs/todo.txt`` is shown like\n``todo.txt\u003cdocs``.  This way you can find files faster in your\nproject.  ``RopeFindFileOtherWindow`` (``C-x p 4 f``) opens the\nfile in the other window.\n\n\nCode-Assist\n-----------\n\n``RopeCodeAssist`` command (``M-/``) will let you select from a list\nof completions.  ``RopeLuckyAssist`` command (``M-?``) does not ask\nanything; instead, it inserts the first proposal.\n\nYou can tell ropevim to use vim's complete function in insert mode;\nAdd::\n\n  let ropevim_vim_completion=1\n\nto your ``~/.vimrc`` file.\n\nNote that when this variable is set, autoimport completions no longer\nwork since they need to insert an import to the top of the module, too.\n\nBy default autocomplete feature will use plain list of proposed completion\nitems. You can enable showing extended information about completion\nproposals by setting ::\n\n  let ropevim_extended_complete=1\n\nCompletion menu list will show the proposed name itself, one letter which\nshows where this proposal came from (it can be \"L\" for locals, \"G\" for\nglobals, \"B\" for builtins, or empty string if such scope definition is not\napplicable), a short object type description (such as \"func\", \"param\",\n\"meth\" and so forth) and a first line of proposed object's docstring (if it\nhas one). For function's keyword parameters the last field shows \"*\" symbol\nif this param is required or \"= \u003cdefault value\u003e\" if it is not.\n\nNote that you'll need rope r1558:0d76aa9d0614 or later and ropemode\nr35:bd77ca42b04d or later for extended complete feature to work.\n\n\nEnabling Autoimport\n-------------------\n\nRope can propose and automatically import global names in other\nmodules.  Rope maintains a cache of global names for each project.  It\nupdates the cache only when modules are changed; if you want to cache\nall your modules at once, use ``RopeGenerateAutoimportCache``.  It\nwill cache all of the modules inside the project plus those whose\nnames are listed in ``ropevim_autoimport_modules`` list::\n\n  # add the name of modules you want to autoimport\n  let g:ropevim_autoimport_modules = [\"os\", \"shutil\"]\n\nNow if you are in a buffer that contains::\n\n  rmtree\n\nand you execute ``RopeAutoImport`` you'll end up with::\n\n  from shutil import rmtree\n  rmtree\n\nAlso ``RopeCodeAssist`` and ``RopeLuckyAssist`` propose auto-imported\nnames by using ``name : module`` style.  Selecting them will import\nthe module automatically.\n\n\nFiltering Resources\n-------------------\n\nSome refactorings, restructuring and find occurrences take an option\ncalled resources.  This option can be used to limit the resources on\nwhich a refactoring should be applied.\n\nIt uses a simple format: each line starts with either '+' or '-'.\nEach '+' means include the file (or its children if it's a folder)\nthat comes after it.  '-' has the same meaning for exclusion.  So\nusing::\n\n  +rope\n  +ropetest\n  -rope/contrib\n\nmeans include all python files inside ``rope`` and ``ropetest``\nfolders and their subfolder, but those that are in ``rope/contrib``.\nOr::\n\n  -ropetest\n  -setup.py\n\nmeans include all python files inside the project but ``setup.py`` and\nthose under ``ropetest`` folder.\n\n\nFinding Occurrences\n-------------------\n\nThe find occurrences command (``C-c f`` by default) can be used to\nfind the occurrences of a python name.  If ``unsure`` option is\n``yes``, it will also show unsure occurrences; unsure occurrences are\nindicated with a ``?`` mark in the end.  Note that ropevim uses the\nquickfix feature of vim for marking occurrence locations.\n\n\nDialog ``batchset`` Command\n---------------------------\n\nWhen you use ropevim dialogs there is a command called ``batchset``.\nIt can set many options at the same time.  After selecting this\ncommand from dialog base prompt, you are asked to enter a string.\n\n``batchset`` strings can set the value of configs in two ways.  The\nsingle line form is like this::\n\n  name1 value1\n  name2 value2\n\nThat is the name of config is followed its value.  For multi-line\nvalues you can use::\n\n  name1\n   line1\n   line2\n\n  name2\n   line3\n\nEach line of the definition should start with a space or a tab.  Note\nthat blank lines before the name of config definitions are ignored.\n\n``batchset`` command is useful when performing refactorings with long\nconfigs, like restructurings::\n\n  pattern ${pycore}.create_module(${project}.root, ${name})\n\n  goal generate.create_module(${project}, ${name})\n\n  imports\n   from rope.contrib import generate\n\n  args\n   pycore: type=rope.base.pycore.PyCore\n   project: type=rope.base.project.Project\n\n.. ignore the two-space indents\n\nThis is a valid ``batchset`` string for restructurings.\n\nJust for the sake of completeness, the reverse of the above\nrestructuring can be::\n\n  pattern ${create_module}(${project}, ${name})\n\n  goal ${project}.pycore.create_module(${project}.root, ${name})\n\n  args\n   create_module: name=rope.contrib.generate.create_module\n   project: type=rope.base.project.Project\n\n\nVariables\n=========\n\n* ``ropevim_codeassist_maxfixes``: The maximum number of syntax errors\n  to fix for code assists.  The default value is ``1``.\n* ``ropevim_local_prefix``: The prefix for ropevim refactorings.\n  Defaults to ``C-c r``.\n* ``ropevim_global_prefix``: The prefix for ropevim project commands\n  Defaults to ``C-x p``.\n* ``ropevim_enable_shortcuts``: Shows whether to bind ropevim\n  shortcuts keys.  Defaults to ``1``.\n* ``ropevim_guess_project``: If non-zero, ropevim tries to guess and\n  open the project that contains the file on which a ropevim command\n  is performed when no project is already open.\n\n* ``ropevim_enable_autoimport``: Shows whether to enable autoimport.\n* ``ropevim_autoimport_modules``: The name of modules whose global\n  names should be cached.  `RopeGenerateAutoimportCache` reads this\n  list and fills its cache.\n* ``ropevim_autoimport_underlineds``: If set, autoimport will cache\n  names starting with underlines, too.\n\n* ``ropevim_goto_def_newwin``: If set, ropevim will open a new buffer\n  for \"go to definition\" result if the definition found is located\n  in another file. By default the file is open in the same buffer.\n\n* ``g:ropevim_open_files_in_tabs``: If non-zero, ropevim will open files\n  in tabs. This is disabled by default, and it is now *deprecated* in\n  favor of ``g:ropevim_goto_def_newwin`` set to ``\"tabnew\"``.\n\nKeybinding\n==========\n\nUses almost the same keybinding as ropemacs.  Note that global\ncommands have a ``C-x p`` prefix and local commands have a ``C-c r``\nprefix.  You can change that (see variables_ section).\n\n+-----------------+-------------------------------------------------------+\n|Key              | Command                                               |\n+=================+=======================================================+\n|C-x p o          | RopeOpenProject                                       |\n+-----------------+-------------------------------------------------------+\n|C-x p k          | RopeCloseProject                                      |\n+-----------------+-------------------------------------------------------+\n|C-x p f          | RopeFindFile                                          |\n+-----------------+-------------------------------------------------------+\n|C-x p 4 f        | RopeFindFileOtherWindow                               |\n+-----------------+-------------------------------------------------------+\n|C-x p u          | RopeUndo                                              |\n+-----------------+-------------------------------------------------------+\n|C-x p r          | RopeRedo                                              |\n+-----------------+-------------------------------------------------------+\n|C-x p c          | RopeProjectConfig                                     |\n+-----------------+-------------------------------------------------------+\n|C-x p n [mpfd]   | RopeCreate(Module|Package|File|Directory)             |\n+-----------------+-------------------------------------------------------+\n|                 | RopeWriteProject                                      |\n+-----------------+-------------------------------------------------------+\n|                 |                                                       |\n+-----------------+-------------------------------------------------------+\n|C-c r r          | RopeRename                                            |\n+-----------------+-------------------------------------------------------+\n|C-c r l          | RopeExtractVariable                                   |\n+-----------------+-------------------------------------------------------+\n|C-c r m          | RopeExtractMethod                                     |\n+-----------------+-------------------------------------------------------+\n|C-c r i          | RopeInline                                            |\n+-----------------+-------------------------------------------------------+\n|C-c r v          | RopeMove                                              |\n+-----------------+-------------------------------------------------------+\n|C-c r x          | RopeRestructure                                       |\n+-----------------+-------------------------------------------------------+\n|C-c r u          | RopeUseFunction                                       |\n+-----------------+-------------------------------------------------------+\n|C-c r f          | RopeIntroduceFactory                                  |\n+-----------------+-------------------------------------------------------+\n|C-c r s          | RopeChangeSignature                                   |\n+-----------------+-------------------------------------------------------+\n|C-c r 1 r        | RopeRenameCurrentModule                               |\n+-----------------+-------------------------------------------------------+\n|C-c r 1 v        | RopeMoveCurrentModule                                 |\n+-----------------+-------------------------------------------------------+\n|C-c r 1 p        | RopeModuleToPackage                                   |\n+-----------------+-------------------------------------------------------+\n|                 |                                                       |\n+-----------------+-------------------------------------------------------+\n|C-c r o          | RopeOrganizeImports                                   |\n+-----------------+-------------------------------------------------------+\n|C-c r n [vfcmp]  | RopeGenerate(Variable|Function|Class|Module|Package)  |\n+-----------------+-------------------------------------------------------+\n|                 |                                                       |\n+-----------------+-------------------------------------------------------+\n|C-c r a /        | RopeCodeAssist                                        |\n+-----------------+-------------------------------------------------------+\n|C-c r a g        | RopeGotoDefinition                                    |\n+-----------------+-------------------------------------------------------+\n|C-c r a d        | RopeShowDoc                                           |\n+-----------------+-------------------------------------------------------+\n|C-c r a f        | RopeFindOccurrences                                   |\n+-----------------+-------------------------------------------------------+\n|C-c r a ?        | RopeLuckyAssist                                       |\n+-----------------+-------------------------------------------------------+\n|C-c r a j        | RopeJumpToGlobal                                      |\n+-----------------+-------------------------------------------------------+\n|C-c r a c        | RopeShowCalltip                                       |\n+-----------------+-------------------------------------------------------+\n|                 | RopeAnalyzeModule                                     |\n+-----------------+-------------------------------------------------------+\n|                 | RopeAutoImport                                        |\n+-----------------+-------------------------------------------------------+\n|                 | RopeGenerateAutoimportCache                           |\n+-----------------+-------------------------------------------------------+\n\n                                                                         \nShortcuts                                                                \n---------                                                                \n                                                                         \nSome commands are used very frequently; specially the commands in        \ncode-assist group.  You can define your own shortcuts like this::        \n                                                                         \n  :noremap \u003cC-c\u003eg :call RopeGotoDefinition()                                \n                                                                         \nRopevim itself comes with a few shortcuts.  These shortcuts will be      \nused only when ``ropevim_enable_shortcuts`` is set.                      \n\n================  ============================\nKey               Command\n================  ============================\nM-/               RopeCodeAssist\nM-?               RopeLuckyAssist\nC-c g             RopeGotoDefinition\nC-c d             RopeShowDoc\nC-c f             RopeFindOccurrences\n================  ============================\n\n\nSupport for Omni completion\n---------------------------\n\nYou can enable using Rope as providing for Omni completion by setting\nomnifunc variable to ``RopeCompleteFunc``. E.g., by putting something\nlike this in your ``~/.vimrc``::\n\n    autocmd FileType python setlocal omnifunc=RopeCompleteFunc\n\n\nContributing\n============\n\nSend your bug reports, feature requests and patches to `ropevim Github\nIssue Tracker`_ or `rope Github Discussions`_.\n\n.. _`ropevim Github Issue Tracker`: https://github.com/python-rope/ropevim/issues\n.. _`rope Github Discussions`: https://github.com/python-rope/rope/discussions\n\n\nLicense\n=======\n\nThis program is under the terms of GPL (GNU General Public License).\nHave a look at ``COPYING`` file for more information.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-rope%2Fropevim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-rope%2Fropevim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-rope%2Fropevim/lists"}