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.
- Install git
- Setup WSL
mkdir -p $HOME/.config
(otherwise,.config
is a symlink to$HOME/dotfiles/.config
).- Install zsh and zi
- Install stow, run
stow .
- Install tmux
- difference python pip install <> vs python -m pip install <> https://stackoverflow.com/questions/25749621/whats-the-difference-between-pip-install-and-python-m-pip-install
- https://thelinuxcode.com/python-requirements-txt-file/
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.
apt install xclip
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
Update GuestAdditions after updating VirtualBox via https://help.ubuntu.com/community/VirtualBox/GuestAdditions.
sudo apt-get install virtualbox-guest-additions-iso
- Install nerd font
- on Linux via curl https://github.com/ryanoasis/nerd-fonts?tab=readme-ov-file#option-1-release-archive-download.
- on Windows via downloading zip archive and using Settings -> fonts (move font files into dotted square)
- Install alacritty for Windows.
- Move alacritty.wsl.toml to
%APPDATA%\alacritty
. - map capslock to ctrl: https://superuser.com/questions/949385/map-capslock-to-control-in-windows-10.
- Alternatively, use MS PowerToys to map Ctrl-M as Enter as well. Cannot map Ctrl-J to down (Ctrl-K up, Ctrl-C Esc) because that conflicts with either Linux or Windows shortcuts. In MS PowerToys dashboard, deactivate all other modules that are not needed.
- notifications: https://github.com/Windos/BurntToast, call with
notify-send() { powershell.exe -command New-BurntToastNotification "-Text '${@}'"; }
. Further reading https://stuartleeks.com/posts/wsl-github-cli-windows-notifications-part-1/ and microsoft/WSL#2466.
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.
- https://registerspill.thorstenball.com/p/how-fast-is-your-shell
- https://github.com/unixorn/awesome-zsh-plugins
- https://github.com/bew/dotfiles/tree/main/zsh
- https://github.com/HaleTom/dotfiles/blob/main/zsh/.config/zsh/.zshrc
- https://github.com/mattmc3/zdotdir
- https://github.com/doronbehar/dotfiles/blob/master/.zshrc
- https://github.com/ctrueden/dotfiles/blob/main/zshrc
- https://github.com/itchyny/dotfiles/blob/main/.zshrc
- https://github.com/timtyrrell/dotfiles-chezmoi/blob/master/dot_zshrc
- https://github.com/Freed-Wu/Freed-Wu/blob/main/.zshrc
- https://github.com/kutsan/dotfiles/blob/master/.config/zsh/config/settings.zsh
- https://git.sr.ht/~seirdy/dotfiles/tree/master/.config/shell_common/zsh/zinit.zsh
- https://github.com/callistachang/dots/blob/main/dot_zshrc
- https://github.com/casey/dotfiles/blob/master/etc/zshrc
- https://github.com/agkozak/
- https://github.com/seagle0128/dotfiles/blob/master/.zshrc
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/
- https://mywiki.wooledge.org/BashFAQ
- https://mywiki.wooledge.org/BashGuide
- https://mywiki.wooledge.org/BashPitfalls
- https://www.gnu.org/software/bash//manual/html_node/The-Shopt-Builtin.html
- https://quickref.me/bash
- https://devhints.io/bash
- https://github.com/gitleaks/gitleaks Protect and discover secrets using Gitleaks 🔑
- https://github.com/stevearc/dotfiles/blob/master/.githelpers
- https://github.com/mathiasbynens/dotfiles/blob/main/.gitconfig
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
https://github.com/alacritty/alacritty/blob/master/INSTALL.md
cargo build --release
Windows: download executable
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:
- https://github.com/sunaku/home/blob/master/.tmux.conf.erb
- https://github.com/doronbehar/.tmux/tree/master
- https://gist.github.com/adibhanna/979461c5f7d906daf24925fbd9b255eb
- https://github.com/mrnugget/dotfiles/blob/master/tmux.conf
Search rust book via cli:
https://github.com/0xhiro/thebook
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
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
-
https://github.com/wagoodman analyze image size, vulnerabilities and more
-
https://github.com/kkvh/vim-docker-tools Toolkit for managing docker containers, networks and images in vim.
-
https://github.com/lmapii/cproject Example for a C environment with CMake, Docker, Unity, and GitHub Actions.
-
https://github.com/philips-software/amp-devcontainer/tree/main/.devcontainer/cpp
-
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
-
https://www.youtube.com/playlist?list=PLrU0uga7kmr0dsc3wWS4TS9mRX0Ue7kn Vim Universe Playlist
-
https://swedishembedded.com/developers/vim-in-minutes Awesome Vim: Modern Guide To A Fully Featured Vim IDE
-
http://vimcasts.org/episodes/search-multiple-files-with-vimgrep/
Important infos about editing .vimrc: https://vi.stackexchange.com/a/7723/30978
- https://github.com/sunaku/.vim/tree/master
- https://github.com/mrnugget/vimconfig/tree/master
- https://github.com/itchyny/dotfiles/blob/main/.vimrc
- https://github.com/mischavandenburg/dotfiles/blob/main/vim/.vimrc
- https://github.com/doronbehar/.config_nvim/tree/master
- https://github.com/habamax/.vim/blob/master/vimrc (vim maintainer)
- https://github.com/mrnugget/vimconfig/blob/master/vimrc
- https://github.com/skywind3000/vim/blob/master/init/unix.vim
- https://github.com/trapd00r/configs/blob/master/vim/vimrc
- https://github.com/suy/configs/blob/master/vimrc
- https://github.com/rhysd/dogfiles/blob/master/vimrc
- https://github.com/fannheyward/init.vim/blob/master/coc-settings.json
- https://github.com/fannheyward/init.vim/blob/master/init.vim
apt install luaX.X libluaX.X-dev luajit
./configure --enable-luainterp=yes
- https://github.com/stepchowfun/toast Containerize your development and continuous integration environments. 🥂
- https://www.docker.com/blog/how-to-setup-your-local-node-js-development-environment-using-docker/
- https://stackoverflow.com/questions/51809181/how-to-run-tmux-inside-a-docker-container
- https://wiki.zshell.dev/ecosystem/packages/usage#statically-linked-hermetic-relocatable-zsh
Login to dev container via ssh; install zsh and copy dotfiles https://github.com/dpetersen/dev-container-base
- https://gitlab.com/smoores/open-devcontainer
- https://stackoverflow.com/questions/72397020/containerizing-vim-with-plugins
- https://github.com/nemanjan00/dev-environment
- https://github.com/esensar/nvim-dev-container
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
volta install bash-language-server
VimL linter https://github.com/Vimjas/vint
https://github.com/hadolint/hadolint
compiler warnings
-
https://github.com/stephenberry/glaze Extremely fast, in memory, JSON and interface library for modern C++
-
https://github.com/HappyCerberus/daily-bite-cpp (especially Modern-only C++ Course) Playlist: Modern C++ Series - Mike Shah
playground HU print chunks 0001'0203'...'0e0f
Reduce execution times of unit tests:
- run CTest in parallel
ctest -j$(nproc)
- use
gtest_add_tests
from https://cmake.org/cmake/help/latest/module/GoogleTest.html - this executes a list of all test cases instead of test executables, which is much faster
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
- https://github.com/madduci/moderncpp-project-template A Modern C++ cross-platform Project Template with CMake, conan (optional), cppcheck (optional) and clang-format (optional)
- https://github.com/filipdutescu/modern-cpp-template A template for modern C++ projects using CMake, Clang-Format, CI, unit testing and more, with support for downstream inclusion.
- https://github.com/TheLartians/Format.cmake Stylize your code! Automatic clang-format and cmake-format targets for CMake.
- https://github.com/intel/cicd-repo-infrastructure
- https://github.com/StableCoder/cmake-scripts
- https://github.com/cpp-best-practices/cmake_template
cmake4vim cmake-language-server
Determine the minimal required CMake version of a project: cmake_min_version
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
- update .vimrc with comments from https://github.com/nvim-zh/minimal_vim/blob/master/init.vim
- Read series https://jdhao.github.io/2019/03/28/nifty_nvim_techniques_s1/#how-do-we-select-the-current-line-but-not-including-the-newline-character
https://sourceware.org/gdb/current/onlinedocs/gdb.html/index.html
:packadd termdebug
:Termdebug " help Termdebug, :Arguments <args, eg. --gtest_filter=<unquoted regex>
- https://jotavare.github.io/gdb_cheatsheet/
- https://github.com/sharkdp/dbg-macro A dbg(…) macro for C++
- Replace .gdbinit with https://github.com/pwndbg/pwndbg Exploit Development and Reverse Engineering with GDB Made Easy
- https://developers.redhat.com/articles/2021/10/05/printf-style-debugging-using-gdb-part-1#
- https://developers.redhat.com/articles/2021/10/13/printf-style-debugging-using-gdb-part-2#
- https://github.com/mg979/tasks.vim rewrite of asynctasks
- https://github.com/skywind3000/asynctasks.vim
- https://github.com/albertomontesg/lightline-asyncrun
- https://github.com/deathmaz/fzf-lua-asynctasks (neovim)
- https://github.com/voldikss/vim-floaterm#asynctasksvim--asyncrunvim
- https://github.com/skywind3000/vim-terminal-help#integration
- https://github.com/voldikss/coc-extensions/tree/main/packages/coc-tasks
- https://github.com/EthanJWright/vs-tasks.nvim
- https://github.com/yous/dotfiles
- https://github.com/sunaku/home
- https://sunaku.github.io/about.html
- https://github.com/ibhagwan/dots
- https://github.com/hamvocke/dotfiles
- I use stow.
- Manage dotfiles and any git directories interactively with fzf https://github.com/kazhala/dotbare
- https://dotfiles.github.io/
- https://github.com/rhysd/dotfiles
CC="clang" CXX="clang++" LDFLAGS="{LDFLAGS} -fuse-ld=mold" cmake ...
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
-
https://www.youtube.com/watch?v=stqUbv-5u2s TJ De Vries Effective Neovim: Instant IDE
-
https://codevion.github.io/#!vim/cpp2.md: (Neo)vim for C++ Part 2: CMake, GTest, File Explorer, etc
:mktridactylrc => saves settings to rc (location see below)
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' })
- https://zealdocs.org/
- https://cukic.co/2022/04/02/fuzzy-search-documentation/
- https://gitlab.com/ivan-cukic/zeal-lynx-cli
- https://www.ssp.sh/blog/obsidian-note-taking-workflow/
- https://www.ssp.sh/brain/
- https://www.ssp.sh/blog/pkm-workflow-for-a-deeper-life/