submizeVim
submizeVim is a tiny Python helper for running Vim Ex commands against a file in
the current working directory.
Install
pip install submizeVim
Vim must be installed and available on PATH.
Usage
import submizeVim
submizeVim.vim_do("hello.txt", "%s/old/new/g")
The first argument is the file name relative to the current folder. The second argument is a string containing one or more Vim commands. Multiple commands can be separated by newlines:
submizeVim.vim_do(
"hello.txt",
"""
%s/foo/bar/g
normal! gg
"""
)
By default, vim_do writes the file after the commands finish. It returns a
VimResult object with returncode, stdout, stderr, file, and cwd.
It also prints short terminal hints by default. If Vim is missing, Vim fails, or
Vim runs longer than the default 30-second timeout, it raises a clear exception
instead of waiting forever.
submizeVim.vim_do("hello.txt", "%s/old/new/g", timeout=10)
submizeVim.vim_do("hello.txt", "%s/old/new/g", verbose=False)
CLI
submizevim hello.txt "%s/old/new/g"
Notes
This library does not execute commands through a shell. It writes the Vim commands to a temporary Vim script and runs Vim in Ex mode.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file submizevim-0.1.1.tar.gz.
File metadata
- Download URL: submizevim-0.1.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77c368c2cd0e1ffe4b5d82a051e83eabce1f9953569a01064b0f63b8fa1740e5
|
|
| MD5 |
bfa82f45dff847c03489fab192c6761a
|
|
| BLAKE2b-256 |
0dc98b916442b0a584ccc7232c5930aef4cb681e5f5b941d4062665932958592
|
File details
Details for the file submizevim-0.1.1-py3-none-any.whl.
File metadata
- Download URL: submizevim-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e24889d19890eb1a691befd257557aec3eb0170dcd62315378a23435642bce3c
|
|
| MD5 |
634738e5c9a1ad247e07305d04e3e52c
|
|
| BLAKE2b-256 |
58059ed9103d3db23db3cf210da3c9c4da9e620178be2c7f691f42a3584802ce
|