Edit dotfiles easily
Project description
dotedit
Opens the configuration file (dotfile) for a given program.
Contents
Usage
Open configuration file for conky:
$ dotedit c<TAB> # <-- Tab-completion for bash, zsh & fish!
$ dotedit conky
# opens ~/.config/conky/conky.conf in $EDITOR
If dotedit does not know the path to the dotfile for a program, it will try to find it in $XDG_CONFIG_HOME
or $HOME
. It will always prompt before adding a path to avoid opening the wrong file:
$ dotedit bspwm
Add path to bspwm: ~/.config/bspwm/bspwmrc # <-- Tab-completion works here too!
#opens ~/.config/bspwm/bspwmrc in $EDITOR
dotedit will, of course, save the path for next time:
$ dotedit bspwm
#opens ~/.config/bspwm/bspwmrc in $EDITOR
If you mistype...
$ dotedit xinit
Add path to xinit: ~/.xinitcr # <-- Doh!
...you can update the path...
$ dotedit --update xinit
Update path to xinit: ~/.xinitcr
Update path to xinit: ~/.xinit
Update path to xinit: ~/.xinitrc
...or just remove it:
$ dotedit --remove xinit
Hooks
You can add pre and post hooks by creating the files
$XDG_CONFIG_HOME/dotedit/hooks/pre-edit
and
$XDG_CONFIG_HOME/dotedit/hooks/postedit
and making them executable.
For example to automatically commit and push changes to dotfiles in a git directory you can create post edit hook with the following content:
#!/bin/sh
cd "$HOME/git/dotfiles/" | return
git add -A . && git commit -m 'update' && git pull --rebase && git push
Install
$ pip3 install --user dotedit
Completions
To enable completions, the completion scripts need to be installed manually.
Bash
$ dotedit --completions bash > ~/.local/share/bash-completion/completions/dotedit
Zsh
$ dotedit --completions zsh > ~/.zfunc/_dotedit
fish
$ dotedit --completions fish > ~/.config/fish/completions/dotedit.fish
Finally, restart your shell session or source the completion script to enable completions.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file dotedit-1.2.0.tar.gz
.
File metadata
- Download URL: dotedit-1.2.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.3 CPython/3.6.7 Linux/4.18.16_2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c85b665a4496538d6a1c2b2cd8135643b6a4cf7491321b9ec020cd34a369ad1 |
|
MD5 | 7e2c8b2c131d7ef6ec5a47e9c428c2f4 |
|
BLAKE2b-256 | e281ed512a2c699deb1151414223db37a7fef74609a0ff4b0f461a2ec4f23051 |
File details
Details for the file dotedit-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: dotedit-1.2.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.3 CPython/3.6.7 Linux/4.18.16_2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 124cd3d4e57ceeaabc1f4d27a34c1076dc10bf7f698a7d6c638a89b33f1fdc39 |
|
MD5 | 4035ed34d3e8449883179f82a6932510 |
|
BLAKE2b-256 | 2925e24b743d1bdde17f1fec31d95f0a44271267fe302c2d80e16d755277b94f |