Metadata-Version: 2.4
Name: vdir
Version: 0.4.0
Summary: Edit directory with vim
Project-URL: Homepage, https://github.com/pi314/vdir
Author-email: Cychih <michael66230@gmail.com>
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Utilities
Requires-Python: >=3.7
Description-Content-Type: text/markdown

VDIR - Edit directory with vim
===============================================================================

Heavily inspired by `vidir` from [moreutils](https://joeyh.name/code/moreutils/) and
[edir](https://github.com/bulletmark/edir).

With a few different design choices:

*   `vdir` always prompts before applying changes

*   `vdir` doesn't integrate with `git` (for not accidentally messing up your staging area)

*   `vdir` displays an (arguably) pretty-looking preview of the changes

*   `vdir` pads sequence number to same width for visual block operations

*   `vdir` references `LS_COLORS` for coloring

*   `vdir` supports stage/unstage items dynamically

*   `vdir` supports stage/unstage items dynamically from shell commands' output

    -   Shell commands could be piped

*   `vdir` supports sorting staged items by several attributes, each of them could be reversed

*   `vdir` treats symbolic links as files instead of resolving them

*   `vdir` supports editing symbolic links


Examples (shell)
-------------------------------------------------------------------------------
Edit the current diretory:
```console
sh$ vdir
```

Manage certain files:
```console
sh$ vdir *.txt
```

Manage found files:
```console
sh$ fd --type f | vdir
```


Examples (vim)
-------------------------------------------------------------------------------
A `vdir`'s vim session looks like this:

```console
# ═════════════════════════════════════════════════════════════════════════════
# - Add paths to stage them. Globs are recognized.
# - Add a '#' before id to untrack an item.
# - Add a '+' before id to expand non-hidden items under the directory.
# - Add a '*' before id to expand all items under the directory.
# - Add a '@' before id to resolve the soft link.
# - Stage items by shell command output: (globs are not supported here)
#   $ find . -type f | grep py
# - Sort with:
#   :sort [-][type|isdir|isfile|isfifo|islink|path|basename|name|dirname|size|atime|mtime|ctime|birthtime] ...
# - Setup default vd.vimrc with:
#   $ vdir --vimrc
# ═════════════════════════════════════════════════════════════════════════════

110 ││ LICENSE
120 ││ README.md
131 ││ __pycache__/
140 ││ pyproject.toml
151 ││ vdir/
```

Paths could be added directly for next round editing.

Shell commands could be used to add paths in batch.
Shell commands could be piped, but note that commands are ran one-by-one,
i.e. each command's stdout is collected, returncode is checked,
and then all pipe to stdin of the next command.

If one command fails (i.e. returncode != 0), the pipeline stops, and stderr is appended in comment.

The inventory could be sorted with `:sort` command.
Several attributes are available, each of them could be prefixed with `-` for reversing the order.

When you're done, save and quit, and `vdir` prompts you the changes like this:

```
[info] Delete:[LICENSE]
[info] Rename:[README.mdd]
Continue? [(Y)es / (n)o / (e)dit / (r)edo] _
```

*   `y` to apply and continue with another `vim` session
*   Empty input to apply and quit
*   `n` to cancel the edit
*   `ctrl`+`c` to cancel the edit if you're scared of the change
*   `e` to continue editing
*   `r` to restart with initial contents


Installation
-------------------------------------------------------------------------------

[![vdir](https://img.shields.io/pypi/v/vdir)](https://pypi.org/project/vdir/)


```console
sh$ pipx install vdir
```
