From a1c9d4d8706a3dc397c4867d0fac17c77e083226 Mon Sep 17 00:00:00 2001 From: wcbing Date: Tue, 6 Aug 2024 20:38:43 +0800 Subject: [PATCH] reinit --- bash/.bashrc | 34 +++++++++++++++++++++ fish/.config/fish/config.fish | 28 ++++++++++++++++++ profiles/bash/.bashrc | 34 +++++++++++++++++++++ profiles/fish/.config/fish/config.fish | 28 ++++++++++++++++++ profiles/run-ln.sh | 16 ++++++++++ profiles/run.sh | 3 ++ profiles/shell/aliases | 37 +++++++++++++++++++++++ profiles/shell/pacman | 10 +++++++ profiles/shell/pkg | 13 ++++++++ profiles/tmux/.tmux.conf | 12 ++++++++ profiles/vim/.vimrc | 41 ++++++++++++++++++++++++++ run-ln.sh | 15 ++++++++++ run.sh | 3 ++ shell/aliases | 37 +++++++++++++++++++++++ shell/pacman | 10 +++++++ shell/pkg | 13 ++++++++ tmux/.tmux.conf | 12 ++++++++ vim/.vimrc | 41 ++++++++++++++++++++++++++ 18 files changed, 387 insertions(+) create mode 100644 bash/.bashrc create mode 100644 fish/.config/fish/config.fish create mode 100644 profiles/bash/.bashrc create mode 100644 profiles/fish/.config/fish/config.fish create mode 100755 profiles/run-ln.sh create mode 100755 profiles/run.sh create mode 100644 profiles/shell/aliases create mode 100644 profiles/shell/pacman create mode 100755 profiles/shell/pkg create mode 100644 profiles/tmux/.tmux.conf create mode 100644 profiles/vim/.vimrc create mode 100755 run-ln.sh create mode 100755 run.sh create mode 100644 shell/aliases create mode 100644 shell/pacman create mode 100755 shell/pkg create mode 100644 tmux/.tmux.conf create mode 100644 vim/.vimrc diff --git a/bash/.bashrc b/bash/.bashrc new file mode 100644 index 0000000..7017759 --- /dev/null +++ b/bash/.bashrc @@ -0,0 +1,34 @@ +PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\w\[\033[00m\]\$ ' +#PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + +# enable bash completion in interactive shells +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 + +Profile_PATH=~/profiles +if [ -f $Profile_PATH/shell/aliases ]; then + . $Profile_PATH/shell/aliases +fi + +# Python venv +# ---------------------------- +alias newvenv="python -m venv .venv" +alias actvenv=". .venv/bin/activate" + +# Proxy +# ---------------------------- +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="unset http_proxy https_proxy all_proxy" + +# PATH +# ---------------------------- +PATH="$PATH:~/My/apps/" +PATH="$PATH:~/node_modules/.bin/" +PATH="$PATH:~/.local/share/JetBrains/Toolbox/scripts" + +export PATH \ No newline at end of file diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish new file mode 100644 index 0000000..4cfb2e6 --- /dev/null +++ b/fish/.config/fish/config.fish @@ -0,0 +1,28 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +set fish_greeting "" + +set Profile_PATH ~/profiles +if test -e $Profile_PATH/shell/aliases + . $Profile_PATH/shell/aliases +end + +# Python venv +# ---------------------------- +alias newvenv="python -m venv .venv" +alias actvenv=". .venv/bin/activate.fish" + +# Proxy +# ---------------------------- +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" + +# PATH +# ---------------------------- +set PATH $PATH ~/My/apps/ +set PATH $PATH ~/node_modules/.bin/ +set PATH $PATH ~/.local/share/JetBrains/Toolbox/scripts + +export PATH \ No newline at end of file diff --git a/profiles/bash/.bashrc b/profiles/bash/.bashrc new file mode 100644 index 0000000..7017759 --- /dev/null +++ b/profiles/bash/.bashrc @@ -0,0 +1,34 @@ +PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\w\[\033[00m\]\$ ' +#PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + +# enable bash completion in interactive shells +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 + +Profile_PATH=~/profiles +if [ -f $Profile_PATH/shell/aliases ]; then + . $Profile_PATH/shell/aliases +fi + +# Python venv +# ---------------------------- +alias newvenv="python -m venv .venv" +alias actvenv=". .venv/bin/activate" + +# Proxy +# ---------------------------- +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="unset http_proxy https_proxy all_proxy" + +# PATH +# ---------------------------- +PATH="$PATH:~/My/apps/" +PATH="$PATH:~/node_modules/.bin/" +PATH="$PATH:~/.local/share/JetBrains/Toolbox/scripts" + +export PATH \ No newline at end of file diff --git a/profiles/fish/.config/fish/config.fish b/profiles/fish/.config/fish/config.fish new file mode 100644 index 0000000..4cfb2e6 --- /dev/null +++ b/profiles/fish/.config/fish/config.fish @@ -0,0 +1,28 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +set fish_greeting "" + +set Profile_PATH ~/profiles +if test -e $Profile_PATH/shell/aliases + . $Profile_PATH/shell/aliases +end + +# Python venv +# ---------------------------- +alias newvenv="python -m venv .venv" +alias actvenv=". .venv/bin/activate.fish" + +# Proxy +# ---------------------------- +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" + +# PATH +# ---------------------------- +set PATH $PATH ~/My/apps/ +set PATH $PATH ~/node_modules/.bin/ +set PATH $PATH ~/.local/share/JetBrains/Toolbox/scripts + +export PATH \ No newline at end of file diff --git a/profiles/run-ln.sh b/profiles/run-ln.sh new file mode 100755 index 0000000..b42caa0 --- /dev/null +++ b/profiles/run-ln.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 _ + +cp -rf $PWD ~/profiles + +export Profile_PATH=~/profiles +ln -sf profiles/bash/.bashrc ~/.bashrc +ln -sf ../../profiles/fish/.config/fish/config.fish ~/.config/fish/config.fish +ln -sf profiles/vim/.vimrc ~/.vimrc +ln -sf profiles/tmux/.tmux.conf ~/.tmux.conf + +echo "Finished" \ No newline at end of file diff --git a/profiles/run.sh b/profiles/run.sh new file mode 100755 index 0000000..49fd07d --- /dev/null +++ b/profiles/run.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +stow tmux vim bash fish \ No newline at end of file diff --git a/profiles/shell/aliases b/profiles/shell/aliases new file mode 100644 index 0000000..6a1a291 --- /dev/null +++ b/profiles/shell/aliases @@ -0,0 +1,37 @@ +# colorful for bash +alias ls="ls -F --color=auto" +alias grep="grep --color=auto" + +# list file +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 df="df -h" +alias du="du -h" + +# Systemctl +alias sctl="systemctl" +alias ssctl="sudo systemctl" + +# Containers +#alias docker=podman +#alias nginx="docker exec nginx nginx" +alias debian="docker exec -it debian bash" +alias archlinux="docker exec -it arch bash" + +# Package Manager +## Change the package manager to your own, like apt/dnf/pacman, etc. +## If you not a root user, please use "sudo xxx". +export pkg="yay" + +#. $Profile_PATH/shell/pkg +. $Profile_PATH/shell/pacman \ No newline at end of file diff --git a/profiles/shell/pacman b/profiles/shell/pacman new file mode 100644 index 0000000..ebbddcd --- /dev/null +++ b/profiles/shell/pacman @@ -0,0 +1,10 @@ +# Shortcuts for pacman/yay/... + +alias search="$pkg -Ss" +alias show="$pkg -Si" +alias info="$pkg -Qi" +alias update="$pkg -Sy" +alias upgrade="$pkg -Syu" +alias install="$pkg -S" +alias remove="$pkg -Rncs" +alias autoremove="$pkg -Qtdq | $pkg -Rns -" diff --git a/profiles/shell/pkg b/profiles/shell/pkg new file mode 100755 index 0000000..9e02a17 --- /dev/null +++ b/profiles/shell/pkg @@ -0,0 +1,13 @@ +# Shortcuts for APT/DNF/... +## The "show" is APT only, DNF has "info" instead. +## APT has alias "info" for "show", although it's not mentioned. + +alias search="$pkg search" +alias list="$pkg list" +alias show="$pkg show" +alias info="$pkg info" +alias update="$pkg update" +alias upgrade="$pkg update && $pkg upgrade" +alias install="$pkg install" +alias remove="$pkg remove" +alias autoremove="$pkg autoremove" diff --git a/profiles/tmux/.tmux.conf b/profiles/tmux/.tmux.conf new file mode 100644 index 0000000..5a8dc01 --- /dev/null +++ b/profiles/tmux/.tmux.conf @@ -0,0 +1,12 @@ +set -g prefix M-z +unbind C-b +set -g mouse +set -g set-clipboard on + +## Style (bg:background, fg:foreground) +## ststus window pane +set -g status-style fg='#ffffff' +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/profiles/vim/.vimrc b/profiles/vim/.vimrc new file mode 100644 index 0000000..babad03 --- /dev/null +++ b/profiles/vim/.vimrc @@ -0,0 +1,41 @@ +" You can use `:set all` to show all option. +" If you have questions about some option, you can use `:help