From 286f0596c6d3296c902a626b0ba6764bcae9afe0 Mon Sep 17 00:00:00 2001 From: wcbing Date: Wed, 9 Apr 2025 12:25:15 +0800 Subject: [PATCH] reinit --- aliases/container.sh | 7 +++++++ aliases/main.sh | 21 +++++++++++++++++++++ aliases/proxy.sh | 6 ++++++ aliases/python.sh | 7 +++++++ bash/.bashrc | 24 ++++++++++++++++++++++++ fish/config.fish | 13 +++++++++++++ run.sh | 16 ++++++++++++++++ tmux/tmux.conf | 11 +++++++++++ vim/vimrc | 43 +++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 148 insertions(+) create mode 100644 aliases/container.sh create mode 100644 aliases/main.sh create mode 100644 aliases/proxy.sh create mode 100644 aliases/python.sh create mode 100644 bash/.bashrc create mode 100644 fish/config.fish create mode 100755 run.sh create mode 100644 tmux/tmux.conf create mode 100644 vim/vimrc diff --git a/aliases/container.sh b/aliases/container.sh new file mode 100644 index 0000000..7eb8f0b --- /dev/null +++ b/aliases/container.sh @@ -0,0 +1,7 @@ +alias c=podman +alias crt="c run -it --rm" # container run temporarily +alias ce="c exec -it" # container exec +#alias nginx="c exec nginx nginx" + +# alias lzd="DOCKER_HOST=unix:///run/podman/podman.sock lazydocker" +alias lzd="DOCKER_HOST=unix:///run/user/1000/podman/podman.sock lazydocker" \ No newline at end of file diff --git a/aliases/main.sh b/aliases/main.sh new file mode 100644 index 0000000..f56526b --- /dev/null +++ b/aliases/main.sh @@ -0,0 +1,21 @@ +# List file +alias l="ls -a" +alias la="ls -a" +alias ll="ls -lh" +alias lla="ls -alh" + +# Directory and File +alias mkdir="mkdir -pv" +alias rm="rm -rv" +alias mv="mv -v" +alias cp="cp -rv" + +# Human Readable +alias free="free -h" +alias du="du -h" +alias df="df -hT" # T: show filesystem type +alias dfo="df | grep -v tmpfs" + +# Systemctl +alias sctl="systemctl" +alias ssctl="sudo systemctl" diff --git a/aliases/proxy.sh b/aliases/proxy.sh new file mode 100644 index 0000000..237964b --- /dev/null +++ b/aliases/proxy.sh @@ -0,0 +1,6 @@ +alias setproxy="export http_proxy=http://127.0.0.1:7890 https_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890" +alias unsetproxy="set -e http_proxy https_proxy all_proxy" + +# The following alias is for bash or zsh +[ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] && \ +alias unsetproxy="unset http_proxy https_proxy all_proxy" \ No newline at end of file diff --git a/aliases/python.sh b/aliases/python.sh new file mode 100644 index 0000000..8566ed9 --- /dev/null +++ b/aliases/python.sh @@ -0,0 +1,7 @@ +# Python venv +alias newvenv="python -m venv .venv" +alias actvenv=". .venv/bin/activate.fish" + +# The following alias is for bash or zsh +[ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] && \ +alias actvenv=". .venv/bin/activate" \ No newline at end of file diff --git a/bash/.bashrc b/bash/.bashrc new file mode 100644 index 0000000..050ca50 --- /dev/null +++ b/bash/.bashrc @@ -0,0 +1,24 @@ +PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\w\[\033[00m\]\$ ' + +# enable bash completion in interactive non-login shell +if [ "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + fi +fi + +# colorful for bash +alias ls="ls -F --color=auto" +alias grep="grep --color=auto" + +Profile_PATH=$HOME/My/profiles +for i in $(ls $Profile_PATH/aliases); do + . $Profile_PATH/aliases/$i +done + +# PATH +PATH="$PATH:$HOME/bin/" +PATH="$PATH:$HOME/go/bin/" +PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts" + +export PATH diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..2cb1885 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,13 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +set fish_greeting "" + +set Profile_PATH $HOME/My/profiles +for i in $(ls $Profile_PATH/aliases/) + . $Profile_PATH/aliases/$i +end + +# PATH +set -U fish_user_paths $HOME/.local/bin $HOME/go/bin $HOME/.local/share/JetBrains/Toolbox/scripts diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..bcbffa6 --- /dev/null +++ b/run.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +echo "Warning: This will force overwrite your .bashrc and so on. +If you want to exit, please press Ctrl+C to exit. +Press the Enter to continue." +read _ + +sed -i "s#^Profile_PATH.*\$#Profile_PATH=$PWD#g" bash/.bashrc +sed -i "s#^set Profile_PATH .*\$#set Profile_PATH $PWD#g" fish/config.fish + +ln -sf $PWD/bash/.bashrc ~/.bashrc +mkdir -p ~/.config/fish && ln -sf $PWD/fish/config.fish ~/.config/fish/config.fish +mkdir -p ~/.config/tmux && ln -sf $PWD/tmux/tmux.conf ~/.config/tmux/tmux.conf +mkdir -p ~/.config/vim && ln -sf $PWD/vim/vimrc ~/.config/vim/vimrc + +echo "Finished" diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..3768d27 --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,11 @@ +set -g mouse +set -g set-clipboard on + +## Style of ststus window pane +## bg:background, fg:foreground +## ------------------------------ +set -g status-style fg='#777777' +set -g window-status-style bg=cyan +set -g window-status-current-style bg=green +# set -g pane-border-style fg=black +# set -g pane-active-border-style fg=red diff --git a/vim/vimrc b/vim/vimrc new file mode 100644 index 0000000..0add978 --- /dev/null +++ b/vim/vimrc @@ -0,0 +1,43 @@ +" You can use `:set all` to show all option. +" If you have questions about some option, you can use `:help