Add tech_docs/dotfiles.git.md
This commit is contained in:
189
tech_docs/dotfiles.git.md
Normal file
189
tech_docs/dotfiles.git.md
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
Remember to save these files and reload the configurations for the changes to take effect:
|
||||||
|
- For `~/.bashrc`: `source ~/.bashrc`
|
||||||
|
- For `~/.tmux.conf`: `tmux source-file ~/.tmux.conf`
|
||||||
|
- For `~/.wezterm.lua`: Restart Wezterm
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
1. `~/.bashrc`:
|
||||||
|
```bash
|
||||||
|
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||||
|
|
||||||
|
# If not running interactively, don't do anything
|
||||||
|
case $- in
|
||||||
|
*i*) ;;
|
||||||
|
*) return;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Append to the history file, don't overwrite it
|
||||||
|
shopt -s histappend
|
||||||
|
|
||||||
|
# Check the window size after each command and, if necessary,
|
||||||
|
# update the values of LINES and COLUMNS.
|
||||||
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
# Enable color support of ls
|
||||||
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Custom keybindings
|
||||||
|
bind '"\C-a": beginning-of-line'
|
||||||
|
bind '"\C-e": end-of-line'
|
||||||
|
bind '"\eb": backward-word'
|
||||||
|
bind '"\ef": forward-word'
|
||||||
|
bind '"\C-w": backward-kill-word'
|
||||||
|
bind '"\C-u": backward-kill-line'
|
||||||
|
bind '"\C-k": kill-line'
|
||||||
|
|
||||||
|
# Alias definitions
|
||||||
|
if [ -f ~/.bash_aliases ]; then
|
||||||
|
. ~/.bash_aliases
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable programmable completion features
|
||||||
|
if ! shopt -oq posix; then
|
||||||
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||||
|
. /usr/share/bash-completion/bash_completion
|
||||||
|
elif [ -f /etc/bash_completion ]; then
|
||||||
|
. /etc/bash_completion
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# >>> conda initialize >>>
|
||||||
|
# !! Contents within this block are managed by 'conda init' !!
|
||||||
|
__conda_setup="$('/home/medusa/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
eval "$__conda_setup"
|
||||||
|
else
|
||||||
|
if [ -f "/home/medusa/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||||
|
. "/home/medusa/miniconda3/etc/profile.d/conda.sh"
|
||||||
|
else
|
||||||
|
export PATH="/home/medusa/miniconda3/bin:$PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset __conda_setup
|
||||||
|
# <<< conda initialize <<<
|
||||||
|
|
||||||
|
# Launch tmux automatically when Wezterm is started
|
||||||
|
if [[ -n "$WEZTERM_PID" ]] && [[ -z "$TMUX" ]]; then
|
||||||
|
# Generate a unique session name based on the current directory
|
||||||
|
session_name="$(basename "$(pwd)")"
|
||||||
|
tmux new-session -A -s "$session_name"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
2. `~/.tmux.conf`:
|
||||||
|
```tmux
|
||||||
|
# Set the default terminal mode to 256color
|
||||||
|
set -g default-terminal "screen-256color"
|
||||||
|
set -ga terminal-overrides ",xterm-256color:Tc"
|
||||||
|
|
||||||
|
# Enable mouse support
|
||||||
|
set -g mouse on
|
||||||
|
|
||||||
|
# Set the prefix key to Ctrl+b
|
||||||
|
set -g prefix C-b
|
||||||
|
unbind C-a
|
||||||
|
bind C-b send-prefix
|
||||||
|
|
||||||
|
# Pane navigation
|
||||||
|
bind h select-pane -L
|
||||||
|
bind j select-pane -D
|
||||||
|
bind k select-pane -U
|
||||||
|
bind l select-pane -R
|
||||||
|
|
||||||
|
# Pane resizing
|
||||||
|
bind H resize-pane -L 5
|
||||||
|
bind J resize-pane -D 5
|
||||||
|
bind K resize-pane -U 5
|
||||||
|
bind L resize-pane -R 5
|
||||||
|
|
||||||
|
# Window management
|
||||||
|
bind c new-window
|
||||||
|
bind n next-window
|
||||||
|
bind p previous-window
|
||||||
|
bind w choose-window
|
||||||
|
|
||||||
|
# Session management
|
||||||
|
bind s choose-session
|
||||||
|
bind d detach-client
|
||||||
|
|
||||||
|
# Reload configuration
|
||||||
|
bind r source-file ~/.tmux.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
3. `~/.wezterm.lua`:
|
||||||
|
```lua
|
||||||
|
-- Pull in the wezterm API
|
||||||
|
local wezterm = require 'wezterm'
|
||||||
|
|
||||||
|
-- This will hold the configuration
|
||||||
|
local config = wezterm.config_builder()
|
||||||
|
|
||||||
|
-- Set the color scheme
|
||||||
|
config.color_scheme = 'AdventureTime'
|
||||||
|
|
||||||
|
-- Increase the font size
|
||||||
|
config.font_size = 12
|
||||||
|
|
||||||
|
-- Enable true color support
|
||||||
|
config.set_environment_variables = {
|
||||||
|
COLORTERM = "truecolor",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Return the configuration to wezterm
|
||||||
|
return config
|
||||||
|
```
|
||||||
|
|
||||||
|
And here's the content of `~/.bash_aliases`:
|
||||||
|
```bash
|
||||||
|
# Directory navigation
|
||||||
|
alias ..='cd ..'
|
||||||
|
alias ...='cd ../..'
|
||||||
|
alias ....='cd ../../..'
|
||||||
|
alias ~='cd ~'
|
||||||
|
|
||||||
|
# Listing files and directories
|
||||||
|
alias l='ls -CF'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias ll='ls -alF'
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
|
||||||
|
# Directory management
|
||||||
|
alias md='mkdir -p'
|
||||||
|
alias rd='rmdir'
|
||||||
|
|
||||||
|
# File management
|
||||||
|
alias cp='cp -i'
|
||||||
|
alias mv='mv -i'
|
||||||
|
alias rm='rm -i'
|
||||||
|
|
||||||
|
# System information
|
||||||
|
alias df='df -h'
|
||||||
|
alias du='du -h'
|
||||||
|
alias free='free -m'
|
||||||
|
alias ps='ps auxf'
|
||||||
|
|
||||||
|
# Network utilities
|
||||||
|
alias ping='ping -c 5'
|
||||||
|
alias fastping='ping -c 100 -s.2'
|
||||||
|
alias ports='netstat -tulanp'
|
||||||
|
|
||||||
|
# Git aliases
|
||||||
|
alias gs='git status'
|
||||||
|
alias gd='git diff'
|
||||||
|
alias ga='git add'
|
||||||
|
alias gc='git commit'
|
||||||
|
alias gp='git push'
|
||||||
|
alias gl='git log --oneline'
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias h='history'
|
||||||
|
alias j='jobs -l'
|
||||||
|
alias path='echo -e ${PATH//:/\\n}'
|
||||||
|
```
|
||||||
|
|
||||||
|
These configurations include all the updates we discussed, such as custom keybindings, aliases, tmux settings, and Wezterm configuration. Unnecessary parts have been removed to keep the configurations clean and concise.
|
||||||
Reference in New Issue
Block a user