mirror of https://git.decapod.one/brethil/dotfiles
Compare commits
8 Commits
904f53b0e0
...
fba95ede51
Author | SHA1 | Date |
---|---|---|
bretello | fba95ede51 | |
bretello | 2a1b2f5da4 | |
bretello | 3d260ec64d | |
bretello | d70b43dbee | |
bretello | bcad9f77aa | |
bretello | 208057ce91 | |
bretello | 94eb4cded8 | |
bretello | 2805f13208 |
|
@ -10,11 +10,19 @@ steps:
|
||||||
repo: registry.decapod.one/brethil/dotfiles
|
repo: registry.decapod.one/brethil/dotfiles
|
||||||
registry: registry.decapod.one
|
registry: registry.decapod.one
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
dry_run: true
|
|
||||||
# output: type=oci,dest=${CI_REPO_OWNER}-hello.tar
|
|
||||||
|
|
||||||
notify:
|
notify:
|
||||||
image: registry.decapod.one/toolchain:latest
|
image: registry.decapod.one/toolchain:latest
|
||||||
secrets: [bretellofier_token, bretellofier_recipients]
|
secrets: [bretellofier_token, bretellofier_recipients]
|
||||||
commands:
|
commands:
|
||||||
- echo "[drone] Succesfully built brethil/dotfiles" | bretellofier
|
- bretellofier "[woodpecker] ✅ Succesfully built ${CI_REPO}"
|
||||||
|
when:
|
||||||
|
- status: [success]
|
||||||
|
|
||||||
|
notify-on-failure:
|
||||||
|
image: registry.decapod.one/toolchain
|
||||||
|
secrets: [bretellofier_token, bretellofier_recipients]
|
||||||
|
when:
|
||||||
|
- status: [failure]
|
||||||
|
commands:
|
||||||
|
- bretellofier "[woodpecker] 💥 $CI_REPO CI failed"
|
||||||
|
|
|
@ -67,4 +67,4 @@ RUN vim -c 'PlugInstall|qa!'
|
||||||
# Install zsh plugins
|
# Install zsh plugins
|
||||||
RUN zsh -c exit
|
RUN zsh -c exit
|
||||||
|
|
||||||
CMD tmux
|
CMD ["tmux"]
|
||||||
|
|
127
README.md
127
README.md
|
@ -1,36 +1,38 @@
|
||||||
# brethil's dotfiles
|
# brethil's dotfiles
|
||||||
|
|
||||||
A set of zsh dotfiles based on antibody and oh-my-zsh
|
My own dotfiles. `zsh` configuration based on [antibody](https://github.com/getantibody/antibody) and [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh), `vim` configuration uses [vim-plug](https://github.com/junegunn/vim-plug), [ALE](https://github.com/dense-analysis/ale) and more.
|
||||||
|
|
||||||
|
[ci.decapod.one status](https://ci.decapod.one/api/badges/2/status.svg)
|
||||||
|
|
||||||
|
[zsh theme](docs/brethil-theme.png "zsh theme")
|
||||||
|
[vim theme](docs/vim.png "vim theme")
|
||||||
|
[tmux theme](docs/tmux.png "tmux theme")
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
├── README.md
|
├── README.md
|
||||||
├──────── Main files ────────
|
├──────── Main files ────────
|
||||||
│ ├── aliases.zsh
|
│ ├── aliases/
|
||||||
│ │ └── aliases definitions (sources `~/.dotfiles_aliases`)
|
│ │ └── aliases definitions. Add .zsh files here to include more
|
||||||
|
│ ├── functions/
|
||||||
|
│ │ └── functions definitions. ADD .zsh files here to include more
|
||||||
│ ├── colors.zsh
|
│ ├── colors.zsh
|
||||||
│ │ └── ANSI color escapes
|
│ │ └── ANSI color escapes
|
||||||
│ ├── functions.zsh
|
|
||||||
│ │ └── contains function definitions (sources `~/.dotfiles_functions`)
|
|
||||||
│ ├── ansible
|
│ ├── ansible
|
||||||
│ │ └── ansible playboooks/config
|
│ │ └── ansible playboooks/config
|
||||||
│ └── brethil_dotfile.sh:
|
│ ├── brethil_dotfile.sh:
|
||||||
│ └── This file should be sourced by your `.zshrc`
|
│ │ └── ansible playboooks/config
|
||||||
├──────── antibody plugins ────────
|
│ ├── antibody_plugins.txt
|
||||||
│ ├── antibody_plugins_arch.txt
|
│ │ zsh plugins sourced by antibody
|
||||||
│ └── antibody_plugins.txt
|
|
||||||
├──────── oh-my-zsh themes ────────
|
├──────── oh-my-zsh themes ────────
|
||||||
│ ├── brethil.zsh-theme
|
│ ├── themes
|
||||||
│ └── brethil-minimal.zsh-theme
|
│ │ ├─ brethil.zsh-theme
|
||||||
|
│ └ └─ brethil-minimal.zsh-theme
|
||||||
├──────── Misc rc files────────
|
├──────── Misc rc files────────
|
||||||
│ ├── gitconfig
|
│ ├── gitconfig
|
||||||
│ │ └── git configuration
|
│ │ └── git configuration
|
||||||
│ ├── ipython
|
│ ├── ipython/
|
||||||
│ │ ├── profile_default
|
│ │ ├── ipython configs
|
||||||
│ │ ├── ipython_config.py
|
|
||||||
│ │ ├── startup
|
|
||||||
│ │ ├── 11-autoreload.py
|
|
||||||
│ │ └── README
|
|
||||||
│ ├── vim
|
│ ├── vim
|
||||||
│ │ ├── vimrc
|
│ │ ├── vimrc
|
||||||
│ │ │ └── main vim rc
|
│ │ │ └── main vim rc
|
||||||
|
@ -40,86 +42,53 @@ A set of zsh dotfiles based on antibody and oh-my-zsh
|
||||||
│ │ │ └── plugins configuration
|
│ │ │ └── plugins configuration
|
||||||
│ │ ├── shortcuts.vim
|
│ │ ├── shortcuts.vim
|
||||||
│ │ │ └── vim shortcuts definitions
|
│ │ │ └── vim shortcuts definitions
|
||||||
│ │ ├── functions.vim
|
│ │ └── functions.vim
|
||||||
│ │ │ └── miscellaneous vim function
|
│ │ └── miscellaneous vim function
|
||||||
│ │ └── twilight256.vim
|
|
||||||
│ │ └── an old colorscheme
|
|
||||||
│ └── pdbrc.py
|
│ └── pdbrc.py
|
||||||
│ └── pdb++ rc (a drop-in replacement for pdb)
|
│ └── pdb++ rc (a drop-in replacement for pdb)
|
||||||
├──────── Other ─────────────
|
├──────── Other ─────────────
|
||||||
├── check_for_update.sh
|
├── extras/check_for_update.zsh
|
||||||
│ └── selfupdate script
|
│ └── selfupdate script
|
||||||
└── useful_commands
|
└── useful_commands
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
- With ansible:
|
### With ansible:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash dev/add_community.general.sh # only if community.general is not installed
|
bash dev/add_community.general.sh # only if community.general is not installed
|
||||||
ansible-playbook -v -i <hosts file> ansible/playbooks/setup.yml
|
ansible-playbook -v -i <hosts file> ansible/playbooks/setup.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
This playbook can be tested [with a docker container](dev/README.md)
|
This playbook can be tested [with a docker container](dev/README.md)
|
||||||
|
|
||||||
Use `-e fix_annoyances=true` to fix some small annoyances (only run once)
|
### Manually
|
||||||
|
|
||||||
- Manually (this only installs the zsh configuration):
|
This requires [antibody](https://github.com/getantibody/antibody) to be installed.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://git.decapod.one/brethil/dotfiles ~/.dotfiles
|
git clone https://git.decapod.one/brethil/dotfiles ~/.dotfiles
|
||||||
echo 'DOTFILES=~/.dotfiles' >> ~/.zshrc
|
echo 'DOTFILES=~/.dotfiles' >> ~/.zshrc
|
||||||
echo 'source $DOTFILES/brethil_dotfile.sh'
|
echo 'source $DOTFILES/brethil_dotfile.sh'
|
||||||
```
|
ln -s ~/.dotfiles ~/.vimrc
|
||||||
|
```
|
||||||
|
|
||||||
|
## Updating
|
||||||
|
|
||||||
A self-update mechanism is included. It asks for confirmation to pull the latest changes
|
A self-update mechanism is included. It asks for confirmation to pull the latest changes
|
||||||
from the git repo every two weeks. This also updates the git-sourced repositories installed
|
from the git repo every two weeks. This also updates the git-sourced repositories installed
|
||||||
by the install script. The self-update routine can be called manually by calling
|
by the install script. The self-update routine can be called manually by calling
|
||||||
|
|
||||||
dotfiles_selfupdate
|
```bash
|
||||||
|
dotfiles_selfupdate
|
||||||
|
```
|
||||||
|
|
||||||
If you do not want to run the installer script, you can just add source `brethil_dotfile.sh`
|
This can be disabling by setting the `DISABLE_DOTFILES_AUTO_UPDATE` env var before before sourcing `brethil_dotfile.sh`
|
||||||
in your `.zshrc`. This requires antibody installed.
|
|
||||||
|
|
||||||
### Available Functions
|
## Try it out
|
||||||
|
|
||||||
0. `cheat`: show cheat sheet for commands using cheat.sh (`cheat <commandname>`)
|
Docker images are regularly built, and they include a full development environment (hence are quite large)
|
||||||
1. Quickly edit/reload profile (`esource`/`resource`)
|
|
||||||
2. `dockertags` list all tags for a given docker image
|
|
||||||
3. `color` to print colored text (see 3. in the Misc section):
|
|
||||||
|
|
||||||
color $Red "This will be printed in red"
|
```bash
|
||||||
color $Yellow "This will be printed in red"
|
docker run -it registry.decapod.one/brethil/dotfiles
|
||||||
|
```
|
||||||
4. `git fixup` (`git-fixup`) to create a fixup command and immediately rebase it
|
|
||||||
5. Many more. Use `list_functions` to list defined functions and a small description
|
|
||||||
|
|
||||||
### Files/Folders
|
|
||||||
|
|
||||||
1. `~/bin`, `~/git`, `~/projects` folders
|
|
||||||
2. ssh config (`~/.ssh/config`):
|
|
||||||
- Create ssh keys if not defined already
|
|
||||||
- Keep connections alive by increasing timeout time
|
|
||||||
- Include multiplexer to allow quick multiple connections to the same host
|
|
||||||
- (Optional: Compression, this should allow more responsive shells with slow connections,
|
|
||||||
but will slow things down when copying large files. My suggestion is to have compression enabled
|
|
||||||
on a by-host basis in `~/.ssh/config`)
|
|
||||||
3. `brethil.zsh-theme`, `brethil-minimal.zsh-themes`, themes for oh-my-zsh.
|
|
||||||
4. `~/.dotfiles_functions`, `~/.dotfiles_aliases` are sourced by this dotfiles, allowing for custom functions/aliases
|
|
||||||
5. useful_commands contains a list of useful commands (the first rule of the tautology club...)
|
|
||||||
|
|
||||||
### Misc
|
|
||||||
|
|
||||||
1. Colored output (via `grc`) for several commands.
|
|
||||||
2. Easy names for ANSI color escapes (Black, Red, Green, Yellow, Blue, Cyan, Purple, White, CLEAR), for example:
|
|
||||||
|
|
||||||
echo -e "${Green}This text will be green${CLEAR}"
|
|
||||||
|
|
||||||
will result in green text. Use `$CLEAR` to clear previous escape sequences add B before the variable (check `colors.sh`)
|
|
||||||
name to use **bold** and U to underline (examples: `$BRed`, `$UBlack` for bold red and underlined black)
|
|
||||||
|
|
||||||
3. Autoupdate script running every two weeks, autoupdate function: `dotfiles_selfupdate` (or `git pull` from `$DOTFILES`folder)
|
|
||||||
4. Automatic fix of the`SSH_AUTH_SOCK`environment variable:`~/.ssh/rc` is installed run on every ssh login,
|
|
||||||
and updates a symlink pointing (`~/.ssh/ssh_auth_sock`). `SSH_AUTH_SOCK`points to this (set in`brethil_dotfile.sh`).
|
|
||||||
The idea is that if the user is logging in using `ssh -A`, and using tmux, it will be possible to use
|
|
||||||
the remote socket over different sessions by always using the symlink.
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ packages_debian:
|
||||||
- "python3-pip"
|
- "python3-pip"
|
||||||
- "python3-setuptools"
|
- "python3-setuptools"
|
||||||
- "virtualenv"
|
- "virtualenv"
|
||||||
- "batcat"
|
- "bat"
|
||||||
- "mtr-tiny"
|
- "mtr-tiny"
|
||||||
packages_archlinux:
|
packages_archlinux:
|
||||||
- "man"
|
- "man"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- name: Setup dotfiles
|
||||||
become: true
|
hosts: all
|
||||||
vars_files:
|
vars_files:
|
||||||
- ../ansible-packages.yml
|
- ../ansible-packages.yml
|
||||||
vars:
|
vars:
|
||||||
DOTFILES: "$HOME/.dotfiles"
|
dotfiles_path: "$HOME/.dotfiles"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Install required system packages (debian)
|
- name: Install required system packages (debian)
|
||||||
|
@ -13,18 +13,19 @@
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
pkg: "{{ packages + packages_debian }}"
|
pkg: "{{ packages + packages_debian }}"
|
||||||
when: ansible_facts['os_family'] == "Debian"
|
when: ansible_facts['os_family'] == "Debian"
|
||||||
|
become: true
|
||||||
|
|
||||||
- name: Install required system packages (arch)
|
- name: Install required system packages (arch)
|
||||||
pacman:
|
pacman:
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
name: "{{ packages + packages_archlinux }}"
|
name: "{{ packages + packages_archlinux }}"
|
||||||
when: ansible_facts['os_family'] == "Archlinux"
|
when: ansible_facts['os_family'] == "Archlinux"
|
||||||
|
become: true
|
||||||
|
|
||||||
- name: dotfiles repo
|
- name: Clone dotfiles repo
|
||||||
git:
|
git:
|
||||||
repo: https://git.decapod.one/brethil/dotfiles
|
repo: https://git.decapod.one/brethil/dotfiles
|
||||||
dest: "{{ DOTFILES }}"
|
dest: "{{ dotfiles_path }}"
|
||||||
version: master
|
|
||||||
when: local_development is not defined
|
when: local_development is not defined
|
||||||
|
|
||||||
- name: directories
|
- name: directories
|
||||||
|
@ -39,33 +40,56 @@
|
||||||
- "$HOME/projects"
|
- "$HOME/projects"
|
||||||
- "$HOME/git"
|
- "$HOME/git"
|
||||||
- "$HOME/.config/git"
|
- "$HOME/.config/git"
|
||||||
|
- "$HOME/.ssh/"
|
||||||
|
- "$HOME/.ssh/sockets"
|
||||||
|
|
||||||
- name: antibody # TODO: antibody is available on apt(debian)/brew/pacman
|
- name: Install antibody
|
||||||
shell: |
|
shell: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
curl -sfL https://git.io/antibody | sh -s - -b $HOME/bin/
|
curl -sfL https://git.io/antibody | sh -s - -b $HOME/bin/
|
||||||
$HOME/bin/antibody bundle "{{ DOTFILES }}/antibody_plugins.txt"
|
$HOME/bin/antibody bundle "{{ dotfiles_path }}/antibody_plugins.txt"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
creates: /usr/local/bin/antibody
|
creates: bin/antibody
|
||||||
|
|
||||||
- name: zsh as default shell
|
- name: Set zsh as default shell
|
||||||
user:
|
user:
|
||||||
name: "{{ ansible_user }}"
|
name: "{{ ansible_user }}"
|
||||||
shell: /usr/bin/zsh
|
shell: /usr/bin/zsh
|
||||||
|
become: true
|
||||||
|
|
||||||
- name: zsh config
|
- name: Update zshrc
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: $HOME/.zshrc
|
path: $HOME/.zshrc
|
||||||
marker: "# {mark} brethil dotfiles"
|
marker: "# {mark} brethil dotfiles"
|
||||||
block: |
|
block: |
|
||||||
export DOTFILES={{ DOTFILES }}
|
export DOTFILES={{ dotfiles_path }}
|
||||||
source $DOTFILES/brethil_dotfile.sh
|
source $DOTFILES/brethil_dotfile.sh
|
||||||
create: true
|
create: true
|
||||||
|
mode: 600
|
||||||
|
|
||||||
- name: dotfiles symlink
|
- name: Update .ssh/config
|
||||||
|
blockinfile:
|
||||||
|
path: $HOME/.ssh/config
|
||||||
|
marker: "# {mark} brethil dotfiles"
|
||||||
|
insertbefore: "BOF"
|
||||||
|
block: |
|
||||||
|
TCPKeepAlive=yes
|
||||||
|
ServerAliveCountMax=6
|
||||||
|
## Uncomment to enable compression for all ssh sessions
|
||||||
|
#Compression=yes
|
||||||
|
|
||||||
|
ControlMaster auto
|
||||||
|
ControlPath ~/.ssh/sockets/%r@%n:%p
|
||||||
|
ControlPersist yes
|
||||||
|
|
||||||
|
Host *
|
||||||
|
ServerAliveInterval 300
|
||||||
|
create: true
|
||||||
|
|
||||||
|
- name: dotfiles symlinks
|
||||||
file:
|
file:
|
||||||
src: "{{ DOTFILES }}/{{ item.key }}"
|
src: "{{ dotfiles_path }}/{{ item.key }}"
|
||||||
dest: "{{ item.value }}"
|
dest: "{{ item.value }}"
|
||||||
state: link
|
state: link
|
||||||
force: yes
|
force: yes
|
||||||
|
@ -79,19 +103,19 @@
|
||||||
"ansible/ansible.cfg": "~/.ansible.cfg"
|
"ansible/ansible.cfg": "~/.ansible.cfg"
|
||||||
"gitignore": "~/.config/git/ignore"
|
"gitignore": "~/.config/git/ignore"
|
||||||
|
|
||||||
- name: check undodir_migration
|
- name: Exec vim undodir migration (if required)
|
||||||
stat: path=${HOME}/.vim_runtime/temp_dirs/undodir
|
command: |
|
||||||
register: undodir
|
mv ${HOME}/.vim_runtime/temp_dirs/undodir ${HOME}/.vim/undo
|
||||||
|
args:
|
||||||
|
removes: .vim_runtime/temp_dirs/undodir
|
||||||
|
|
||||||
- name: vim undodir migration
|
- name: Install vim plugins
|
||||||
command: mv ${HOME}/.vim_runtime/temp_dirs/undodir ${HOME}/.vim/undo
|
command: |
|
||||||
when: undodir.stat.exists
|
env DOTFILES={{ dotfiles_path }} vim -c 'PlugInstall|qa!'
|
||||||
|
args:
|
||||||
|
creates: .vim/vim-plug
|
||||||
|
|
||||||
- name: vim plugins install
|
- name: Get git config facts
|
||||||
# Open vim once so that the plugins are installed
|
|
||||||
command: echo | env DOTFILES={{ DOTFILES }} vim
|
|
||||||
|
|
||||||
- name: git config facts
|
|
||||||
community.general.git_config:
|
community.general.git_config:
|
||||||
name: "include.path"
|
name: "include.path"
|
||||||
scope: global
|
scope: global
|
||||||
|
@ -99,10 +123,10 @@
|
||||||
- debug:
|
- debug:
|
||||||
msg: "Git config include.path={{ config_value }}"
|
msg: "Git config include.path={{ config_value }}"
|
||||||
|
|
||||||
- name: git config
|
- name: Set up git config include if required
|
||||||
community.general.git_config:
|
community.general.git_config:
|
||||||
name: "include.path"
|
name: "include.path"
|
||||||
value: "{{ DOTFILES }}/gitconfig"
|
value: "{{ dotfiles_path }}/gitconfig"
|
||||||
scope: global
|
scope: global
|
||||||
when: config_value is not defined
|
when: config_value is not defined
|
||||||
|
|
||||||
|
@ -111,17 +135,3 @@
|
||||||
src: ../../gitignore
|
src: ../../gitignore
|
||||||
dest: ~/.gitignore
|
dest: ~/.gitignore
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
backup: yes
|
|
||||||
|
|
||||||
- name: annoyances
|
|
||||||
shell: |
|
|
||||||
## Fix scrolling in byobu
|
|
||||||
if [[ $(uname) == "Darwin" ]]; then
|
|
||||||
sed -i '' 's/set -g terminal-overrides/#set -g terminal-overrides/' /usr/local/share/byobu/profiles/tmux
|
|
||||||
else
|
|
||||||
sed -i 's/set -g terminal-overrides/#set -g terminal-overrides/' /usr/share/byobu/profiles/tmux
|
|
||||||
fi
|
|
||||||
sed 's|ls \\|#ls \\|' /etc/grc.zsh
|
|
||||||
args:
|
|
||||||
executable: /bin/bash
|
|
||||||
when: fix_annoyances is true
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
After Width: | Height: | Size: 249 KiB |
|
@ -14,7 +14,7 @@ fi
|
||||||
# Cancel update if:
|
# Cancel update if:
|
||||||
# - the automatic update is disabled.
|
# - the automatic update is disabled.
|
||||||
# - git is unavailable on the system.
|
# - git is unavailable on the system.
|
||||||
if [[ "$DISABLE_DOTFILES_AUTOUPDATE" = true ]] || ! command -v git &>/dev/null; then
|
if [[ -n $DISABLE_DOTFILES_AUTOUPDATE ]] || ! command -v git &>/dev/null; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ function user_prompt(){
|
||||||
local close_bracket='%(!.].)'
|
local close_bracket='%(!.].)'
|
||||||
local at='%(!.@.)'
|
local at='%(!.@.)'
|
||||||
if [[ -n $SSH_CONNECTION ]]; then
|
if [[ -n $SSH_CONNECTION ]]; then
|
||||||
echo "${open_bracket}${user}${at}${host}${close_bracket}"
|
echo "[${user}${at}${host}]"
|
||||||
else
|
else
|
||||||
echo "${open_bracket}${user}${close_bracket}"
|
echo "${open_bracket}${user}${close_bracket}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue