Refine dotfiles installer and tmux config

This commit is contained in:
2026-03-27 21:34:52 +01:00
parent 993e307bd3
commit 5f667a5da8
18 changed files with 185 additions and 782 deletions

5
.zshrc
View File

@@ -12,7 +12,7 @@ CASE_SENSITIVE="true"
ENABLE_CORRECTION="true" ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true" COMPLETION_WAITING_DOTS="true"
HIST_STAMPS="dd.mm.yyyy" HIST_STAMPS="dd.mm.yyyy"
plugins=(git symfony) plugins=(git)
source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh
export MANPATH="/usr/local/man:$MANPATH" export MANPATH="/usr/local/man:$MANPATH"
export LANG=en_GB.UTF-8 export LANG=en_GB.UTF-8
@@ -25,10 +25,7 @@ setopt auto_cd
alias l="lsd -ltr" alias l="lsd -ltr"
alias lr="lsd -ltr" alias lr="lsd -ltr"
alias ll="lsd -la" alias ll="lsd -la"
alias sc="symfony console"
setopt PROMPT_SUBST setopt PROMPT_SUBST
export PROMPT='$(cdbm -add)'$PROMPT
function c() { dir=$(cdbm 3>&1 1>&2 2>&3); cd $dir; }
function pb() { echo "$1" | nc pastebin.24unix.net 9999 } function pb() { echo "$1" | nc pastebin.24unix.net 9999 }
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

View File

