{"id":8569,"library":"pyvim","title":"Pyvim","description":"Pyvim is a pure Python implementation of the Vim text editor, built upon the `prompt_toolkit` library. It offers essential Vim-like features such as syntax highlighting (via Pygments), horizontal and vertical splits, tab pages, and Vi key bindings. The project, currently at version 3.0.3, serves as a demonstration of `prompt_toolkit`'s capabilities and includes integrations for Python code completion (Jedi) and linting (Pyflakes). Its release cadence is irregular, with the last update in May 2022.","status":"active","version":"3.0.3","language":"en","source_language":"en","source_url":"https://github.com/jonathanslenders/pyvim","tags":["text editor","vim","cli","terminal","prompt_toolkit"],"install":[{"cmd":"pip install pyvim","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core terminal UI framework.","package":"prompt_toolkit"},{"reason":"Provides syntax highlighting functionality.","package":"Pygments"},{"reason":"Powers Python autocompletion (optional, for Python development).","package":"Jedi","optional":true},{"reason":"Enables Python code checking (optional, for Python development).","package":"Pyflakes","optional":true}],"imports":[{"note":"Pyvim is primarily a command-line application, not designed for direct library import of its editor functionality. Components are usually accessed via `prompt_toolkit`.","wrong":"from pyvim import Editor","symbol":"pyvim (executable)","correct":"Run 'pyvim' directly from the terminal or via subprocess"},{"note":"Common `ModuleNotFoundError` due to confusion with the unrelated `pyVim` module which is part of the `pyvmomi` (VMware vSphere SDK) library and uses a capital 'V'. 'pyvim' (lowercase 'v') is a distinct project.","wrong":"from pyVim import connect","symbol":"pyVim (case-sensitive)","correct":"pip install pyvim (for this library), pip install pyvmomi (for VMware SDK)"}],"quickstart":{"code":"import subprocess\nimport os\n\n# Create a dummy file for editing\nfile_content = \"Hello, pyvim!\\nThis is a test file.\\n\"\nwith open(\"example.txt\", \"w\") as f:\n    f.write(file_content)\n\nprint(\"Launching pyvim to edit example.txt. Press ESC, then :wq to save and exit.\")\n\ntry:\n    # Launch pyvim as a subprocess\n    # The input/output will be connected to the current terminal\n    subprocess.run([\"pyvim\", \"example.txt\"])\nexcept FileNotFoundError:\n    print(\"Error: 'pyvim' executable not found. Make sure it's installed and in your PATH.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n\n# Optionally, print the content after editing\nif os.path.exists(\"example.txt\"):\n    with open(\"example.txt\", \"r\") as f:\n        print(\"\\nContent of example.txt after editing:\")\n        print(f.read())\n","lang":"python","description":"This quickstart demonstrates how to programmatically launch the `pyvim` editor using Python's `subprocess` module. It creates a temporary file, opens it in `pyvim`, and then displays the file's content after the editor is closed. Users interact with `pyvim` directly in their terminal."},"warnings":[{"fix":"For very large files, consider disabling syntax highlighting or using native Vim/other editors optimized for large file performance.","message":"Performance can significantly degrade when editing large files (thousands of lines) with syntax highlighting enabled due to Python's string handling and Pygments processing.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware of potential memory and performance limitations when working with exceptionally large documents.","message":"Pyvim's buffer implementation uses simple Python strings, which can be inefficient for extremely large files and may not scale as well as optimized text editor data structures.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Test `pyvim` with your target Python 3 version to ensure full compatibility. The project's underlying `prompt_toolkit` generally supports modern Python versions.","message":"The documentation on GitHub states compatibility up to Python 3.4. While PyPI's `requires_python` is empty (implying broader Python 3 support), explicit modern Python 3 compatibility (e.g., 3.9+) is not clearly documented by the project author.","severity":"gotcha","affected_versions":"Unclear for Python >3.4"},{"fix":"This is a known limitation of the `prompt_toolkit` library that `pyvim` is built upon and may not have a direct workaround within `pyvim` itself. Be mindful of this behavior when using split views.","message":"Lack of individual cursor support across split windows can lead to unexpected behavior where the cursor in one window affects other splits, including unintended scrolling.","severity":"breaking","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure you are using `pip install pyvim` (lowercase) and importing `pyvim` if you are trying to access its internal components (though it's primarily a command-line tool). If you intended to use the VMware SDK, install `pyvmomi` with `pip install pyvmomi`.","cause":"Attempting to import 'pyVim' (with a capital 'V') instead of 'pyvim' (lowercase 'v'). The 'pyVim' module is part of the `pyvmomi` library (VMware vSphere SDK), which is a completely different project.","error":"ModuleNotFoundError: No module named 'pyVim'"},{"fix":"Verify that `pyvim` is installed correctly (`pip show pyvim`). Ensure your Python environment's script directory is included in your system's PATH. On Linux/macOS, this is often `~/.local/bin` or a virtual environment's `bin` directory.","cause":"The `pyvim` executable is not in your system's PATH, or the installation was incomplete.","error":"pyvim: command not found"}]}