Skip to content

meinzer1899/dotfiles

Repository files navigation

dotfiles

My Linux dotfiles.

â–¶ zsh-bench
==> benchmarking login shell of user meinzer1899...
creates_tty=0
has_compsys=0
has_syntax_highlighting=0
has_autosuggestions=0
has_git_prompt=0
first_prompt_lag_ms=26.536
first_command_lag_ms=115.626
command_lag_ms=2.363
input_lag_ms=4.038
exit_time_ms=101.818

Although showing 0 for has_syntax_highlighting, has_git_prompt, has_autosuggestions, has_compsys, these are enabled.

Work Environment

Setup new machine

  1. Install git
  2. Setup WSL
  3. mkdir -p $HOME/.config (otherwise, .config is a symlink to $HOME/dotfiles/.config).
  4. Install zsh and zi
  5. Install stow, run stow .
  6. Install tmux

pip

apt install python3.XX-venv # (e.g. 10)

Don't upgrade system to use other python version than that available in apt. Can cause other commands (e.g. apt-get) to break.

clipboard

apt install xclip

Remap CAPSLOCK to ctrl

https://askubuntu.com/questions/33774/how-do-i-remap-the-caps-lock-and-ctrl-keys#comment1154797_521734 sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps" setxkbmap -option ctrl:nocaps

https://superuser.com/questions/949385/map-capslock-to-control-in-windows-10

VirtualBox

Update GuestAdditions after updating VirtualBox via https://help.ubuntu.com/community/VirtualBox/GuestAdditions.

sudo apt-get install virtualbox-guest-additions-iso

wsl

zsh and zi

https://github.com/zsh-users/zsh/blob/master/INSTALL

$ZPFX: https://wiki.zshell.dev/docs/guides/customization#ZPFX

Install zsh to $HOME/.zi/polaris, where no sudo is needed.

mkdir -p $HOME/.zi/polaris
./configure --prefix=$HOME/.zi/polaris

zi loader is included in dotfiles (.config/zi); if not, see https://wiki.zshell.dev/docs/getting_started/installation => loader.

misc

zshrcs

bash

https://mywiki.wooledge.org/BashPitfalls https://mywiki.wooledge.org/BashPitfalls#set_-euo_pipefail recommends against set -e because of the various pitfalls especially in conditional evaluation and option pipefail and recommends own error handling instead. http://redsymbol.net/articles/unofficial-bash-strict-mode/ and http://redsymbol.net/articles/unofficial-bash-strict-mode/#short-circuiting

set -euo pipefail; shopt -s failglob # safe mode

To release resources, use bash exit traps. http://redsymbol.net/articles/bash-exit-traps/

git

For Ubuntu, this PPA provides the latest stable upstream Git version: https://git-scm.com/download/linux.

Add .gitconfig.local for user private global entries https://git-scm.com/docs/user-manual.html#telling-git-your-name

Add ssh key so that you can push to dotfiles repository with correct user.

In dotfiles repository, change local email to noreply email from Github (preferences, email) https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address#setting-your-email-address-for-a-single-repository