@@ -1,26 +1,20 @@
Some sane defaults for git, zsh (using oh-my-zsh) and vim. Some sane defaults for git, zsh (using oh-my-zsh), vim and tmux.
Install needed packages: Install needed packages:
Linux: Linux:
```apt install git vim zsh``` ```apt install git vim zsh lsd tmux```
macOS: macOS:
```brew install git vim zsh lsd``` ```brew install git vim lsd tmux```
From your users home directory (~/), execute: From your users home directory (~/), execute:
```git clone git@git.24unix.net:tracer/dotfiles.git .config/dotfiles``` ```git clone gitea@git.24unix.net:tracer/dotfiles.git .config/dotfiles```
To install oh-my-zsh run: To install oh-my-zsh and symlink the config files run:
```sh .config/dotfiles/install.sh``` ```sh .config/dotfiles/install.sh```
To copy the config files run: This replaces the managed dotfiles in your home directory (`.zshrc`, `.zprofile`, `.vimrc`, `.gitconfig`, `.p10k.zsh`, and `~/.config/tmux`).
```sh .config/dotfiles/setup.sh```
Also included is cdbm from Mike Schilli, details can be found here:
https://www.linux-magazin.de/ausgaben/2019/09/snapshot-18/
(included is a precompiled binary for Linux AMD64, Darwin (macOS) and the source code)
![user prompt](https://24unix.net/build/images/Settings/user_screen.png) ![user prompt](https://24unix.net/build/images/Settings/user_screen.png)
[original image, 1.8M](https://24unix.net/build/images/Settings/user_screen_original.png) [original image, 1.8M](https://24unix.net/build/images/Settings/user_screen_original.png)
@@ -30,8 +24,3 @@ https://www.linux-magazin.de/ausgaben/2019/09/snapshot-18/
![vim](https://24unix.net/build/images/Settings/vi_screen.png) ![vim](https://24unix.net/build/images/Settings/vi_screen.png)
[original image, 5.9M](https://24unix.net/build/images/Settings/vi_screen_original.png) [original image, 5.9M](https://24unix.net/build/images/Settings/vi_screen_original.png)
CHANGES:
added brew instal …
removed lsd from precompiled Darwin binaries

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +0,0 @@
build instructions:
```go mod init cdbm```
```go build```

View File

@@ -1,107 +0,0 @@
package main
import (
"database/sql"
"flag"
"fmt"
"github.com/manifoldco/promptui"
_ "github.com/mattn/go-sqlite3"
"os"
"os/user"
"path"
)
func main() {
addMode := flag.Bool("add", false,
"addition mode")
flag.Parse()
db, err :=
sql.Open("sqlite3", dbPath())
panicOnErr(err)
defer db.Close()
_, err = os.Stat(dbPath())
if os.IsNotExist(err) {
create(db)
}
dir, err := os.Getwd()
panicOnErr(err)
if *addMode {
dirInsert(db, dir)
} else {
items := dirList(db)
prompt := promptui.Select{
Label: "Pick a directory",
Items: items,
}
_, result, err := prompt.Run()
panicOnErr(err)
fmt.Fprintf(os.Stderr,
"%s\n", result)
}
}
func dirList(db *sql.DB) []string {
items := []string{}
rows, err := db.Query(`SELECT dir FROM
dirs ORDER BY date DESC LIMIT 10`)
panicOnErr(err)
usr, err := user.Current()
panicOnErr(err)
for rows.Next() {
var dir string
err = rows.Scan(&dir)
panicOnErr(err)
items = append(items, dir)
}
if len(items) == 0 {
items = append(items, usr.HomeDir)
} else if len(items) > 1 {
items = items[1:] // skip first
}
return items
}
func create(db *sql.DB) {
_, err := db.Exec(`CREATE TABLE dirs
(dir text, date text)`)
panicOnErr(err)
_, err = db.Exec(`CREATE UNIQUE INDEX
idx ON dirs (dir)`)
panicOnErr(err)
}
func dirInsert(db *sql.DB, dir string) {
stmt, err := db.Prepare(`REPLACE INTO
dirs(dir, date)
VALUES(?, datetime('now'))`)
panicOnErr(err)
_, err = stmt.Exec(dir)
panicOnErr(err)
}
func dbPath() string {
var dbFile = ".cdbm.db"
usr, err := user.Current()
panicOnErr(err)
return path.Join(usr.HomeDir, dbFile)
}
func panicOnErr(err error) {
if err != nil {
panic(err)
}
}

View File

@@ -1,10 +0,0 @@
module cdbm
go 1.21.6
require (
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-sqlite3 v1.14.19 // indirect
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b // indirect
)

View File

@@ -1,10 +0,0 @@
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI=
github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b h1:MQE+LT/ABUuuvEZ+YQAMSXindAdUh7slEmAkup74op4=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@@ -1,45 +1,48 @@
#!/bin/sh #!/bin/sh
# #
# This script should be run via curl: # Installs this dotfiles repo by:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" # - cloning Oh My Zsh into $ZSH
# or wget: # - symlinking the managed config files from this repository
# sh -c "$(wget -qO- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" # - installing the tmux plugin manager and bundled tmux plugins
# - cloning the powerlevel10k theme
# #
# As an alternative, you can first download the install script and run it afterwards: # Run it from a checked out copy of this repository:
# wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh # sh .config/dotfiles/install.sh
# sh install.sh
# #
# You can tweak the install behavior by setting variables when running the script. For # You can tweak the install behavior by setting variables when running the script:
# example, to change the path to the Oh My Zsh repository: # ZSH=~/.zsh sh .config/dotfiles/install.sh
# ZSH=~/.zsh sh install.sh
# #
# Respects the following environment variables: # Respects the following environment variables:
# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh) # ZSH - path to the Oh My Zsh installation (default: $HOME/.oh-my-zsh)
# REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh) # REPO - Oh My Zsh GitHub repo name (default: robbyrussell/oh-my-zsh)
# REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS) # REMOTE - full remote URL of the Oh My Zsh git repo
# BRANCH - branch to check out immediately after install (default: master) # BRANCH - Oh My Zsh branch to check out immediately after install
# #
# Other options: # Other options:
# CHSH - 'no' means the installer will not change the default shell (default: yes) # CHSH - 'no' means the installer will not change the default shell (default: yes)
# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes) # RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
# #
# You can also pass some arguments to the install script to set some these options: # You can also pass some arguments to the install script to set some of these options:
# --skip-chsh: has the same behavior as setting CHSH to 'no' # --skip-chsh: has the same behavior as setting CHSH to 'no'
# --unattended: sets both CHSH and RUNZSH to 'no' # --unattended: sets both CHSH and RUNZSH to 'no'
# For example: # For example:
# sh install.sh --unattended # sh .config/dotfiles/install.sh --unattended
# #
set -e set -e
# Default settings # Default settings
ZSH=${ZSH:-~/.oh-my-zsh} ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-robbyrussell/oh-my-zsh} REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git} REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master} BRANCH=${BRANCH:-master}
# Other options # Other options
CHSH=${CHSH:-yes} CHSH=${CHSH:-yes}
RUNZSH=${RUNZSH:-yes} RUNZSH=${RUNZSH:-yes}
DOTFILES_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
TMUX_PLUGIN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/tmux/plugins"
TMUX_RESURRECT_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/tmux/resurrect"
P10K_REMOTE=${P10K_REMOTE:-https://github.com/romkatv/powerlevel10k.git}
command_exists() { command_exists() {
@@ -69,6 +72,78 @@ setup_color() {
fi fi
} }
apply_dotfiles() {
echo "${BLUE}Applying dotfiles...${RESET}"
if ! command_exists lsd; then
error "lsd is required but not installed. Install it first via your package manager."
exit 1
fi
if ! command_exists tmux; then
error "tmux is required but not installed. Install it first via your package manager."
exit 1
fi
link_dotfile "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc"
link_dotfile "$DOTFILES_DIR/.vimrc" "$HOME/.vimrc"
link_dotfile "$DOTFILES_DIR/.zprofile" "$HOME/.zprofile"
link_dotfile "$DOTFILES_DIR/.gitconfig" "$HOME/.gitconfig"
link_dotfile "$DOTFILES_DIR/.p10k.zsh" "$HOME/.p10k.zsh"
mkdir -p "$HOME/.config"
link_dotfile "$DOTFILES_DIR/tmux" "$HOME/.config/tmux"
install_tmux_plugins
install_powerlevel10k
echo
}
replace_dir() {
source_path=$1
target_path=$2
if [ -e "$target_path" ] || [ -L "$target_path" ]; then
rm -rf "$target_path"
fi
mv "$source_path" "$target_path"
}
link_dotfile() {
source_path=$1
target_path=$2
if [ -L "$target_path" ]; then
current_target=$(readlink "$target_path")
if [ "$current_target" = "$source_path" ]; then
echo "${GREEN}$target_path already linked.${RESET}"
return
fi
rm -f "$target_path"
elif [ -e "$target_path" ]; then
echo "${YELLOW}Removing existing $target_path${RESET}"
rm -rf "$target_path"
fi
ln -s "$source_path" "$target_path"
echo "${GREEN}Linked $target_path -> $source_path${RESET}"
}
install_tmux_plugins() {
echo "${BLUE}Installing tmux plugins...${RESET}"
rm -rf "$TMUX_PLUGIN_DIR"
mkdir -p "$TMUX_PLUGIN_DIR" "$TMUX_RESURRECT_DIR"
git clone --depth=1 https://github.com/tmux-plugins/tpm \
"$TMUX_PLUGIN_DIR/tpm"
git clone --depth=1 https://github.com/tmux-plugins/tmux-resurrect \
"$TMUX_PLUGIN_DIR/tmux-resurrect"
git clone --depth=1 https://github.com/tmux-plugins/tmux-continuum \
"$TMUX_PLUGIN_DIR/tmux-continuum"
echo
}
setup_ohmyzsh() { setup_ohmyzsh() {
# Prevent the cloned repository from having insecure permissions. Failing to do # Prevent the cloned repository from having insecure permissions. Failing to do
# so causes compinit() calls to fail with "command not found: compdef" errors # so causes compinit() calls to fail with "command not found: compdef" errors
@@ -90,50 +165,40 @@ setup_ohmyzsh() {
exit 1 exit 1
fi fi
zsh_parent=$(dirname "$ZSH")
mkdir -p "$zsh_parent"
zsh_stage=$(mktemp -d "${zsh_parent%/}/.oh-my-zsh.XXXXXX")
git clone -c core.eol=lf -c core.autocrlf=false \ git clone -c core.eol=lf -c core.autocrlf=false \
-c fsck.zeroPaddedFilemode=ignore \ -c fsck.zeroPaddedFilemode=ignore \
-c fetch.fsck.zeroPaddedFilemode=ignore \ -c fetch.fsck.zeroPaddedFilemode=ignore \
-c receive.fsck.zeroPaddedFilemode=ignore \ -c receive.fsck.zeroPaddedFilemode=ignore \
--depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || { --depth=1 --branch "$BRANCH" "$REMOTE" "$zsh_stage" || {
rm -rf "$zsh_stage"
error "git clone of oh-my-zsh repo failed" error "git clone of oh-my-zsh repo failed"
exit 1 exit 1
} }
replace_dir "$zsh_stage" "$ZSH"
echo echo
} }
setup_zshrc() { install_powerlevel10k() {
# Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones theme_dir="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
# with datestamp of installation that moved them aside, so we never actually theme_parent=$(dirname "$theme_dir")
# destroy a user's original zshrc mkdir -p "$theme_parent"
echo "${BLUE}Looking for an existing zsh config...${RESET}" theme_stage=$(mktemp -d "${theme_parent%/}/.powerlevel10k.XXXXXX")
# Must use this exact name so uninstall.sh can find it echo "${BLUE}Installing powerlevel10k...${RESET}"
OLD_ZSHRC=~/.zshrc.pre-oh-my-zsh
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then git clone --depth=1 "$P10K_REMOTE" "$theme_stage" || {
if [ -e "$OLD_ZSHRC" ]; then rm -rf "$theme_stage"
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)" error "git clone of powerlevel10k repo failed"
if [ -e "$OLD_OLD_ZSHRC" ]; then
error "$OLD_OLD_ZSHRC exists. Can't back up ${OLD_ZSHRC}"
error "re-run the installer again in a couple of seconds"
exit 1 exit 1
fi }
mv "$OLD_ZSHRC" "${OLD_OLD_ZSHRC}"
echo "${YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \ replace_dir "$theme_stage" "$theme_dir"
"${GREEN}Backing up to ${OLD_OLD_ZSHRC}${RESET}"
fi
echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Backing up to ${OLD_ZSHRC}${RESET}"
mv ~/.zshrc "$OLD_ZSHRC"
fi
echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc
sed "/^export ZSH=/ c\\
export ZSH=\"$ZSH\"
" ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc
echo echo
} }
@@ -239,18 +304,11 @@ main() {
exit 1 exit 1
fi fi
if [ -d "$ZSH" ]; then
cat <<-EOF
${YELLOW}You already have Oh My Zsh installed.${RESET}
You'll need to remove '$ZSH' if you want to reinstall.
EOF
exit 1
fi
setup_ohmyzsh setup_ohmyzsh
setup_zshrc
setup_shell setup_shell
apply_dotfiles
printf "$GREEN" printf "$GREEN"
cat <<-'EOF' cat <<-'EOF'
__ __ __ __
@@ -261,11 +319,7 @@ main() {
/____/ ....is now installed! /____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options. Your dotfiles have been installed to your home directory.
p.s. Follow us on https://twitter.com/ohmyzsh
p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh
EOF EOF
printf "$RESET" printf "$RESET"

View File

@@ -1,203 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,159 +0,0 @@
# LSD (LSDeluxe)
[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/Peltoche/ical-rs/master/LICENSE)
[![Build Status](https://travis-ci.org/Peltoche/lsd.svg?branch=master)](https://travis-ci.org/Peltoche/lsd)
[![Latest version](https://img.shields.io/crates/v/lsd.svg)](https://crates.io/crates/lsd)
[![Snap Status](https://build.snapcraft.io/badge/Peltoche/lsd.svg)](https://build.snapcraft.io/user/Peltoche/lsd)
# Table of Contents
- [Description](#description)
- [Screenshot](#screenshot)
- [Installation](#installation)
- [Configurations](#configurations)
* [Required](#required)
* [Optional](#optional)
- [Benchmark](#benchmark)
- [F.A.Q.](#faq)
- [Contributors](#contributors)
- [Credits](#credits)
## Description
This project is heavily inspired by the super [colorls](https://github.com/athityakumar/colorls)
project but with some little differences. For example it is written in rust and not in ruby which makes it much faster ([see the benchmarks](#benchmark)).
## Screenshot
![image](https://raw.githubusercontent.com/Peltoche/lsd/assets/screen_lsd.png)
## Installation
### Prerequisites
Install the patched fonts of powerline nerd-font and/or font-awesome. Have a look at the [Nerd Font README](https://github.com/ryanoasis/nerd-fonts/blob/master/readme.md) for more installation instructions. Don't forget to setup your terminal in order to use the correct font.
See [this issue comment](https://github.com/Peltoche/lsd/issues/199#issuecomment-494218334) for detailed instructions on how to configure iTerm2 font settings correctly.
### On Archlinux
```sh
pacman -S lsd
```
### On Fedora
```sh
dnf install lsd
```
### On Ubuntu
_... and other Debian-based Linux distributions_
Download the latest .deb package from the [release page](https://github.com/Peltoche/lsd/releases) and install it via:
```sh
sudo dpkg -i lsd_7.2.0_amd64.deb # adapt version number and architecture
```
### On Gentoo
```sh
sudo emerge sys-apps/lsd
```
(Ebuild maintained by Georgy Yakovlev)
### From Snap
```sh
sudo snap install lsd
```
### On macOS
via [Homebrew](https://brew.sh/):
```sh
brew install lsd
```
### From Sources
With Rust's package manager cargo, you can install lsd via:
```sh
cargo install lsd
```
### From Binaries
The [release page](https://github.com/Peltoche/lsd/releases) includes precompiled binaries for Linux and macOS.
## Configurations
### Required
In order to use lsd instead of the default ls you need to add this to you shell
configuration file (~/.bashrc, ~/.zshrc, etc.) :
```sh
alias ls='lsd'
```
### Optional
Some examples of useful aliases. You can add this to you shell configuration
file (~/.bashrc, ~/.zshrc, etc.) just under the alias above :
```sh
alias l='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'
```
## Benchmark
Result from `hyperfine --warmup 10 'lsd -la /etc/*' 'colorls -la /etc/*' 'exa -la /etc/*' --export-markdown out.md`:
| Command | Mean [ms] | Min…Max [ms] |
|:---|---:|---:|
| `lsd -la /etc/*` | 9.8 ± 0.7 | 8.6…11.9 |
| `colorls -la /etc/*` | 387.3 ± 4.1 | 379.8…393.6 |
| `exa -la /etc/*` | 15.4 ± 1.8 | 14.0…24.0 |
## F.A.Q.
### Default Colors
In the future the possibility to customize the colors might be implemented.
For now, the default colors are:
| User/Group | Permissions | File Types | Last time Modified | File Size |
|:---|:---|:---|:---|:---|
|![#ffffd7](https://placehold.it/17/ffffd7/000000?text=+) User|![#00d700](https://placehold.it/17/00d700/000000?text=+) Read |![#0087ff](https://placehold.it/17/0087ff/000000?text=+) Directory|![#00d700](https://placehold.it/17/00d700/000000?text=+) within the last hour|![#ffffaf](https://placehold.it/17/ffffaf/000000?text=+) Small File|
|![#d7d7af](https://placehold.it/17/d7d7af/000000?text=+) Group|![#d7ff87](https://placehold.it/17/d7ff87/000000?text=+) Write|![#00d700](https://placehold.it/17/00d700/000000?text=+) Executable File|![#00d787](https://placehold.it/17/00d787/000000?text=+) within the last day|![#ffaf87](https://placehold.it/17/ffaf87/000000?text=+) Medium File|
||![#af0000](https://placehold.it/17/af0000/000000?text=+) Execute|![#d7d700](https://placehold.it/17/d7d700/000000?text=+) Non-Executable File|![#00af87](https://placehold.it/17/00af87/000000?text=+) older|![#d78700](https://placehold.it/17/d78700/000000?text=+) Large File|
||![#ff00ff](https://placehold.it/17/ff00ff/000000?text=+) Execute with Stickybit|![#af0000](https://placehold.it/17/af0000/000000?text=+) Broken Symlink||![#ffffff](https://placehold.it/17/ffffff/000000?text=+) Non File|
||![#d75f87](https://placehold.it/17/d75f87/000000?text=+) No Access|![#00d7d7](https://placehold.it/17/00d7d7/000000?text=+) Pipe/Symlink/Blockdevice/Socket/Special|||
|||![#d78700](https://placehold.it/17/d78700/000000?text=+) CharDevice|||
## Contributors
Everyone can contribute to this project, improving the code or adding functions. If anyone wants something to be added we will try to do it.
As this is being updated regularly, don't forget to rebase your fork before creating a pull-request.
## Credits
Special thanks to:
- [meain](https://github.com/meain) for all his contributions and reviews
- [danieldulaney](https://github.com/danieldulaney) for the Windows integration
- [sharkdp](https://github.com/sharkdp) and his superb [fd](https://github.com/sharkdp/fd) from which I have stolen a lot of CI stuff.
- [athityakumar](https://github.com/athityakumar) for the project [colorls](https://github.com/athityakumar/colorls)
- All the other contributors

View File

@@ -1,68 +0,0 @@
#compdef lsd
autoload -U is-at-least
_lsd() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'*--color=[When to use terminal colours]: :(always auto never)' \
'*--icon=[When to print the icons]: :(always auto never)' \
'*--icon-theme=[Whether to use fancy or unicode icons]: :(fancy unicode)' \
'--depth=[Stop recursing into directories after reaching specified depth]' \
'*--size=[How to display size]: :(default short bytes)' \
'*--date=[How to display date]: :(date relative)' \
'*--group-dirs=[Sort the directories then the files]: :(none first last)' \
'*--blocks=[Specify the blocks that will be displayed and in what order]: :(permission user group size date name)' \
'*-a[Do not ignore entries starting with .]' \
'*--all[Do not ignore entries starting with .]' \
'*-A[Do not list implied . and ..]' \
'*--almost-all[Do not list implied . and ..]' \
'*-F[Append indicator (one of */=>@|) at the end of the file names]' \
'*--classify[Append indicator (one of */=>@|) at the end of the file names]' \
'*-l[Display extended file metadata as a table]' \
'*--long[Display extended file metadata as a table]' \
'*-1[Display one entry per line]' \
'*--oneline[Display one entry per line]' \
'(--tree)*-R[Recurse into directories]' \
'(--tree)*--recursive[Recurse into directories]' \
'-h[For ls compatibility purposes ONLY, currently set by default]' \
'--human-readable[For ls compatibility purposes ONLY, currently set by default]' \
'(-R --recursive)*--tree[Recurse into directories and present the result as a tree]' \
'(-a --all -A --almost-all --depth -R --recursive --tree)-d[Display directories themselves, and not their contents]' \
'(-a --all -A --almost-all --depth -R --recursive --tree)--directory-only[Display directories themselves, and not their contents]' \
'*--total-size[Display the total size of directories]' \
'*-t[Sort by time modified]' \
'*--timesort[Sort by time modified]' \
'*-S[Sort by size]' \
'*--sizesort[Sort by size]' \
'*-r[Reverse the order of the sort]' \
'*--reverse[Reverse the order of the sort]' \
'--classic[Enable classic mode (no colors or icons)]' \
'*--no-symlink[Do not display symlink target]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::FILE:_files' \
&& ret=0
}
(( $+functions[_lsd_commands] )) ||
_lsd_commands() {
local commands; commands=(
)
_describe -t commands 'lsd commands' commands "$@"
}
_lsd "$@"

View File

@@ -1,73 +0,0 @@
_lsd() {
local i cur prev opts cmds
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${i}" in
lsd)
cmd="lsd"
;;
*)
;;
esac
done
case "${cmd}" in
lsd)
opts=" -a -A -F -l -1 -R -h -d -t -S -r -V --all --almost-all --classify --long --oneline --recursive --human-readable --tree --directory-only --total-size --timesort --sizesort --reverse --classic --no-symlink --help --version --color --icon --icon-theme --depth --size --date --group-dirs --blocks <FILE>... "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
case "${prev}" in
--color)
COMPREPLY=($(compgen -W "always auto never" -- ${cur}))
return 0
;;
--icon)
COMPREPLY=($(compgen -W "always auto never" -- ${cur}))
return 0
;;
--icon-theme)
COMPREPLY=($(compgen -W "fancy unicode" -- ${cur}))
return 0
;;
--depth)
COMPREPLY=($(compgen -f ${cur}))
return 0
;;
--size)
COMPREPLY=($(compgen -W "default short bytes" -- ${cur}))
return 0
;;
--date)
COMPREPLY=($(compgen -W "date relative" -- ${cur}))
return 0
;;
--group-dirs)
COMPREPLY=($(compgen -W "none first last" -- ${cur}))
return 0
;;
--blocks)
COMPREPLY=($(compgen -W "permission user group size date name" -- ${cur}))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
esac
}
complete -F _lsd -o bashdefault -o default lsd

View File

@@ -1,25 +0,0 @@
complete -c lsd -n "__fish_use_subcommand" -l color -d 'When to use terminal colours' -r -f -a "always auto never"
complete -c lsd -n "__fish_use_subcommand" -l icon -d 'When to print the icons' -r -f -a "always auto never"
complete -c lsd -n "__fish_use_subcommand" -l icon-theme -d 'Whether to use fancy or unicode icons' -r -f -a "fancy unicode"
complete -c lsd -n "__fish_use_subcommand" -l depth -d 'Stop recursing into directories after reaching specified depth'
complete -c lsd -n "__fish_use_subcommand" -l size -d 'How to display size' -r -f -a "default short bytes"
complete -c lsd -n "__fish_use_subcommand" -l date -d 'How to display date' -r -f -a "date relative"
complete -c lsd -n "__fish_use_subcommand" -l group-dirs -d 'Sort the directories then the files' -r -f -a "none first last"
complete -c lsd -n "__fish_use_subcommand" -l blocks -d 'Specify the blocks that will be displayed and in what order' -r -f -a "permission user group size date name"
complete -c lsd -n "__fish_use_subcommand" -s a -l all -d 'Do not ignore entries starting with .'
complete -c lsd -n "__fish_use_subcommand" -s A -l almost-all -d 'Do not list implied . and ..'
complete -c lsd -n "__fish_use_subcommand" -s F -l classify -d 'Append indicator (one of */=>@|) at the end of the file names'
complete -c lsd -n "__fish_use_subcommand" -s l -l long -d 'Display extended file metadata as a table'
complete -c lsd -n "__fish_use_subcommand" -s 1 -l oneline -d 'Display one entry per line'
complete -c lsd -n "__fish_use_subcommand" -s R -l recursive -d 'Recurse into directories'
complete -c lsd -n "__fish_use_subcommand" -s h -l human-readable -d 'For ls compatibility purposes ONLY, currently set by default'
complete -c lsd -n "__fish_use_subcommand" -l tree -d 'Recurse into directories and present the result as a tree'
complete -c lsd -n "__fish_use_subcommand" -s d -l directory-only -d 'Display directories themselves, and not their contents'
complete -c lsd -n "__fish_use_subcommand" -l total-size -d 'Display the total size of directories'
complete -c lsd -n "__fish_use_subcommand" -s t -l timesort -d 'Sort by time modified'
complete -c lsd -n "__fish_use_subcommand" -s S -l sizesort -d 'Sort by size'
complete -c lsd -n "__fish_use_subcommand" -s r -l reverse -d 'Reverse the order of the sort'
complete -c lsd -n "__fish_use_subcommand" -l classic -d 'Enable classic mode (no colors or icons)'
complete -c lsd -n "__fish_use_subcommand" -l no-symlink -d 'Do not display symlink target'
complete -c lsd -n "__fish_use_subcommand" -l help -d 'Prints help information'
complete -c lsd -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'

Binary file not shown.

View File

@@ -1,41 +0,0 @@
#!/bin/sh
#
#set -x
dotPath=".config/dotfiles"
cp $dotPath/.zshrc $dotPath/.vimrc $dotPath/.zprofile $dotPath/.gitconfig $dotPath/.p10k.zsh .
if [ -d ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k ]; then
echo "pl10k already exists, skipping"
else
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
fi
if [ $(id -u) -ne 0 ]
then
echo "run me as root to copy cdbm & lsd to the system"
else
if [ ! -d /usr/local/bin ]; then mkdir -p /usr/local/bin; fi
OS=`uname`
case "$OS" in
Darwin)
ARCH=`uname -m`
case "$ARCH" in
arm64)
cp $dotPath/cdbm/Darwin/arm64/cdbm /usr/local/bin
;;
*)
cp $dotPath/cdbm/Darwin/x86_64/cdbm /usr/local/bin
;;
esac
;;
Linux)
cp $dotPath//cdbm/Linux/cdbm /usr/local/bin
;;
*)
$OS is not supported
;;
esac
fi

63
tmux/tmux.conf Normal file
View File

@@ -0,0 +1,63 @@
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded!"
# XDG-friendly plugin + save locations
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.local/share/tmux/plugins'
set -g @tpm_plugins_dir '~/.local/share/tmux/plugins'
set -g @resurrect-dir '~/.local/state/tmux/resurrect'
# Use vi mode
setw -g mode-keys vi
# Improve colors
set -g default-terminal "tmux-256color"
set -as terminal-features ",xterm-256color:RGB"
# remove ESC delay
set -s escape-time 0
# Status line
#set-option -g status-style "fg=#000000,bg=#FF6600"
set -g status-style fg=#000000,bg=#FF6600
# Start window and pane numbering at 1
set -g base-index 1
setw -g pane-base-index 1
# Renumber windows when one is closed (no gaps)
set -g renumber-windows on
set -g display-time 4000 # 4 seconds
set -g mouse on
# Status bar refresh interval (seconds)
set -g status-interval 5
# Status bar position: bottom (default) or top
set -g status-position bottom
# Status bar colors
#set -g status-bg colour234 # dark gray background
#set -g status-fg white # white text
# Left side: session name and window list
set -g status-left-length 30
set -g status-left "#[fg=green]#S #[default]"
# Toggle mouse with Prefix + m
bind m if -F '#{mouse}' \
'set -g mouse off; display-message "mouse: off"' \
'set -g mouse on; display-message "mouse: on"'
set -g status-right ""
# Tmux Plugin Manager
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Continuum settings
set -g @continuum-restore 'on' # Auto-restore on tmux startup
set -g @continuum-save-interval '15' # Auto-save every 15 minutes
# Initialize TPM (keep this line at the very bottom of tmux.conf)
run '~/.local/share/tmux/plugins/tpm/tpm'