diff --git a/.README.md b/.README.md index 82b6f8f..74e5c11 100644 --- a/.README.md +++ b/.README.md @@ -34,6 +34,13 @@ dotfiles checkout 2>&1 | egrep "\s+" | awk {'print $1'} | dotfiles checkout ``` +When the `fetch` configuration is not set, insert the following line in +`.dotfiles/config`: + +```config + fetch = +refs/heads/*:refs/remotes/origin/* +``` + ## Install into `/etc/skel` ```sh @@ -68,10 +75,28 @@ lazygit --git-dir=$HOME/.dotfiles --work-tree=$HOME - Note 1: Must be called from $HOME - Note 2: Do not start with $HOME or ~ -# Install recent versions of applications +# Every-day Tools + +Recommended installation order: + +- System Config +- [Debian packages](#debian) +- Qubes proxy scripts (TODO) +- dotfiles (see above) +- [ASDF](#asdf) & plugins +- Newer Debian packages: `bin/versions_check` +- [Fonts](#fonts) +- [kitty](#kitty) — `st`? +- [lazygit](#lazygit) +- [nnn](#nnn) +- [neovim](#neovim) ## Generic Tips +### Desktop Files + +See + ### Github Patches From [stackoverflow](https://stackoverflow.com/questions/28484186/apply-github-commit-pull-request-as-a-patch). @@ -81,17 +106,52 @@ wget https://github.com/jesseduffield/lazygit/pull/2604.patch git apply --stat --apply 2604.patch ``` -## Fonts +### Qubes Internet Access -- [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` +- In _Basic_, connect to `sys-firewall`; +- In _Firewall rules_: + - check _Limit outgoing connections_; + - check _Allow full access for 25 minutes_. + +## System Config + +- [SysRq](https://www.kicksecure.com/wiki/SysRq) + +## Debian Packages {#debian} + +```sh +apt install curl fd-find fzf git grc ripgrep wget xdg-utils + +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 +``` + +## ASDF & main plugins {#asdf} + +`.zshrc` will install `asdf`. + +Make sure you have the required [system dependencies](https://github.com/pyenv/pyenv/wiki#suggested-build-environment) +before installing/compiling Python. + +```sh +sudo apt install --no-install-recommends XXX + +asdf plugin add direnv +asdf plugin add python +cd ~/bin +asdf current +asdf install +``` + +## Fonts {#fonts} - [JetBrains Mono](https://www.jetbrains.com/lp/mono/) - - Install the files **without “NL”** (i.e No Ligatures) in their names + - Install the files **without** “NL” (No Ligatures) in their names - [Nerd Fonts](https://www.nerdfonts.com/) - [Download](https://github.com/ryanoasis/nerd-fonts/tags) + - JetBrainsMono.tar.xz - NerdFontsSymbolsOnly.tar.xz - [Cheat Sheet](https://www.nerdfonts.com/cheat-sheet) - @@ -107,19 +167,66 @@ git apply --stat --apply 2604.patch ``` -## kitty - -- -- Install `JetBrains Mono` (without NF) & `NerdFontsSymbolsOnly` fonts. - - Note: outside of kitty, it may be interesting to also install - _JetBrains Mono_ **with** _NF_. +### in $HOME/.fonts ```sh -sudo apt-get install kitty-terminfo +mv folder ~/.fonts +fc-cache -fv ~/.fonts +``` -(kitty --version && curl https://sw.kovidgoyal.net/kitty/changelog/ | html2text) | less +See also [How to install and manage fonts on Linux](https://linuxconfig.org/how-to-install-and-manage-fonts-on-linux). + +### in /opt/fonts + +`/etc/fonts/conf.d/00-opt.conf`: + +```xml + + +/opt/fonts + +``` + +```sh +sudo mv folder /opt/fonts +fc-cache -fv /opt/fonts +``` + +## kitty {#kitty} + +- + +### Dependencies + +- `JetBrains Mono` (without NL) +- `NerdFontsSymbolsOnly` + - Note: outside of kitty, it may be interesting to also install + _JetBrains Mono_ **with** _NL_. +- terminfo + +```sh +sudo apt install kitty-terminfo + # OR: +wget 'https://salsa.debian.org/debian/kitty/-/raw/debian/sid/terminfo/x/xterm-kitty +``` + +### Install + +```sh + # Show installed version, debian package & changelog +(ls =kitty; + kitty --version; + apt show kitty; + curl https://sw.kovidgoyal.net/kitty/changelog/ | html2text) | less + + # Debian package +sudo apt install kitty + + # In $HOME +sh ~/.config/kitty/installer.sh + + # In /opt/kitty.app sudo sh ~/.config/kitty/installer.sh launch=n dest=/opt - sudo update-alternatives \ --install /usr/bin/x-terminal-emulator \ x-terminal-emulator /opt/kitty.app/bin/kitty 99 @@ -129,11 +236,30 @@ sudo update-alternatives \ Kitty prepends its _bin_ folder to the path. So it is more coherent/simpler to copy this behaviour into Zsh. -## lazygit +## lazygit {#lazygit} ### Dependencies - git-delta +- go language (when compiling) + +```sh + # debian testing & unstable: +apt install git-delta +``` + +### 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 +``` ### Binary Releases @@ -153,9 +279,10 @@ wget $LOCATION tar xf *.tar.gz(om[1]) ``` -### Go +### From Go Package ```sh +go install github.com/jesseduffield/lazygit@latest export GOPATH=/opt/go && sudo mkdir -p $GOPATH sudo -E go install github.com/jesseduffield/lazygit@latest ``` @@ -167,18 +294,7 @@ $ lazygit --version commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64, git version=2.43.0 ``` -### Manual - -```sh -mkdir -p $HOME/dev_3rd/golang -cd $HOME/dev_3rd/golang - -git clone https://github.com/jesseduffield/lazygit.git -cd lazygit -go install -``` - -## neovim +## neovim {#neovim} ### Dependencies @@ -189,6 +305,9 @@ go install ### Binary Nightly Release ```sh +mkdir -p $HOME/.local/bin +cd $HOME/.local/bin + # --- mkdir -p /opt/neovim/bin cd /opt/neovim/bin @@ -202,7 +321,13 @@ nvim --version vi --version ``` -## nnn — n³ +### flatpak + +```sh +flatpak install flathub io.neovim.nvim +``` + +## nnn — n³ {#nnn} ### Dependencies @@ -220,30 +345,33 @@ vi --version - 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. -### Source Code of Latest Release +### From source ```sh - # Download archive & extract files + # From release URI=https://github.com/jarun/nnn xdg-open $URI/releases/latest ARCHIVE=$(echo $HOME/Downloads/*.gz(om[1])) && echo $ARCHIVE tar xf $ARCHIVE + # From repository +git clone https://github.com/jarun/nnn.git + # Compile cd nnn*(om[1]) make clean + +sudo make O_GITSTATUS=1 O_NAMEFIRST=1 O_NERD=1 install sudo make PREFIX=/opt/nnn O_GITSTATUS=1 O_NAMEFIRST=1 O_NERD=1 install - # Copy plugins -plugins/getplugs master +sudo cp -v misc/auto-completion/zsh/* /usr/local/share/zsh/site-functions +sudo chmod a+r /usr/local/share/zsh/site-functions/* + + # Plugins +mv -v ~/.config/nnn/plugins plugins_$(stat -c %Y ~/.config/nnn/plugins) +mkdir -p ~/.config/nnn +cp -av plugins ~/.config/nnn ``` - -### From repository - -```sh -git clone https://github.com/jarun/nnn.git -``` - -and then, as above… diff --git a/.config/autostart/once-connected.desktop b/.config/autostart/once-connected.desktop index 93dee11..1d18b85 100644 --- a/.config/autostart/once-connected.desktop +++ b/.config/autostart/once-connected.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=/home/michel/bin/once-connected.zsh +Exec=/home/user/bin/once-connected.zsh Icon=user Name=once-connected.zsh Terminal=false diff --git a/.config/debian-apt/signal.sources b/.config/debian-apt/signal.sources index 76e86b7..24c3e18 100644 --- a/.config/debian-apt/signal.sources +++ b/.config/debian-apt/signal.sources @@ -6,4 +6,4 @@ Suites: xenial Components: main Architectures: amd64 Trusted: no -Signed-By: /usr/share/keyrings/signal-desktop-keyring.gpg +Signed-By: /etc/apt/keyrings/signal-desktop-keyring.gpg diff --git a/.config/environment.d/variables.conf b/.config/environment.d/variables.conf deleted file mode 100644 index bde5225..0000000 --- a/.config/environment.d/variables.conf +++ /dev/null @@ -1,2 +0,0 @@ -NC_STORAGE=$HOME/NC-Michel/Linux/folder -ALT_HISTORY_FILE=$HOME/NC-Michel/Linux/another-folder/history diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index e0f4412..892c7a5 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -36,12 +36,13 @@ symbol_map U+e0ca Symbols Nerd Font symbol_map U+e0cc-U+e0d4 Symbols Nerd Font symbol_map U+e200-U+e2a9 Symbols Nerd Font symbol_map U+e300-U+e3e3 Symbols Nerd Font -symbol_map U+e5fa-U+e6a6 Symbols Nerd Font +symbol_map U+e5fa-U+e6b1 Symbols Nerd Font symbol_map U+e700-U+e7c5 Symbols Nerd Font symbol_map U+ea60-U+ebeb Symbols Nerd Font symbol_map U+f000-U+f2e0 Symbols Nerd Font -symbol_map U+f300-U+f32f Symbols Nerd Font +symbol_map U+f300-U+f372 Symbols Nerd Font symbol_map U+f400-U+f532 Symbols Nerd Font +symbol_map U+f500-U+fd46 Symbols Nerd Font symbol_map U+f0001-U+f1af0 Symbols Nerd Font #: Cursor customization {{{1 @@ -90,6 +91,7 @@ enabled_layouts grid, splits, stack, tall:bias=70;full_size=2 tab_bar_style fade tab_fade 0.80 0.85 0.90 0.95 +tab_bar_min_tabs 1 active_tab_foreground #000 active_tab_background #FAA active_tab_font_style bold @@ -117,6 +119,8 @@ dynamic_background_opacity yes #: OS specific tweaks {{{1 +editor vi + #: }}}1 diff --git a/.config/lazygit/config.yml b/.config/lazygit/config.yml index cff44ef..2989057 100644 --- a/.config/lazygit/config.yml +++ b/.config/lazygit/config.yml @@ -1,8 +1,5 @@ # Documentation: # https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md -# -# To upgrade to latest binary: -# `go install github.com/jesseduffield/lazygit@latest` customCommands: @@ -71,6 +68,9 @@ keybinding: notARepository: 'skip' +os: + editPreset: 'nvim' + refresher: refreshInterval: 30 fetchInterval: 3600 diff --git a/.config/xfce4/helpers.rc b/.config/xfce4/helpers.rc new file mode 100644 index 0000000..9428343 --- /dev/null +++ b/.config/xfce4/helpers.rc @@ -0,0 +1,2 @@ +WebBrowser=firefox +TerminalEmulator=kitty diff --git a/.local/share/applications/nvim.desktop b/.local/share/applications/nvim.desktop index 8141811..1538c37 100644 --- a/.local/share/applications/nvim.desktop +++ b/.local/share/applications/nvim.desktop @@ -1,10 +1,3 @@ -# To update: -# ``` -# curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage \ -# --output-dir $HOME/bin && -# chmod u+x $HOME/bin/nvim.appimage -# ``` -# [Desktop Entry] Name=Neovim ($HOME/bin) GenericName=Text Editor @@ -17,6 +10,3 @@ Icon=nvim Categories=Utility;TextEditor; StartupNotify=false MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; - -# -# See https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html diff --git a/.local/share/xfce4/helpers/firefox.desktop b/.local/share/xfce4/helpers/firefox.desktop new file mode 100644 index 0000000..ae14af3 --- /dev/null +++ b/.local/share/xfce4/helpers/firefox.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +NoDisplay=true +Version=1.0 +Encoding=UTF-8 +Type=X-XFCE-Helper +X-XFCE-Category=WebBrowser +X-XFCE-CommandsWithParameter=flatpak run org.mozilla.firefox -ProfileManager "%s" +Icon=firefox +Name=firefox flatpak +X-XFCE-Commands=flatpak run org.mozilla.firefox -ProfileManager + diff --git a/.xsessionrc b/.xsessionrc new file mode 100644 index 0000000..ee68a7a --- /dev/null +++ b/.xsessionrc @@ -0,0 +1,8 @@ +# https://wiki.debian.org/Xsession +LOG=$HOME/.xsessionrc.log +touch $LOG + +export NC_STORAGE=$HOME/NC-Michel/Linux/michdell +export ALT_HISTORY_FILE=$HOME/NC-Michel/Linux/VQubes/history + +export >> $LOG diff --git a/.zshrc b/.zshrc index 7e9aee3..3eb09dd 100644 --- a/.zshrc +++ b/.zshrc @@ -1,18 +1,5 @@ #!/bin/zsh -### -### Debian Settings -### - -# apt install bat curl fd-find fzf lsd ripgrep - -# dpkg-divert --divert /usr/bin/bat --rename /usr/bin/batcat -# dpkg-divert --divert /usr/bin/fd --rename /usr/bin/fdfind -# dpkg-divert --divert /usr/share/man/man1/bat.1.gz --rename /usr/share/man/man1/batcat.1.gz -# 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 - - ### ### Zsh Configuration ### @@ -54,9 +41,13 @@ typeset -U path fpath ### Modules ### -### ASDF +### ASDF & direnv +# +# asdf plugin add direnv +# asdf install direnv latest +# asdf direnv setup --version latest +# asdf global direnv latest # -# Line below from `asdf direnv setup --version latest` source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc" ### b4b4r07/enhancd @@ -240,23 +231,22 @@ compdef hg=rg # To choose an existing instance for nvr, use: # `export NVIM=$(nvr --serverlist | fzf --exit-0 --select-1) && echo $NVIM` + # nnn - n³ # -# See https://github.com/jarun/nnn/wiki/Usage#configuration -export NNN_ARCHIVE='\.(7z|bz2|cbz|cbr|gz|tar|tbz|tgz|xz|zip|zst)$' -if (( ${+commands[fuse-archive]} )); then - export NNN_ARCHMNT='fuse-archive' -fi -export NNN_BMS="d:~/Downloads;q:~/QubesIncoming" -export NNN_OPENER="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke" -export NNN_OPTS='ABeGo' -export NNN_ORDER="t:$HOME/Downloads" -export NNN_PLUG='d:fzcd;o:-!xdg-open "$nnn"*;z:fzopen' -if (( ${+commands[trash-put]} )); then - export NNN_TRASH=1 -elif (( ${+commands[gio]} )); then - export NNN_TRASH=2 -fi + +local nnn_plug=( + 'b:-!bat --paging=always "$nnn"*' + 'd:fzcd' + 'z:fzopen' + 'm:mimelist' + 'o:-!mimeopen "$nnn"*' + 'O:-!mimeopen --ask "$nnn"*' + 'U:umounttree' + ';:-!clear*' + + # TODO Dump trash +) n() { @@ -265,9 +255,28 @@ n() return fi - export GUI=1 # plugins: nuke, xdgdefault - export LESS=${LESS/F} - export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/cd-on-quit" + local -x LESS=${LESS/F} + local -x PATH=$HOME/.config/nnn/plugins:$PATH + + # See https://github.com/jarun/nnn/wiki/Usage#configuration + local -x GUI=1 # plugins: nuke, xdgdefault + local -x NNN_ARCHIVE='\.(7z|bz2|cbz|cbr|gz|tar|tbz|tgz|xz|zip|zst)$' + local -x NNN_BMS="d:~/Downloads;q:~/QubesIncoming" + local -x NNN_OPENER="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke" + local -x NNN_OPTS='ABeGo' + local -x NNN_ORDER="t:$HOME/Downloads" + local -x NNN_PLUG=${(j:;:)nnn_plug} + local -x NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/cd-on-quit" + + if (( ${+commands[fuse-archive]} )); then + local -x NNN_ARCHMNT='fuse-archive' + fi + if (( ${+commands[trash-put]} )); then + local -x NNN_TRASH=1 + elif (( ${+commands[gio]} )); then + local -x NNN_TRASH=2 + fi + command nnn "$@" if [ -f $NNN_TMPFILE ]; then @@ -279,6 +288,7 @@ n() dirs -v fi } +compdef n=nnn nnn-file-widget() { # Extract "shell word" at cursor position (respecting quotes) @@ -323,6 +333,7 @@ zle -N nnn-file-widget bindkey -M vicmd '\en' nnn-file-widget bindkey -M viins '\en' nnn-file-widget + # Whiptail helper # # see https://stackoverflow.com/questions/1970180/whiptail-how-to-redirect-output-to-environment-variable @@ -386,6 +397,7 @@ whiptail_menu() { return $res } + ### ### Aliases -- Global & automatic expansion ### @@ -436,6 +448,7 @@ export BROWSER=firefox export EDITOR=vi export LESS=-iFRS export SYSTEMD_LESS='iFRSXMK' +export VISUAL=bat # KeePassXC SSH Agent [[ -v SSH_AUTH_SOCK ]] || export SSH_AUTH_SOCK=$(echo /tmp/ssh-*/agent.*(U)) @@ -475,26 +488,25 @@ bindkey -M viins "^_" undo ### Zsh Options ### -## Input/Output +## Changing Directories +setopt no_auto_cd +## Expansion and Globbing +setopt equals + +## Input/Output +setopt no_clobber setopt correct setopt interactive_comments - -# Disallow `>` to overwrite existing files. Use `>|` or `>!` instead. -setopt no_clobber - +setopt no_print_exit_value ## Job control - -# Prevent background jobs being given a lower priority. +setopt auto_continue setopt no_bg_nice - -# Prevent status report of jobs on shell exit. -setopt no_check_jobs - -# Prevent SIGHUP to jobs on shell exit. +setopt check_jobs setopt no_hup + # Remove path duplicates typeset -U path fpath @@ -503,7 +515,7 @@ typeset -U path fpath ### Completion Late Definitions ### -compdef bat=batcat +compdef locate=glocate # Hide "parameters" (i.e. environment variables) when looking for a "command" zstyle ':completion:*:-command-:*' tag-order '!parameters' diff --git a/bin/.envrc b/bin/.envrc new file mode 100644 index 0000000..21fad50 --- /dev/null +++ b/bin/.envrc @@ -0,0 +1,10 @@ +# See `direnv stdlib` for special functions provided by _direnv_. +use asdf + +# Python virtual env +layout python3 + +if (($(echo $(direnv_layout_dir)/python* | wc --words) > 1)); then + log_error "Found several python environments" + du -sh .direnv/* +fi diff --git a/bin/.tool-versions b/bin/.tool-versions new file mode 100644 index 0000000..410ae73 --- /dev/null +++ b/bin/.tool-versions @@ -0,0 +1,2 @@ +python 3.11.8 +direnv 2.33.0 diff --git a/bin/requirements.txt b/bin/requirements.txt new file mode 100644 index 0000000..5f7884c --- /dev/null +++ b/bin/requirements.txt @@ -0,0 +1,21 @@ +lastversion==3.5.0 + +appdirs==1.4.4 +beautifulsoup4==4.12.3 +CacheControl==0.12.11 +certifi==2024.2.2 +charset-normalizer==3.3.2 +distro==1.9.0 +feedparser==6.0.11 +idna==3.6 +lockfile==0.12.2 +msgpack==1.0.7 +packaging==23.2 +python-dateutil==2.8.2 +PyYAML==6.0.1 +requests==2.31.0 +sgmllib3k==1.0.0 +six==1.16.0 +soupsieve==2.5 +tqdm==4.66.2 +urllib3==1.26.18 diff --git a/bin/versions_check b/bin/versions_check new file mode 100755 index 0000000..f73ca5e --- /dev/null +++ b/bin/versions_check @@ -0,0 +1,58 @@ +#!/bin/zsh +# + +# asdf, direnv, python & lastversion +# +# - https://github.com/dvershinin/lastversion +# +cd $(dirname $0) +eval $(asdf exec direnv export zsh) + +# zsh colors +# +autoload colors && colors + + +machine=amd64 + +function debian +{ + program=$1 + repository=$2 + + echo -n "${bg[green]}${fg[black]}\n>>>> ${program}${reset_color}\n\n" + + # TODO debian package + + if (( ${+commands[$program]} )); then + + ${program} --version + \ls -lh =${program} + + current_version=$(lastversion format "$(${program} --version)") + last_version=$(lastversion ${repository} --newer-than ${current_version}) + + if [[ $? -eq 0 ]]; then + echo -n ${repository}/releases + echo "${fg[cyan]}" + lastversion ${repository} --filter="${machine}\.deb" --assets + + else + echo "\n${fg[green]}up to date." + fi + + else + echo "${fg[yellow]}...not found.\n" + + echo -n "${fg[cyan]}" + lastversion ${repository} --filter="${machine}\.deb" --assets + fi + + echo -n ${reset_color} +} + +### + +debian bat "https://github.com/sharkdp/bat" +debian delta "https://github.com/dandavison/delta" +debian lsd "https://github.com/lsd-rs/lsd"