ssh keys: ~/.ssh/config specify, which key belongs to which host (https://stackoverflow.com/a/69764024)

🦎 Githooks: per-repo and shared Git hooks with version control and auto update. interactive git with the help of fzf Protect and discover secrets using Gitleaks 🔑 Command-line Git information tool

alacritty

https://github.com/alacritty/alacritty/blob/master/INSTALL.md

cargo build --release

Windows: download executable

TMUX

https://github.com/tmux/tmux/wiki/Installing#from-version-control

sh autogen.sh
./configure
make -j$(nproc) && sudo make install

tmux new -s tmux

.tmux.conf:

cargo and rust

Search rust book via cli:

https://github.com/0xhiro/thebook

fzf

To auto-accept entry on Enter when searching with CTRL-R, use junegunn/fzf#477 (comment)

Vim Integration: https://github.com/junegunn/fzf/blob/master/README-VIM.md

docker

https://stackoverflow.com/questions/45023363/what-is-docker-io-in-relation-to-docker-ce-and-docker-ee-now-called-mirantis-k https://docs.docker.com/engine/install/ubuntu

    docker run --detach -v $(pwd):$(pwd) -w $(pwd) --name <name> image:tag sleep infinity # may does not work, if ENTRYPOINT is set in Dockerfile
    docker start <name> # if container with that name already exists
    docker exec <name> command # execute command, e.g. via vim-dispatch
    docker exec -it <name> /bin/bash # attach interactively
    docker stop name # to stop

vim

Important infos about editing .vimrc: https://vi.stackexchange.com/a/7723/30978

vimrcs

lua support

apt install luaX.X libluaX.X-dev luajit
./configure --enable-luainterp=yes

devcontainer

Login to dev container via ssh; install zsh and copy dotfiles https://github.com/dpetersen/dev-container-base

linter

https://github.com/caramelomartins/awesome-linters

https://github.com/iamcco/diagnostic-languageserver/wiki/Linters All of them are configured via coc-diagnostic. Activate them by mapping the linter to the desired filetype in coc-settings.json. https://github.com/iamcco/coc-diagnostic/blob/master/src/config.ts

bash-language-server

volta install bash-language-server

vint

VimL linter https://github.com/Vimjas/vint

hadolint (Dockerfile linter)

https://github.com/hadolint/hadolint

C++ cpp

compiler warnings

playground HU print chunks 0001'0203'...'0e0f

ccls languageserver

Reduce execution times of unit tests:

CMake

Use install-cmake.sh from foonathan to install to /usr/local. May remove "old" cmake versions, check via which -a cmake.

https://blog.feabhas.com/category/build-systems/ with https://github.com/feabhas/cmake-presets-blog

misc

cmake4vim cmake-language-server

Determine the minimal required CMake version of a project: cmake_min_version

Optimization, performance, profiling

llvm, clang, clangd

https://github.com/google/sanitizers/wiki/AddressSanitizerFlags

message(STATUS "Address sanitizer enabled")
add_compile_options(-fsanitize=address,undefined)
add_compile_options(-fno-sanitize=signed-integer-overflow)
add_compile_options(-fno-sanitize-recover=all)
add_compile_options(-fno-omit-frame-pointer)
add_link_options(-fsanitize=address,undefined -fuse-ld=gold)

Installation description: https://apt.llvm.org/ -> Automatic installation script installs all llvm packages (also clangd, clang-tidy, include-cleaner etc) at /bin. Also adds apt.llvm.org to apt package list to automatically get updates.

Need to update alternatives for llvm tools, e.g. clang-format, clangd, clang-tidy, lld.

sudo update-alternatives --install /bin/clang-format clang-format /bin/clang-format-17 20

Cache for clang-tidy static analysis results: https://github.com/matus-chochlik/ctcache/tree/main

https://stackoverflow.com/questions/51582604/how-to-use-cpplint-code-style-checking-with-cmake

https://github.com/lmapii/run-clang-tidy

https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm

GDB

https://sourceware.org/gdb/current/onlinedocs/gdb.html/index.html

:packadd termdebug
:Termdebug " help Termdebug, :Arguments <args, eg. --gtest_filter=<unquoted regex>

asynctask

dotfiles management

mold

CC="clang" CXX="clang++" LDFLAGS="{LDFLAGS} -fuse-ld=mold" cmake ...

neovim nvim

The Laziest Neovim (NeovimConf 2023) | Speed Up Neovim Neovim for Newbs. FREE COURSE The Only Video You Need to Get Started with Neovim The perfect Neovim setup for C++ C++ Coding with Neovim - Prateek Raman - CppCon 2022 Neovim for C++: https://www.youtube.com/watch?v=lsFoZIg-oDs

https://github.com/kristijanhusak/neovim-config

Use FZF instead of telescope

Tridactyl

:mktridactylrc => saves settings to rc (location see below)

location of tridactylrc

other

https://hackingcpp.com/dev/command_line_tools.html

https://github.com/tummychow/git-absorb

https://github.com/jarun/ddgr with https://github.com/tats/w3m/blob/master/doc/README

Whiteboards with https://tldraw.dev/. https://github.com/casey/just https://github.com/NoahTheDuke/vim-just (Plug 'NoahTheDuke/vim-just', { 'for': 'just' })

offline documentation

Second Brain, PKM, Personal Knowledge Management, Obsidian

Learnings Notes

Resources

Code Review

Commits

Planning, Estimating

Testing