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.