mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-08 12:34:16 +00:00
doc fix links
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
One way for creating symlinks (or any other special files) is to use a combination of
|
||||
[actions](usage-actions) and a *fake* dotfile.
|
||||
[actions](../config/usage-actions.md) and a *fake* dotfile.
|
||||
|
||||
Let's say for example you have a list of directories you want to link
|
||||
from under `~/.original` to `~/symlinks`.
|
||||
```bash
|
||||
$ tree ~/.original
|
||||
$ tree ~/.original
|
||||
/home/user/.original
|
||||
├── dir1
|
||||
├── dir2
|
||||
@@ -28,7 +28,7 @@ The config file would contain different elements
|
||||
dynvariables:
|
||||
links_list: "cat {{@@ _dotdrop_dotpath @@}}/links.txt | xargs"
|
||||
...
|
||||
variables:
|
||||
variables:
|
||||
links_dst: "{{@@ env['HOME'] @@}}/.symlinks"
|
||||
links_src: "{{@@ env['HOME'] @@}}/.original"
|
||||
...
|
||||
@@ -44,11 +44,11 @@ actions:
|
||||
|
||||
The result would be
|
||||
```bash
|
||||
$ tree ~/.symlinks
|
||||
$ tree ~/.symlinks
|
||||
/home/user/.symlinks
|
||||
├── dir1 -> /home/user/.original/dir1
|
||||
├── dir2 -> /home/user/.original/dir2
|
||||
└── dir3 -> /home/user/.original/dir3
|
||||
```
|
||||
|
||||
For reference, see [issue 243](https://github.com/deadc0de6/dotdrop/issues/243)
|
||||
For reference, see [issue 243](https://github.com/deadc0de6/dotdrop/issues/243)
|
||||
|
||||
@@ -20,7 +20,7 @@ profiles:
|
||||
...
|
||||
```
|
||||
|
||||
Note that the subfiles (`vimrc.d/top` and `vimrc.d/bottom`)
|
||||
Note that the subfiles (`vimrc.d/top` and `vimrc.d/bottom`)
|
||||
are not known to the config and do not need to be.
|
||||
|
||||
Edit the stored vimrc file to include the other files, for example:
|
||||
@@ -46,12 +46,12 @@ Dotdrop will then automagically include the files into your vimrc when handling
|
||||
# Merge all files in a directory
|
||||
|
||||
To include all files in a directory, a combination of
|
||||
[dynvariables](config-variables#interpreted-variables)
|
||||
[dynvariables](../config/config-variables.md#interpreted-variables-entry)
|
||||
and [jinja2 directives](http://jinja.pocoo.org/docs/2.10/) have to be used.
|
||||
|
||||
Let's say all files in `<dotpath>/toinclude` need to be included into a dotfile.
|
||||
|
||||
First define a [dynvariables](config-variables#interpreted-variables)
|
||||
First define a [dynvariables](../config/config-variables.md#interpreted-variables-entry)
|
||||
in the config file which will look for files to include in the above directory:
|
||||
```yaml
|
||||
dynvariables:
|
||||
@@ -59,7 +59,7 @@ dynvariables:
|
||||
```
|
||||
|
||||
Note that `_dotdrop_dotpath` is part of the built-in variables
|
||||
(for more see [template variables](templating#template-variables)).
|
||||
(for more see [template variables](../template/templating.md#template-variables)).
|
||||
|
||||
And then use the generated list in the dotfile template:
|
||||
```
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# Available solutions
|
||||
|
||||
Two solutions exist, the first one using an unversioned file (see [Environment variables](templating#environment-variables))
|
||||
Two solutions exist, the first one using an unversioned file (see [Environment variables](../template/templating.md#environment-variables))
|
||||
and the second using transformations (see [Store encrypted dotfiles](#store-encrypted-dotfiles)).
|
||||
|
||||
# Store encrypted dotfiles
|
||||
@@ -68,4 +68,4 @@ variables:
|
||||
gpg_password_file: "/tmp/the-password"
|
||||
trans_read:
|
||||
_gpg: "gpg2 --batch --yes --passphrase-file <(cat {{@@ gpg_password_file @@}}) -q --for-your-eyes-only --no-tty -d {0} > {1}"
|
||||
```
|
||||
```
|
||||
|
||||
@@ -5,14 +5,14 @@ nice to share as much code as possible across the dotfiles, by leveraging
|
||||
templating and merging them in the same dotfile in Dotdrop's `dotpath`. Here
|
||||
are a few suggestions about how to achieve this.
|
||||
|
||||
* [Brute force templating](brute-force-templating)
|
||||
* [Profile variables](profile-variables)
|
||||
* [Jinja macros](jinja-macros)
|
||||
* [Brute force templating](#brute-force-templating)
|
||||
* [Profile variables](#profile-variables)
|
||||
* [Jinja macros](#jinja-macros)
|
||||
|
||||
# Brute force templating
|
||||
|
||||
The first approach is sheer use of templating and Dotdrop
|
||||
[template variables](#template-variables). In order to do this, we need to:
|
||||
The first approach is sheer use of templating and variables
|
||||
In order to do this, we need to:
|
||||
|
||||
1. Create the merged dotfile with an arbitrary name somewhere in `dotpath`.
|
||||
2. Create two `dotfile` entries in `config.yaml`, both having the merged
|
||||
@@ -64,7 +64,7 @@ export DB_PORT='4521'
|
||||
Albeit flexible, the previous method is a bit cumbersome for some use cases.
|
||||
For example, when the dotfiles belong to different profiles, the cleanest
|
||||
solution consists in using
|
||||
[profile variables](config-variables#profile-variables). This is achieved by:
|
||||
[profile variables](../config/config-variables.md#profile-variables). This is achieved by:
|
||||
|
||||
1. Creating the merged dotfile with an arbitrary name somewhere in `dotpath`.
|
||||
2. Adding some variables in the merged dotfile via templating.
|
||||
|
||||
@@ -37,10 +37,10 @@ See https://github.com/deadc0de6/dotdrop/issues/42.
|
||||
|
||||
Jinja2 is not able to process non-unicode chars (http://jinja.pocoo.org/docs/2.10/api/). This means that dotfiles using non-unicode chars can still be fully managed by dotdrop however when comparing the local file with the one stored in dotdrop, `compare` will return a difference even if there is none.
|
||||
|
||||
Either replace the non-unicode chars (see below [Re-encode](re-encode)) or accept the fact the comparison shows a difference while there's none.
|
||||
Either replace the non-unicode chars (see below [Re-encode](#re-encode)) or accept the fact the comparison shows a difference while there's none.
|
||||
|
||||
See https://github.com/deadc0de6/dotdrop/issues/42.
|
||||
|
||||
# Re-encode
|
||||
|
||||
To change an existing file's encoding, you can use `recode UTF-8 <filename>` (see [recode](https://linux.die.net/man/1/recode)) or in vim `:set fileencoding=utf-8`.
|
||||
To change an existing file's encoding, you can use `recode UTF-8 <filename>` (see [recode](https://linux.die.net/man/1/recode)) or in vim `:set fileencoding=utf-8`.
|
||||
|
||||
@@ -10,7 +10,7 @@ Where `src` is considered as the file stored in your *dotpath* and
|
||||
`dst` as the file located in your `$HOME`.
|
||||
|
||||
Note that if the dotfile is using template directives, it will be symlinked into
|
||||
`~/.config/dotdrop` instead of directly into your *dotpath*
|
||||
`~/.config/dotdrop` instead of directly into your *dotpath*
|
||||
(see [Templating symlinked dotfiles](#templating-symlinked-dotfiles))
|
||||
|
||||
* [Link children](#link-children)
|
||||
@@ -22,7 +22,7 @@ Note that if the dotfile is using template directives, it will be symlinked into
|
||||
|
||||
This feature can be very useful for dotfiles when you don't want the entire
|
||||
directory to be symlink but still want to keep a clean config files (with a
|
||||
limited number of entries).
|
||||
limited number of entries).
|
||||
|
||||
*Make sure to do a backup of your dotfiles with something like `cp -r <my-important-dotfile>{,.bak}`*
|
||||
|
||||
@@ -85,11 +85,11 @@ $ tree -L 1 ~/.vim
|
||||
# Templating symlinked dotfiles
|
||||
|
||||
For dotfiles not using any templating directives, those are directly linked
|
||||
to dotdrop's `dotpath` directory (see [Config](config)).
|
||||
to dotdrop's `dotpath` directory (see [Config](../config/config.md)).
|
||||
|
||||
When using templating directives however the dotfiles are first installed into
|
||||
`workdir` (defaults to *~/.config/dotdrop*, see [Config](config))
|
||||
and then symlinked there.
|
||||
`workdir` (defaults to *~/.config/dotdrop*, see [Config](../config/config.md))
|
||||
and then symlinked there.
|
||||
This applies to both dotfiles with `link: link` and `link: link_children`.
|
||||
|
||||
For example
|
||||
|
||||
Reference in New Issue
Block a user