points/.README.md

259 lines
6.2 KiB
Markdown
Raw Normal View History

2024-02-12 14:36:40 +01:00
<!-- markdownlint-disable line-length no-inline-html no-duplicate-heading -->
2023-03-23 09:49:43 +01:00
# Bare Git Repository
2024-02-12 14:36:40 +01:00
- <https://www.atlassian.com/git/tutorials/dotfiles>
2023-03-23 09:49:43 +01:00
- StreakyCobra
2024-02-12 14:36:40 +01:00
## Starting from scratch
2023-03-23 09:49:43 +01:00
2024-02-12 14:36:40 +01:00
```sh
2023-03-23 09:49:43 +01:00
git init --bare $HOME/.dotfiles
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
dotfiles config --local status.showUntrackedFiles no
```
## Install onto a new system
The `checkout` command is expected to fail with a message.
This is because your $HOME folder might already have some stock configuration
files which would be overwritten by Git.
The “BKDIR” part is a rough shortcut to move all the offending files
automatically to a backup folder:
2024-02-12 14:36:40 +01:00
```sh
git clone --bare <git-repo-url> $HOME/.dotfiles
2023-03-23 09:49:43 +01:00
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
dotfiles config --local status.showUntrackedFiles no
BKDIR=".dotfiles-backup/";
dotfiles checkout 2>&1 | egrep "\s+" | awk {'print $1'} |
xargs -I{} sh -c "mkdir -p \$(dirname ${BKDIR}{}); mv -iv {} ${BKDIR}{}";
2023-03-23 09:49:43 +01:00
dotfiles checkout
2023-03-23 09:49:43 +01:00
```
## Install into `/etc/skel`
2024-02-12 14:36:40 +01:00
```sh
sudo mkdir -p /etc/skel/.dotfiles
sudo chown $(whoami) /etc/skel
git clone --bare $(dotfiles remote -v | head -1 | cut -f2 | cut -f1 -d' ') /etc/skel/.dotfiles
alias skelfiles='/usr/bin/git --git-dir=/etc/skel/.dotfiles --work-tree=/etc/skel'
skelfiles config --local status.showUntrackedFiles no
skelfiles checkout
```
2023-05-05 10:51:56 +02:00
## Useful Commands
- List all tracked files (from CWD):
`dotfiles ls-tree --name-only -rz main | xargs -0 $(whence lsd) -lU`
2023-03-23 09:49:43 +01:00
## Other Tools
2024-02-12 14:36:40 +01:00
```sh
2023-03-23 09:49:43 +01:00
lazygit --git-dir=$HOME/.dotfiles --work-tree=$HOME
```
2023-06-13 17:28:13 +02:00
# Install remotes as subtree
2024-02-12 14:36:40 +01:00
- <https://www.atlassian.com/git/tutorials/git-subtree>
2023-06-13 17:28:13 +02:00
- Create an alias for remote repository
- `dotfiles remote add <remote-name> <URL>`
- Import remote as a single commit (squashed)
- `dotfiles subtree add --prefix <target-folder> <remote-name> <branch> --squash
- Note 1: Must be called from $HOME
- Note 2: Do not start <target-folder> with $HOME or ~
2024-02-22 18:37:43 +01:00
# Every-day Tools
## Recommended Installation Order
- debian apt
- versions_check: bat, lsd
- fonts
- kitty
- lazygit
- nnn
- neovim
2023-04-27 10:49:07 +02:00
2023-05-26 10:37:02 +02:00
## Generic Tips
### Github Patches
From [stackoverflow](https://stackoverflow.com/questions/28484186/apply-github-commit-pull-request-as-a-patch).
2024-02-12 14:36:40 +01:00
```sh
2023-05-26 10:37:02 +02:00
wget https://github.com/jesseduffield/lazygit/pull/2604.patch
git apply --stat --apply 2604.patch
```
2024-02-22 18:37:43 +01:00
## Debian Packages
```sh
2024-02-23 15:48:08 +01:00
apt install curl fd-find fzf grc ripgrep wget xdg-utils
2024-02-22 18:37:43 +01:00
dpkg-divert --divert /usr/bin/fd --rename /usr/bin/fdfind
dpkg-divert --divert /usr/share/man/man1/fd.1.gz --rename /usr/share/man/man1/fdfind.1.gz
dpkg-divert --divert /usr/share/zsh/vendor-completions/_rg --rename /usr/share/zsh/vendor-completions/rg.zsh
```
2023-05-26 10:37:02 +02:00
## Fonts
- [How to install and manage fonts on Linux](https://linuxconfig.org/how-to-install-and-manage-fonts-on-linux)
- `mv folder ~/.fonts`
- `fc-cache -fv ~/.fonts`
- [JetBrains Mono](https://www.jetbrains.com/lp/mono/)
- Install the files **without “NL”** (i.e No Ligatures) in their names
- [Nerd Fonts](https://www.nerdfonts.com/)
- [Download](https://github.com/ryanoasis/nerd-fonts/tags)
2024-02-22 18:37:43 +01:00
- JetBrainsMono.tar.xz
2023-05-26 10:37:02 +02:00
- NerdFontsSymbolsOnly.tar.xz
- [Cheat Sheet](https://www.nerdfonts.com/cheat-sheet)
2024-02-12 14:36:40 +01:00
- <https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/bin/scripts/test-fonts.sh>
2023-05-26 10:37:02 +02:00
2023-04-27 10:49:07 +02:00
## kitty
2024-02-12 14:36:40 +01:00
- <https://sw.kovidgoyal.net/kitty/binary/>
2023-10-09 17:34:30 +02:00
- Install `JetBrains Mono` (without NF) & `NerdFontsSymbolsOnly` fonts.
2023-11-07 19:47:37 +01:00
- Note: outside of kitty, it may be interesting to also install
2024-02-12 14:36:40 +01:00
_JetBrains Mono_ **with** _NF_.
2023-04-27 10:49:07 +02:00
2024-02-12 14:36:40 +01:00
```sh
2024-02-22 18:37:43 +01:00
sudo apt install kitty-terminfo
2023-10-31 19:04:15 +01:00
(kitty --version && curl https://sw.kovidgoyal.net/kitty/changelog/ | html2text) | less
2024-02-22 18:37:43 +01:00
2023-04-27 10:49:07 +02:00
sh ~/.config/kitty/installer.sh
```
**Note**:
Kitty prepends its _bin_ folder to the path.
So it is more coherent/simpler to copy this behaviour into Zsh.
2023-05-04 17:33:19 +02:00
## lazygit
2023-11-07 19:47:37 +01:00
### Dependencies
- git-delta
2024-02-22 18:37:43 +01:00
- go language (when compiling)
### From Source
```sh
mkdir -p $HOME/dev_3rd/golang
cd $HOME/dev_3rd/golang
git clone https://github.com/jesseduffield/lazygit.git
cd lazygit
path+=(/usr/lib/go-1.21/bin)
go install
```
2023-10-04 16:14:42 +02:00
### Binary Releases
2024-02-12 14:36:40 +01:00
```sh
2023-11-07 19:47:37 +01:00
URI=https://api.github.com/repos/jesseduffield/lazygit
LOCATION=$(curl -s $URI/releases/latest \
2023-10-04 16:14:42 +02:00
| grep "browser_download_url.*Linux_x86_64" \
| awk '{ print $2 }' \
| sed 's/,$//' \
| sed 's/"//g')
echo $LOCATION
wget $LOCATION
tar xf *.tar.gz(om[1])
```
2024-02-22 18:37:43 +01:00
### From Go Package
2023-05-26 10:37:02 +02:00
2024-02-12 14:36:40 +01:00
```sh
2023-05-04 17:33:19 +02:00
go install github.com/jesseduffield/lazygit@latest
```
2023-05-26 10:37:02 +02:00
2024-02-12 14:36:40 +01:00
Problem: Commit ID, build date and version aren't set.
2023-05-26 10:37:02 +02:00
2024-02-12 14:36:40 +01:00
```sh
$ lazygit --version
commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64, git version=2.43.0
2023-05-26 10:37:02 +02:00
```
2024-02-12 14:36:40 +01:00
2023-06-15 13:54:45 +02:00
## neovim
2023-11-07 19:47:37 +01:00
### Dependencies
- kitty / NerdFont
- libfuse2
- xsel
2023-11-07 19:47:37 +01:00
### Binary Nightly Release
2024-02-12 14:36:40 +01:00
```sh
mkdir -p $HOME/.local/bin
2023-06-15 13:54:45 +02:00
cd $HOME/.local/bin
2023-06-15 13:54:45 +02:00
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage
chmod u+x nvim.appimage
ln -sf nvim.appimage nvim
ln -sf nvim.appimage vi
2023-06-15 13:54:45 +02:00
cd $HOME
nvim --version
vi --version
2023-10-09 17:34:30 +02:00
```
2023-11-17 19:58:38 +01:00
2024-02-22 18:37:43 +01:00
### flatpak
```sh
flatpak install flathub io.neovim.nvim
```
2023-11-17 19:58:38 +01:00
## nnn — n³
### Dependencies
- kitty / NerdFont
- Archives Management:
- bsdtar (`libarchive-tools`) supports _Zstd_
2023-11-28 15:51:17 +01:00
- [fuse-archive](https://github.com/google/fuse-archive)
- `atool`: last release is from 2012
2024-02-12 14:36:40 +01:00
- <https://github.com/solsticedhiver/atool2>
- <https://github.com/wummel/patool>
2023-11-17 19:58:38 +01:00
2024-02-12 14:36:40 +01:00
- Drag&Drop: <https://github.com/mwh/dragon>
2023-11-17 19:58:38 +01:00
- Trash:
- `trash-cli` is a much better CLI-only solution!
Compare the outputs of `trash-cli` and `gio trash --list`
- For `gio trash`, packages `libglib2.0` & `gvfs` are recommended.
2024-02-22 18:37:43 +01:00
### From source
2023-11-17 19:58:38 +01:00
2024-02-12 14:36:40 +01:00
```sh
2024-02-22 18:37:43 +01:00
# From release
2023-11-17 19:58:38 +01:00
URI=https://github.com/jarun/nnn
xdg-open $URI/releases/latest
ARCHIVE=$(echo $HOME/Downloads/*.gz(om[1])) && echo $ARCHIVE
tar xf $ARCHIVE
2024-02-22 18:37:43 +01:00
# From repository
git clone https://github.com/jarun/nnn.git
2023-11-28 15:51:17 +01:00
# Compile
2023-11-17 19:58:38 +01:00
cd nnn*(om[1])
make clean
sudo make O_GITSTATUS=1 O_NAMEFIRST=1 O_NERD=1 install
2024-02-13 14:59:10 +01:00
sudo cp -v misc/auto-completion/zsh/* /usr/local/share/zsh/site-functions
2024-02-22 18:37:43 +01:00
sudo chmod a+r /usr/local/share/zsh/site-functions/*
2023-11-17 19:58:38 +01:00
2024-02-22 18:37:43 +01:00
# Plugins
2024-02-13 14:59:10 +01:00
mv -v ~/.config/nnn/plugins plugins_$(stat -c %Y ~/.config/nnn/plugins)
2024-02-22 18:37:43 +01:00
mkdir -p ~/.config/nnn
2024-02-13 14:59:10 +01:00
cp -av plugins ~/.config/nnn
2023-11-17 19:58:38 +01:00
```