mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 16:53:00 +00:00
Sync from Mac
This commit is contained in:
commit
16f47e3907
30 changed files with 861 additions and 769 deletions
1
.condarc
1
.condarc
|
|
@ -1 +0,0 @@
|
||||||
auto_activate_base: false
|
|
||||||
5
.config/conda/condarc.yaml
Normal file
5
.config/conda/condarc.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# ~/.config/conda/condarc.yaml
|
||||||
|
# New-Item -ItemType SymbolicLink -Path ~\.config\conda\.condarc -Target ~\.dotfiles\.config\conda\condarc.yaml
|
||||||
|
# mkdir -p ~/.config/conda/ && ln -s ~/.dotfiles/.config/conda/condarc.yaml ~/.config/conda/.condarc
|
||||||
|
# Reference: https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html
|
||||||
|
auto_activate_base: false
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -17,3 +17,4 @@ test.*
|
||||||
*.zip
|
*.zip
|
||||||
*.tgz
|
*.tgz
|
||||||
WindowsTerminal.json
|
WindowsTerminal.json
|
||||||
|
PowerToys/
|
||||||
5
.npmrc
5
.npmrc
|
|
@ -1 +1,4 @@
|
||||||
registry=https://registry.npmmirror.com
|
# ~/.npmrc
|
||||||
|
# New-Item -ItemType SymbolicLink -Path ~\.npmrc -Target ~\.dotfiles\.npmrc
|
||||||
|
# ln -s ~/.dotfiles/.npmrc ~/.npmrc
|
||||||
|
# registry=https://registry.npmmirror.com
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,24 @@
|
||||||
" Put this in OBSIDIAN_VAULT/.obsidian.vimrc
|
" Put this in OBSIDIAN_VAULT/.obsidian.vimrc
|
||||||
|
|
||||||
" Colemak 方向键映射 (hnei)
|
|
||||||
nnoremap k n
|
|
||||||
nnoremap K N
|
|
||||||
nnoremap j e
|
|
||||||
vnoremap j e
|
|
||||||
nnoremap l i
|
|
||||||
nnoremap N J
|
|
||||||
nnoremap E K
|
|
||||||
nnoremap I L
|
|
||||||
nnoremap J E
|
|
||||||
vnoremap J E
|
|
||||||
nnoremap L I
|
|
||||||
nnoremap k n
|
|
||||||
nnoremap K N
|
|
||||||
nnoremap j e
|
|
||||||
vnoremap j e
|
|
||||||
nnoremap l i
|
|
||||||
nnoremap N J
|
|
||||||
nnoremap E K
|
|
||||||
nnoremap I L
|
|
||||||
nnoremap J E
|
|
||||||
vnoremap J E
|
|
||||||
nnoremap L I
|
|
||||||
" 方向键映射
|
|
||||||
noremap n <Down> " 向下
|
|
||||||
noremap e <Up> " 向上
|
|
||||||
noremap i <Right> " 向右
|
|
||||||
|
|
||||||
|
|
||||||
""" Word wrap cursor movement
|
|
||||||
nmap j gj
|
|
||||||
nmap k gk
|
|
||||||
|
|
||||||
nmap Y y$ " Use Y to yank to the EOL
|
|
||||||
|
|
||||||
set clipboard=unnamed " Sync with System Clipboard
|
set clipboard=unnamed " Sync with System Clipboard
|
||||||
|
|
||||||
|
" Word wrap
|
||||||
|
noremap n gj
|
||||||
|
noremap e gk
|
||||||
|
noremap i l
|
||||||
|
|
||||||
|
" Similar position to i
|
||||||
|
noremap l i
|
||||||
|
noremap L I
|
||||||
|
" ne[k]st
|
||||||
|
noremap k n
|
||||||
|
noremap K N
|
||||||
|
" [j]ump
|
||||||
|
noremap j e
|
||||||
|
noremap J E
|
||||||
|
|
||||||
|
" Y to yank to end of line
|
||||||
|
noremap Y y$
|
||||||
|
|
||||||
""" Visual mode surrounding
|
""" Visual mode surrounding
|
||||||
exmap addbold obcommand editor:toogle-bold
|
exmap addbold obcommand editor:toogle-bold
|
||||||
exmap additalic obcommand editor:toogle-italic
|
exmap additalic obcommand editor:toogle-italic
|
||||||
|
|
@ -61,7 +43,7 @@ exmap vsplit obcommand workspace:split-vertical
|
||||||
exmap hsplit obcommand workspace:split-horizontal
|
exmap hsplit obcommand workspace:split-horizontal
|
||||||
map <Space>| :vsplit<CR>
|
map <Space>| :vsplit<CR>
|
||||||
map <Space>- :hsplit<CR>
|
map <Space>- :hsplit<CR>
|
||||||
map <Space>bd
|
" map <Space>bd
|
||||||
|
|
||||||
exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt
|
exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt
|
||||||
map <Space>ai :chat<CR>
|
map <Space>ai :chat<CR>
|
||||||
|
|
@ -69,6 +51,9 @@ map <Space>ai :chat<CR>
|
||||||
exmap omnisearch obcommand omnisearch:show-modal
|
exmap omnisearch obcommand omnisearch:show-modal
|
||||||
map <Space><Space> :omnisearch<CR>
|
map <Space><Space> :omnisearch<CR>
|
||||||
|
|
||||||
|
exmap command-palette obcommand command-palette:open
|
||||||
|
map <Space>: :command-palette<CR>
|
||||||
|
|
||||||
""" g-commands
|
""" g-commands
|
||||||
exmap tsource obcommand editor:toggle-source
|
exmap tsource obcommand editor:toggle-source
|
||||||
nnoremap gs :tsource<CR>
|
nnoremap gs :tsource<CR>
|
||||||
|
|
|
||||||
184
linux/.bashrc
184
linux/.bashrc
|
|
@ -1,184 +0,0 @@
|
||||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
|
||||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
|
||||||
# for examples
|
|
||||||
|
|
||||||
# If not running interactively, don't do anything
|
|
||||||
case $- in
|
|
||||||
*i*) ;;
|
|
||||||
*) return ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# don't put duplicate lines or lines starting with space in the history.
|
|
||||||
# See bash(1) for more options
|
|
||||||
HISTCONTROL=ignoreboth
|
|
||||||
|
|
||||||
# append to the history file, don't overwrite it
|
|
||||||
shopt -s histappend
|
|
||||||
|
|
||||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
|
||||||
HISTSIZE=1000
|
|
||||||
HISTFILESIZE=2000
|
|
||||||
|
|
||||||
# check the window size after each command and, if necessary,
|
|
||||||
# update the values of LINES and COLUMNS.
|
|
||||||
shopt -s checkwinsize
|
|
||||||
|
|
||||||
# If set, the pattern "**" used in a pathname expansion context will
|
|
||||||
# match all files and zero or more directories and subdirectories.
|
|
||||||
#shopt -s globstar
|
|
||||||
|
|
||||||
# make less more friendly for non-text input files, see lesspipe(1)
|
|
||||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
||||||
|
|
||||||
# set variable identifying the chroot you work in (used in the prompt below)
|
|
||||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
|
||||||
debian_chroot=$(cat /etc/debian_chroot)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
|
||||||
case "$TERM" in
|
|
||||||
xterm-color | *-256color) color_prompt=yes ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
|
||||||
# off by default to not distract the user: the focus in a terminal window
|
|
||||||
# should be on the output of commands, not on the prompt
|
|
||||||
#force_color_prompt=yes
|
|
||||||
|
|
||||||
if [ -n "$force_color_prompt" ]; then
|
|
||||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
|
||||||
# We have color support; assume it's compliant with Ecma-48
|
|
||||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
|
||||||
# a case would tend to support setf rather than setaf.)
|
|
||||||
color_prompt=yes
|
|
||||||
else
|
|
||||||
color_prompt=
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$color_prompt" = yes ]; then
|
|
||||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
|
||||||
else
|
|
||||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
|
||||||
fi
|
|
||||||
unset color_prompt force_color_prompt
|
|
||||||
|
|
||||||
# If this is an xterm set the title to user@host:dir
|
|
||||||
case "$TERM" in
|
|
||||||
xterm* | rxvt*)
|
|
||||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
|
||||||
;;
|
|
||||||
*) ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# enable color support of ls and also add handy aliases
|
|
||||||
if [ -x /usr/bin/dircolors ]; then
|
|
||||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
|
||||||
alias ls='ls --color=auto'
|
|
||||||
#alias dir='dir --color=auto'
|
|
||||||
#alias vdir='vdir --color=auto'
|
|
||||||
|
|
||||||
alias grep='grep --color=auto'
|
|
||||||
alias fgrep='fgrep --color=auto'
|
|
||||||
alias egrep='egrep --color=auto'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# colored GCC warnings and errors
|
|
||||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
|
||||||
|
|
||||||
# some more ls aliases
|
|
||||||
alias ll='ls -alF'
|
|
||||||
alias la='ls -A'
|
|
||||||
alias l='ls -CF'
|
|
||||||
|
|
||||||
# Add an "alert" alias for long running commands. Use like so:
|
|
||||||
# sleep 10; alert
|
|
||||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
|
||||||
|
|
||||||
# Alias definitions.
|
|
||||||
# You may want to put all your additions into a separate file like
|
|
||||||
# ~/.bash_aliases, instead of adding them here directly.
|
|
||||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
|
||||||
|
|
||||||
if [ -f ~/.bash_aliases ]; then
|
|
||||||
. ~/.bash_aliases
|
|
||||||
fi
|
|
||||||
|
|
||||||
# enable programmable completion features (you don't need to enable
|
|
||||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
|
||||||
# sources /etc/bash.bashrc).
|
|
||||||
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
|
|
||||||
|
|
||||||
. "$HOME/.cargo/env"
|
|
||||||
|
|
||||||
export PATH="/opt/nvim-linux64/bin:$PATH"
|
|
||||||
|
|
||||||
set -o vi
|
|
||||||
|
|
||||||
date
|
|
||||||
|
|
||||||
# >>> conda initialize >>>
|
|
||||||
# !! Contents within this block are managed by 'conda init' !!
|
|
||||||
__conda_setup="$('/home/citoyen/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
eval "$__conda_setup"
|
|
||||||
else
|
|
||||||
if [ -f "/home/citoyen/miniconda3/etc/profile.d/conda.sh" ]; then
|
|
||||||
. "/home/citoyen/miniconda3/etc/profile.d/conda.sh"
|
|
||||||
else
|
|
||||||
export PATH="/home/citoyen/miniconda3/bin:$PATH"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
unset __conda_setup
|
|
||||||
# <<< conda initialize <<<
|
|
||||||
|
|
||||||
|
|
||||||
alias g++='g++ -std=c++2b'
|
|
||||||
alias nvim=/opt/nvim-linux64/bin/nvim
|
|
||||||
alias python=python3
|
|
||||||
alias v=nvim
|
|
||||||
alias c=code
|
|
||||||
alias bashcfg="nvim ~/.bashrc"
|
|
||||||
alias zshcfg="nvim ~/.zshrc"
|
|
||||||
alias nvimrc="nvim ~/.config/nvim/"
|
|
||||||
|
|
||||||
set -o vi
|
|
||||||
|
|
||||||
mcd ()
|
|
||||||
{
|
|
||||||
mkdir -p -- "$1" && cd -P -- "$1"
|
|
||||||
}
|
|
||||||
cdls(){
|
|
||||||
cd $1
|
|
||||||
ls
|
|
||||||
}
|
|
||||||
wsp(){
|
|
||||||
cd /home/citoyen/WSLFdr/
|
|
||||||
ls
|
|
||||||
}
|
|
||||||
doku() {
|
|
||||||
cd ~/doku/ && ls
|
|
||||||
}
|
|
||||||
source ~/.private.env.sheval "$(/bin/brew shellenv)"
|
|
||||||
eval "$(/bin/brew shellenv)"
|
|
||||||
|
|
||||||
# >>> juliaup initialize >>>
|
|
||||||
|
|
||||||
# !! Contents within this block are managed by juliaup !!
|
|
||||||
|
|
||||||
case ":$PATH:" in
|
|
||||||
*:/home/js0ny/.juliaup/bin:*)
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
export PATH=/home/js0ny/.juliaup/bin${PATH:+:${PATH}}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# <<< juliaup initialize <<<
|
|
||||||
183
linux/.zshrc
183
linux/.zshrc
|
|
@ -1,183 +0,0 @@
|
||||||
### Variables ###
|
|
||||||
|
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
|
||||||
|
|
||||||
### ZSH Config ###
|
|
||||||
set -o vi
|
|
||||||
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
|
||||||
export ZSH="$HOME/.oh-my-zsh"
|
|
||||||
ZSH_THEME="avit"
|
|
||||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
|
||||||
# DISABLE_LS_COLORS="true"
|
|
||||||
# DISABLE_AUTO_TITLE="true"
|
|
||||||
# ENABLE_CORRECTION="true"
|
|
||||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
|
||||||
# You can also set it to another string to have that shown instead of the default red dots.
|
|
||||||
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
|
|
||||||
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
|
|
||||||
# COMPLETION_WAITING_DOTS="true"
|
|
||||||
# Uncomment the following line if you want to disable marking untracked files
|
|
||||||
# under VCS as dirty. This makes repository status check for large repositories
|
|
||||||
# much, much faster.
|
|
||||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
|
||||||
HIST_STAMPS="yyyy-mm-dd"
|
|
||||||
plugins=(git web-search jsontools z vi-mode zsh-autosuggestions)
|
|
||||||
#plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions)
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
|
||||||
|
|
||||||
# export MANPATH="/usr/local/man:$MANPATH"
|
|
||||||
# export LANG= "en_US.UTF-8"
|
|
||||||
export ARCHFLAGS="-arch x86_64"
|
|
||||||
|
|
||||||
### Navigation ###
|
|
||||||
|
|
||||||
# Relative navigation
|
|
||||||
|
|
||||||
alias ..="cd .."
|
|
||||||
alias ...="cd ../.."
|
|
||||||
alias ....="cd ../../.."
|
|
||||||
alias .....="cd ../../../.."
|
|
||||||
alias ......="cd ../../../../.."
|
|
||||||
|
|
||||||
# Absolute navigation
|
|
||||||
|
|
||||||
alias doku="cd ~/doku && ls"
|
|
||||||
alias dotfiles="cd $DOTFILES && ls"
|
|
||||||
|
|
||||||
### Aliases ###
|
|
||||||
|
|
||||||
# `alias` to list all aliases
|
|
||||||
|
|
||||||
# PowerShell Equivalent #
|
|
||||||
|
|
||||||
alias ni=touch
|
|
||||||
alias cls=clear
|
|
||||||
|
|
||||||
# Dev #
|
|
||||||
|
|
||||||
alias g++='g++ -std=c++2b' # Set the default C++ standard to C++20
|
|
||||||
alias gcc='gcc -std=c99' # Set the default C standard to C99
|
|
||||||
alias cl='clang -std=c99'
|
|
||||||
alias clpp='clang++ -std=c++2b'
|
|
||||||
alias python=python3 # Set the default Python version to Python 3
|
|
||||||
alias py=python # Alias for Python
|
|
||||||
alias bashcfg="nvim ~/.bashrc"
|
|
||||||
alias zshcfg="nvim ~/.zshrc"
|
|
||||||
alias shcfg=zshcfg
|
|
||||||
alias reload="source ~/.zshrc"
|
|
||||||
alias nvimrc="nvim ~/.config/nvim/"
|
|
||||||
alias ohmyzsh="code ~/.oh-my-zsh"
|
|
||||||
alias pulldots="cd $DOTFILES && git pull"
|
|
||||||
|
|
||||||
# Conda #
|
|
||||||
|
|
||||||
alias cact="conda activate"
|
|
||||||
alias cenvs="conda env list"
|
|
||||||
alias cdact="conda deactivate"
|
|
||||||
|
|
||||||
# Git #
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Editors #
|
|
||||||
|
|
||||||
alias v=nvim
|
|
||||||
alias c=code
|
|
||||||
|
|
||||||
# Misc #
|
|
||||||
|
|
||||||
alias cf=cfiles
|
|
||||||
|
|
||||||
### Functions ###
|
|
||||||
|
|
||||||
mcd() {
|
|
||||||
mkdir -p -- "$1" && cd -P -- "$1"
|
|
||||||
}
|
|
||||||
cdls(){
|
|
||||||
cd $1 && ls
|
|
||||||
}
|
|
||||||
tc(){
|
|
||||||
touch $1 && code $1
|
|
||||||
}
|
|
||||||
tv(){
|
|
||||||
touch $1 && nvim $1
|
|
||||||
}
|
|
||||||
|
|
||||||
source ~/.private.env.sh
|
|
||||||
|
|
||||||
### WSL Options ###
|
|
||||||
|
|
||||||
# WSL open
|
|
||||||
open() {
|
|
||||||
local target=$1
|
|
||||||
|
|
||||||
if command -v explorer.exe > /dev/null; then
|
|
||||||
explorer.exe "$target"
|
|
||||||
else
|
|
||||||
command open "$target"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# WSL Neovide
|
|
||||||
gvi() {
|
|
||||||
local target=$1
|
|
||||||
|
|
||||||
if command -v neovide.exe > /dev/null; then
|
|
||||||
neovide.exe "$target"
|
|
||||||
else
|
|
||||||
if command -v neovide > /dev/null; then
|
|
||||||
neovide "$target"
|
|
||||||
else
|
|
||||||
echo "neovide is not installed"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
### Misc ###
|
|
||||||
|
|
||||||
export PATH=/opt/bin:$PATH
|
|
||||||
|
|
||||||
# Conda #
|
|
||||||
|
|
||||||
# >>> conda initialize >>>
|
|
||||||
# !! Contents within this block are managed by 'conda init' !!
|
|
||||||
__conda_setup="$('/home/js0ny/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
eval "$__conda_setup"
|
|
||||||
else
|
|
||||||
if [ -f "/home/js0ny/miniconda3/etc/profile.d/conda.sh" ]; then
|
|
||||||
. "/home/js0ny/miniconda3/etc/profile.d/conda.sh"
|
|
||||||
else
|
|
||||||
export PATH="/home/js0ny/miniconda3/bin:$PATH"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
unset __conda_setup
|
|
||||||
# <<< conda initialize <<<
|
|
||||||
|
|
||||||
# Ubuntu Command Not Found #
|
|
||||||
|
|
||||||
if [[ -x /usr/lib/command-not-found ]] ; then
|
|
||||||
if (( ! ${+functions[command_not_found_handler]} )) ; then
|
|
||||||
function command_not_found_handler {
|
|
||||||
[[ -x /usr/lib/command-not-found ]] || return 1
|
|
||||||
/usr/lib/command-not-found -- ${1+"$1"} && :
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# LinuxBrew #
|
|
||||||
|
|
||||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
|
||||||
# Set PATH, MANPATH, etc., for Homebrew.
|
|
||||||
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
|
|
||||||
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
|
|
||||||
|
|
||||||
# >>> juliaup initialize >>>
|
|
||||||
|
|
||||||
# !! Contents within this block are managed by juliaup !!
|
|
||||||
|
|
||||||
path=('/home/js0ny/.juliaup/bin' $path)
|
|
||||||
export PATH
|
|
||||||
|
|
||||||
# <<< juliaup initialize <<<
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# Configs for Linux
|
|
||||||
|
|
||||||
## Navigator
|
|
||||||
|
|
||||||
- [Bash Config](./.bashrc)
|
|
||||||
- [Zsh Config](./.zshrc)
|
|
||||||
132
mac/.zshrc
132
mac/.zshrc
|
|
@ -1,45 +1,13 @@
|
||||||
|
# ~/.config/zsh/.zshrc
|
||||||
|
# ln -s ~/.dotfiles/wsl/.zshrc ~/.config/zsh/.zshrc
|
||||||
### Variables ###
|
### Variables ###
|
||||||
|
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
|
source $DOTFILES/zsh/*.zsh
|
||||||
### ZSH Config ###
|
|
||||||
set -o vi
|
|
||||||
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
|
||||||
export ZSH="$HOME/.oh-my-zsh"
|
|
||||||
ZSH_THEME="avit"
|
|
||||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
|
||||||
# DISABLE_LS_COLORS="true"
|
|
||||||
# DISABLE_AUTO_TITLE="true"
|
|
||||||
# ENABLE_CORRECTION="true"
|
|
||||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
|
||||||
# You can also set it to another string to have that shown instead of the default red dots.
|
|
||||||
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
|
|
||||||
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
|
|
||||||
# COMPLETION_WAITING_DOTS="true"
|
|
||||||
# Uncomment the following line if you want to disable marking untracked files
|
|
||||||
# under VCS as dirty. This makes repository status check for large repositories
|
|
||||||
# much, much faster.
|
|
||||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
|
||||||
HIST_STAMPS="yyyy-mm-dd"
|
|
||||||
plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions)
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
|
||||||
|
|
||||||
# export MANPATH="/usr/local/man:$MANPATH"
|
|
||||||
# export LANG= "en_US.UTF-8"
|
|
||||||
export ARCHFLAGS="-arch arm64"
|
export ARCHFLAGS="-arch arm64"
|
||||||
|
|
||||||
### Navigation ###
|
### Navigation ###
|
||||||
|
|
||||||
# Relative navigation
|
|
||||||
|
|
||||||
alias ..="cd .."
|
|
||||||
alias ...="cd ../.."
|
|
||||||
alias ....="cd ../../.."
|
|
||||||
alias .....="cd ../../../.."
|
|
||||||
alias ......="cd ../../../../.."
|
|
||||||
|
|
||||||
# Absolute navigation
|
# Absolute navigation
|
||||||
|
|
||||||
alias doku="cd ~/doku && ls"
|
alias doku="cd ~/doku && ls"
|
||||||
alias dotfiles="cd $DOTFILES && ls"
|
alias dotfiles="cd $DOTFILES && ls"
|
||||||
alias docs="cd ~/Documents"
|
alias docs="cd ~/Documents"
|
||||||
|
|
@ -48,100 +16,6 @@ alias down="cd ~/Downloads"
|
||||||
alias one="cd ~/OneDrive"
|
alias one="cd ~/OneDrive"
|
||||||
alias gdrive="cd ~/Google\ Drive"
|
alias gdrive="cd ~/Google\ Drive"
|
||||||
|
|
||||||
### Aliases ###
|
|
||||||
|
|
||||||
# `alias` to list all aliases
|
|
||||||
|
|
||||||
# PowerShell Equivalent #
|
|
||||||
|
|
||||||
alias ni=touch
|
|
||||||
alias cls=clear
|
|
||||||
|
|
||||||
# Dev #
|
|
||||||
|
|
||||||
alias g++='g++ -std=c++2b' # Set the default C++ standard to C++20
|
|
||||||
alias gcc='gcc -std=c99' # Set the default C standard to C99
|
|
||||||
alias cl='clang -std=c99'
|
|
||||||
alias clpp='clang++ -std=c++2b'
|
|
||||||
alias python=python3 # Set the default Python version to Python 3
|
|
||||||
alias py=python # Alias for Python
|
|
||||||
alias bashcfg="nvim ~/.bashrc"
|
|
||||||
alias zshcfg="nvim ~/.zshrc"
|
|
||||||
alias shcfg=zshcfg
|
|
||||||
alias reload="source ~/.zshrc"
|
|
||||||
alias nvimrc="nvim ~/.config/nvim/"
|
|
||||||
alias ohmyzsh="code ~/.oh-my-zsh"
|
|
||||||
alias pulldots="cd $DOTFILES && git pull"
|
|
||||||
|
|
||||||
# Conda #
|
|
||||||
|
|
||||||
alias pyact="conda activate"
|
|
||||||
alias pydact="conda deactivate"
|
|
||||||
alias pylsenv="conda env list"
|
|
||||||
alias pymkenv="conda create --name"
|
|
||||||
|
|
||||||
# Git #
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Editors #
|
|
||||||
|
|
||||||
alias v=nvim
|
|
||||||
alias c=code
|
|
||||||
|
|
||||||
# Misc #
|
|
||||||
|
|
||||||
alias cf=cfiles
|
|
||||||
alias gdb=aarch64-elf-gdb
|
|
||||||
|
|
||||||
### Functions ###
|
|
||||||
|
|
||||||
mcd() {
|
|
||||||
mkdir -p -- "$0" && cd -P -- "$1"
|
|
||||||
}
|
|
||||||
cdls(){
|
|
||||||
cd $1 && ls
|
|
||||||
}
|
|
||||||
tc(){
|
|
||||||
touch $1 && code $1
|
|
||||||
}
|
|
||||||
tv(){
|
|
||||||
touch $1 && nvim $1
|
|
||||||
}
|
|
||||||
|
|
||||||
source ~/.private.env.sh
|
|
||||||
|
|
||||||
### WSL Options ###
|
|
||||||
|
|
||||||
# WSL open
|
|
||||||
open() {
|
|
||||||
local target=$1
|
|
||||||
|
|
||||||
if command -v explorer.exe > /dev/null; then
|
|
||||||
explorer.exe "$target"
|
|
||||||
else
|
|
||||||
command open "$target"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# WSL Neovide
|
|
||||||
gvi() {
|
|
||||||
local target=$1
|
|
||||||
|
|
||||||
if command -v neovide.exe > /dev/null; then
|
|
||||||
neovide.exe "$target"
|
|
||||||
else
|
|
||||||
if command -v neovide > /dev/null; then
|
|
||||||
neovide "$target" &
|
|
||||||
else
|
|
||||||
echo "neovide is not installed"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
### Misc ###
|
|
||||||
|
|
||||||
# >>> conda initialize >>>
|
# >>> conda initialize >>>
|
||||||
# !! Contents within this block are managed by 'conda init' !!
|
# !! Contents within this block are managed by 'conda init' !!
|
||||||
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ Get-ChildItem -Path $DOTFILES\powershell_private -Filter *.ps1 | ForEach-Object
|
||||||
|
|
||||||
# PowerShell Equivalents #
|
# PowerShell Equivalents #
|
||||||
|
|
||||||
Set-Alias "curl" "Invoke-WebRequest"
|
# Set-Alias "curl" "Invoke-WebRequest"
|
||||||
Set-Alias "man" "Get-Help"
|
Set-Alias "man" "Get-Help"
|
||||||
Set-Alias "kill" "Stop-Process"
|
Set-Alias "kill" "Stop-Process"
|
||||||
Set-Alias "open" "Invoke-Item" # Use ii instead of open
|
Set-Alias "open" "Invoke-Item" # Use ii instead of open
|
||||||
|
|
|
||||||
37
powershell/Aliases.ps1
Normal file
37
powershell/Aliases.ps1
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
### VARIABLES ###
|
||||||
|
$EDITOR = "code"
|
||||||
|
# Shell Equivalents #
|
||||||
|
Set-Alias "touch" "New-Item"
|
||||||
|
${function:ll} = { Get-ChildItem -Force }
|
||||||
|
|
||||||
|
# Shell Configurations #
|
||||||
|
${function:shcfg} = { code $PROFILE }
|
||||||
|
Set-Alias "pwshcfg" "shcfg"
|
||||||
|
${function:reload} = { . $PROFILE }
|
||||||
|
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
|
||||||
|
|
||||||
|
# Editors #
|
||||||
|
Set-Alias "v" "nvim"
|
||||||
|
Set-Alias "c" "code"
|
||||||
|
Set-Alias "gvi" "neovide"
|
||||||
|
|
||||||
|
# File Creation #
|
||||||
|
function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname }
|
||||||
|
function tc { param ( [string] $filename) New-Item $filename && code $filename }
|
||||||
|
function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
|
||||||
|
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
|
||||||
|
|
||||||
|
### Dev ###
|
||||||
|
|
||||||
|
# .NET #
|
||||||
|
${function:csi} = { dotnet repl --default-kernel csharp}
|
||||||
|
${function:fsi} = { dotnet repl --default-kernel fsharp}
|
||||||
|
|
||||||
|
# Python & Conda #
|
||||||
|
Set-Alias "py" "python"
|
||||||
|
Set-Alias "ipy" "ipython"
|
||||||
|
${function:pyact} = { conda activate $args[0] }
|
||||||
|
${function:pydact} = { conda deactivate }
|
||||||
|
${function:pylsenvs} = { conda env list }
|
||||||
|
${function:pymkenv} = { conda create --name $args[0] }
|
||||||
|
${function:pyrmenv} = { conda remove --name $args[0] --all }
|
||||||
25
powershell/Keymap.ps1
Normal file
25
powershell/Keymap.ps1
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# aka PSReadLine
|
||||||
|
# PSReadLineOptions
|
||||||
|
Set-PSReadLineOption -EditMode vi # Vi Keybindings
|
||||||
|
Set-PSReadLineOption -PredictionViewStyle ListView
|
||||||
|
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
|
||||||
|
Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > "
|
||||||
|
# PSReadLineKeyHandlers
|
||||||
|
## Colemak hnei
|
||||||
|
Set-PSReadLineKeyHandler -Chord "n" -Function NextHistory -ViMode Command
|
||||||
|
Set-PSReadLineKeyHandler -Chord "e" -Function PreviousHistory -ViMode Command
|
||||||
|
Set-PSReadLineKeyHandler -Chord "i" -Function ViForwardChar -ViMode Command
|
||||||
|
## Similar position to [i] in QWERTY
|
||||||
|
Set-PSReadLineKeyHandler -Chord "l" -Function ViInsertMode -ViMode Command
|
||||||
|
Set-PSReadlineKeyHandler -Chord "L" -Function ViInsertAtBegining -ViMode Command
|
||||||
|
## Ne{[k]s}t
|
||||||
|
Set-PSReadLineKeyHandler -Chord "k" -Function RepeatSearch -ViMode Command
|
||||||
|
Set-PSReadLineKeyHandler -Chord "K" -Function RepeatSearchBackward -ViMode Command
|
||||||
|
## [j]ump
|
||||||
|
Set-PSReadLineKeyHandler -Chord "j" -Function NextWordEnd -ViMode Command
|
||||||
|
Set-PSReadLineKeyHandler -Chord "J" -Function ViEndOfGlob -ViMode Command
|
||||||
|
## Use N to Join
|
||||||
|
Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command
|
||||||
|
Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape
|
||||||
|
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
|
||||||
|
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
|
||||||
9
powershell/Modules.ps1
Normal file
9
powershell/Modules.ps1
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
Import-Module -Name Terminal-Icons
|
||||||
|
Import-Module -Name CompletionPredictor
|
||||||
|
if ($IsWindows) {
|
||||||
|
# Chocolatey
|
||||||
|
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
||||||
|
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }
|
||||||
|
# WinGet
|
||||||
|
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
|
||||||
|
}
|
||||||
13
powershell/Navigation.ps1
Normal file
13
powershell/Navigation.ps1
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# ${function:~} = { Set-Location -Path ~ } cd is better
|
||||||
|
${function:...} = { Set-Location -Path ..\.. }
|
||||||
|
${function:....} = { Set-Location -Path ..\..\.. }
|
||||||
|
${function:.....} = { Set-Location -Path ..\..\..\.. }
|
||||||
|
${function:......} = { Set-Location -Path ..\..\..\..\.. }
|
||||||
|
|
||||||
|
# Absolute navigation
|
||||||
|
${function:docs} = { Set-Location -Path ~/Documents }
|
||||||
|
${function:down} = { Set-Location -Path ~/Downloads }
|
||||||
|
${function:dt} = { Set-Location -Path ~/Desktop }
|
||||||
|
${function:mytmp} = { Set-Location -Path ~/Temp }
|
||||||
|
${function:one} = { Set-Location -Path ~/OneDrive }
|
||||||
|
${function:doku} = { Set-Location -Path ~/doku && Get-ChildItem }
|
||||||
86
powershell/Prompt.ps1
Normal file
86
powershell/Prompt.ps1
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
$promptTime = $true
|
||||||
|
# $promptWeather = $false
|
||||||
|
|
||||||
|
function prompt {
|
||||||
|
$prompt = "`e[35m"
|
||||||
|
# Time
|
||||||
|
if ($promptTime) {
|
||||||
|
$promptTime = Get-Date -Format HH:mm
|
||||||
|
$prompt += "`[$promptTime]"
|
||||||
|
}
|
||||||
|
# UserInfo
|
||||||
|
$prompt += " $Env:Username @ $Env:Userdomain"
|
||||||
|
# Directory
|
||||||
|
$promptCurrentDirectory = $(PWD).Path
|
||||||
|
$promptCurrentDirectory = $promptCurrentDirectory.Replace("$HOME", "~")
|
||||||
|
$prompt += "`e[0m in `e[33m$promptCurrentDirectory "
|
||||||
|
# Git
|
||||||
|
if ($(git rev-parse --is-inside-work-tree 2> $null) -eq "true") {
|
||||||
|
$prompt += "`e[32m`u{e702} $(git branch --show-current)"
|
||||||
|
}
|
||||||
|
# Conda
|
||||||
|
if ( $Env:CONDA_PROMPT_MODIFIER ) {
|
||||||
|
$promptConda = $Env:CONDA_PROMPT_MODIFIER.Replace("`(","").Replace(")","")
|
||||||
|
$pythonVersion = $(python --version).Split(" ")[1]
|
||||||
|
$prompt += " `e[33m`u{e73c} $promptConda $pythonVersion"
|
||||||
|
}
|
||||||
|
# Programming Language (by Get-ChildItem)
|
||||||
|
## Python
|
||||||
|
if (Test-Path -Path "$PWD\pyproject.toml") {
|
||||||
|
$pythonVersion = $(python --version).Split(" ")[1]
|
||||||
|
$prompt += " `e[33m`u{e73c} $pythonVersion"
|
||||||
|
}
|
||||||
|
## Node.js
|
||||||
|
if (Test-Path -Path "$PWD\package.json") {
|
||||||
|
$nodeVersion = $(node --version)
|
||||||
|
$prompt += " `e[32m`u{e3a0} $nodeVersion"
|
||||||
|
# Locked
|
||||||
|
if (Test-Path -Path "$PWD\yarn.lock" || Test-Path -Path "$PWD\package-lock.json") {
|
||||||
|
$prompt += "`u{f023}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
## .NET
|
||||||
|
### C Sharp
|
||||||
|
if (Test-Path -Path "$PWD\*.csproj") {
|
||||||
|
$dotnetVersion = $(dotnet --version)
|
||||||
|
$prompt += " `e[34m`u{e648} $dotnetVersion"
|
||||||
|
}
|
||||||
|
### F Sharp
|
||||||
|
if (Test-Path -Path "$PWD\*.fsproj") {
|
||||||
|
$dotnetVersion = $(dotnet --version)
|
||||||
|
$prompt += " `e[35m`u{e65a} $dotnetVersion"
|
||||||
|
}
|
||||||
|
## Rust
|
||||||
|
if (Test-Path -Path "$PWD\Cargo.toml") {
|
||||||
|
$rustVersion = $(cargo --version).Split(" ")[1]
|
||||||
|
$prompt += " `e[31m`u{e7a8} $rustVersion"
|
||||||
|
}
|
||||||
|
## Java
|
||||||
|
if (Test-Path -Path "$PWD\pom.xml" || Test-Path -Path "$PWD\build.gradle") {
|
||||||
|
$javaVersion = $(java --version).Split(" ")[1]
|
||||||
|
$prompt += " `e[31m`u{e738} $javaVersion"
|
||||||
|
}
|
||||||
|
## Makefile
|
||||||
|
if (Test-Path -Path "$PWD\Makefile") {
|
||||||
|
$prompt += " `e[32m`u{e673}"
|
||||||
|
}
|
||||||
|
if (Test-Path -Path "$PWD\CMakeLists.txt") {
|
||||||
|
$prompt += " `e[32m `u{e61d}"
|
||||||
|
}
|
||||||
|
# Docker
|
||||||
|
if (Test-Path -Path "$PWD\Dockerfile" || Test-Path -Path "$PWD\docker-compose.yml") {
|
||||||
|
$prompt += " `e[33m`u{f21f}"
|
||||||
|
}
|
||||||
|
# Weather
|
||||||
|
# if ( $global:promptWeather ) {
|
||||||
|
# $prompt += $(Write-WeatherCurrent -City "Edinburgh" -Country "UK" -Unit "metric" -Inline -Apikey $Env:WEATHER_API_KEY)
|
||||||
|
# }
|
||||||
|
# Error on last command
|
||||||
|
## TODO: Seems does not work
|
||||||
|
if ($?) {
|
||||||
|
$prompt += "`n`e[32m PS > `e[0m"
|
||||||
|
} else {
|
||||||
|
$prompt += "`n`e[31m PS > `e[0m"
|
||||||
|
}
|
||||||
|
return $prompt
|
||||||
|
}
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
### PSReadLine ###
|
|
||||||
|
|
||||||
Set-PSReadLineOption -EditMode vi # Vi Keybindings
|
|
||||||
Set-PSReadLineOption -PredictionViewStyle ListView
|
|
||||||
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
|
|
||||||
Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > "
|
|
||||||
### Keybindings ###
|
|
||||||
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+Shift+f" -Function ForwardWord
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+Shift+b" -Function BackwardWord
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Alt+f" -Function ForwardChar
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+b" -Function BackwardChar
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function HistorySearchBackward
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function HistorySearchForward
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
|
|
||||||
|
|
||||||
### Navigator ###
|
|
||||||
|
|
||||||
# Relative navigation #
|
|
||||||
|
|
||||||
# ${function:~} = { Set-Location -Path ~ } cd is better
|
|
||||||
${function:...} = { Set-Location -Path ..\.. }
|
|
||||||
${function:....} = { Set-Location -Path ..\..\.. }
|
|
||||||
${function:.....} = { Set-Location -Path ..\..\..\.. }
|
|
||||||
${function:......} = { Set-Location -Path ..\..\..\..\.. }
|
|
||||||
|
|
||||||
# Absolute navigation #
|
|
||||||
|
|
||||||
${function:docs} = { Set-Location -Path ~/Documents }
|
|
||||||
${function:down} = { Set-Location -Path ~/Downloads }
|
|
||||||
${function:dt} = { Set-Location -Path ~/Desktop }
|
|
||||||
${function:mytmp} = { Set-Location -Path ~/Temp }
|
|
||||||
${function:one} = { Set-Location -Path ~/OneDrive }
|
|
||||||
${function:doku} = { Set-Location -Path ~/doku && Get-ChildItem }
|
|
||||||
|
|
||||||
### Alias ###
|
|
||||||
|
|
||||||
# Shell Equivalents #
|
|
||||||
|
|
||||||
Set-Alias "touch" "New-Item"
|
|
||||||
${function:ll} = { Get-ChildItem -Force }
|
|
||||||
|
|
||||||
# Shell Configurations #
|
|
||||||
|
|
||||||
${function:shcfg} = { code $PROFILE }
|
|
||||||
Set-Alias "pwshcfg" "shcfg"
|
|
||||||
${function:reload} = { . $PROFILE }
|
|
||||||
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
|
|
||||||
|
|
||||||
# Editors #
|
|
||||||
|
|
||||||
Set-Alias "v" "nvim"
|
|
||||||
Set-Alias "c" "code"
|
|
||||||
Set-Alias "gvi" "neovide"
|
|
||||||
|
|
||||||
# File Creation #
|
|
||||||
|
|
||||||
function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname }
|
|
||||||
function tc { param ( [string] $filename) New-Item $filename && code $filename }
|
|
||||||
function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
|
|
||||||
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
|
|
||||||
|
|
||||||
### Dev ###
|
|
||||||
|
|
||||||
# .NET #
|
|
||||||
|
|
||||||
${function:csi} = { dotnet repl --default-kernel csharp}
|
|
||||||
${function:fsi} = { dotnet repl --default-kernel fsharp}
|
|
||||||
|
|
||||||
# Python & Conda #
|
|
||||||
|
|
||||||
Set-Alias "py" "python"
|
|
||||||
${function:pyact} = { conda activate $args[0] }
|
|
||||||
${function:pydact} = { conda deactivate }
|
|
||||||
${function:pylsenvs} = { conda env list }
|
|
||||||
${function:pymkenv} = { conda create --name $args[0] }
|
|
||||||
${function:pyrmenv} = { conda remove --name $args[0] --all }
|
|
||||||
|
|
||||||
|
|
||||||
# C & C++ #
|
|
||||||
|
|
||||||
|
|
||||||
### Modules ###
|
|
||||||
|
|
||||||
Import-Module CompletionPredictor
|
|
||||||
333
surfingkeys.js
333
surfingkeys.js
|
|
@ -1,4 +1,6 @@
|
||||||
// Paste this into surfingkeys advanced settings
|
// Paste this into surfingkeys advanced settings
|
||||||
|
// or use:
|
||||||
|
// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/surfingkeys.js
|
||||||
|
|
||||||
/** Examples
|
/** Examples
|
||||||
|
|
||||||
|
|
@ -17,29 +19,90 @@ api.unmap('<ctrl-i>');
|
||||||
*/
|
*/
|
||||||
// Settings
|
// Settings
|
||||||
settings.language = "zh-CN" ;
|
settings.language = "zh-CN" ;
|
||||||
settings.showModeStatus = true;
|
settings.showModeStatus = false;
|
||||||
// Colemak hjkl (hnei)
|
// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main
|
||||||
// map('h', 'h') // left no change
|
const forward = {
|
||||||
api.map('n', 'j') // down
|
add: function (key) { // 转发即将被 unmap 的键
|
||||||
api.vmap('n', 'j') // down
|
return api.map(`for${key}`, key)
|
||||||
api.map('e', 'k') // up
|
},
|
||||||
api.vmap('e', 'k') // up
|
cancel: function (key) { // 删除转发生成的键
|
||||||
api.map('i', 'l') // right
|
api.unmap(`for${key}`)
|
||||||
api.vmap('i', 'l') // right
|
api.unmap(key)
|
||||||
// DELETED map j -> e : use j to scroll up half page
|
},
|
||||||
api.vmap('j', 'e') // end of word
|
use: function (key) {
|
||||||
api.map('k', 'n') // search next word (Original Position of n)
|
return `for${key}`
|
||||||
api.vmap('k', 'n') // search next word (Original Position of n)
|
}
|
||||||
api.map('l', 'i') // insert mode, similar position to original i
|
}
|
||||||
api.vmap('l', 'i') // insert mode, similar position to original i
|
|
||||||
api.map('L', 'I') // insert mode with vim popup, similar pos to I
|
const colemak = {
|
||||||
|
forward: function (key) { // 转发即将被 unmap 的键
|
||||||
|
api.map(key, `col${key}`)
|
||||||
|
api.unmap(`col${key}`)
|
||||||
|
|
||||||
|
},
|
||||||
|
use: function (key) {
|
||||||
|
return `col${key}`
|
||||||
|
},
|
||||||
|
map: function (a, b) {
|
||||||
|
api.map(colemak.use(a), forward.use(b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const forwardFactory = {
|
||||||
|
push: function (mapLists) { // forward original keys
|
||||||
|
for (let key in mapLists) {
|
||||||
|
forward.add(mapLists[key])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
map: function (mapLists) {
|
||||||
|
for (let key in mapLists) {
|
||||||
|
colemak.map(key, mapLists[key])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pull: function (mapLists) {
|
||||||
|
for (let key in mapLists) {
|
||||||
|
forward.cancel(mapLists[key])
|
||||||
|
}
|
||||||
|
for (let key in mapLists) {
|
||||||
|
colemak.forward(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapLists = {
|
||||||
|
/// scroll page
|
||||||
|
// Arrow
|
||||||
|
'n': 'j',
|
||||||
|
'e': 'k',
|
||||||
|
'i': 'l',
|
||||||
|
// l <-> i
|
||||||
|
'l': 'i',
|
||||||
|
'L': 'I',
|
||||||
|
// k <-> n
|
||||||
|
'k': 'n',
|
||||||
|
'K': 'N',
|
||||||
|
// j <-> e
|
||||||
|
'j': 'e',
|
||||||
|
'J': 'E',
|
||||||
|
// 缩放
|
||||||
|
'zu': 'zi',
|
||||||
|
'zo': 'ze',
|
||||||
|
'zz': 'zr',
|
||||||
|
}
|
||||||
|
|
||||||
|
forwardFactory.push(mapLists)
|
||||||
|
api.unmap('t')
|
||||||
|
forwardFactory.map(mapLists)
|
||||||
|
// 鼠标点击
|
||||||
|
api.unmap('gi')
|
||||||
|
api.unmap('[[')
|
||||||
|
api.unmap(']]')
|
||||||
|
api.unmap(';m')
|
||||||
|
api.unmap(';fs')
|
||||||
|
api.unmap('O')
|
||||||
|
api.unmap('C')
|
||||||
|
forwardFactory.pull(mapLists)
|
||||||
|
|
||||||
// Prev/Next Page (WASD-like left-hand navigation)
|
|
||||||
api.map('A', 'E')
|
|
||||||
api.map('S', 'R')
|
|
||||||
// map('d', 'd') for scroll down half page
|
|
||||||
api.map('j', 'u') //scrool up half page
|
|
||||||
api.map('T', 'C') // Open in new tab
|
|
||||||
|
|
||||||
// Search Alias
|
// Search Alias
|
||||||
api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) {
|
api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) {
|
||||||
|
|
@ -62,42 +125,236 @@ api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Theme
|
// Theme, reference to https://github.com/Foldex/surfingkeys-config
|
||||||
|
api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;');
|
||||||
|
api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text");
|
||||||
|
api.Visual.style('marks', 'background-color: #A3BE8C99;');
|
||||||
|
api.Visual.style('cursor', 'background-color: #88C0D0;');
|
||||||
settings.theme = `
|
settings.theme = `
|
||||||
|
fg: #E5E9F0;
|
||||||
|
bg: #3B4252;
|
||||||
|
bg-dark: #2E3440;
|
||||||
|
border: #4C566A;
|
||||||
|
main-fg: #88C0D0;
|
||||||
|
accent-fg: #A3BE8C;
|
||||||
|
info-fg: #5E81AC;
|
||||||
|
select: #4C566A;
|
||||||
|
/* ---------- Generic ---------- */
|
||||||
.sk_theme {
|
.sk_theme {
|
||||||
font-family: Input Sans Condensed, Charcoal, sans-serif;
|
background: var(--bg);
|
||||||
font-size: 10pt;
|
color: var(--fg);
|
||||||
background: #24272e;
|
background-color: var(--bg);
|
||||||
color: #abb2bf;
|
border-color: var(--border);
|
||||||
|
font-family: var(--font);
|
||||||
|
font-size: var(--font-size);
|
||||||
|
font-weight: var(--font-weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
font-family: var(--font);
|
||||||
|
font-weight: var(--font-weight);
|
||||||
|
}
|
||||||
|
|
||||||
.sk_theme tbody {
|
.sk_theme tbody {
|
||||||
color: #fff;
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sk_theme input {
|
.sk_theme input {
|
||||||
color: #d0d0d0;
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hints */
|
||||||
|
#sk_hints .begin {
|
||||||
|
color: var(--accent-fg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sk_tabs .sk_tab {
|
||||||
|
background: var(--bg-dark);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
#sk_tabs .sk_tab_title {
|
||||||
|
color: var(--fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#sk_tabs .sk_tab_url {
|
||||||
|
color: var(--main-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#sk_tabs .sk_tab_hint {
|
||||||
|
background: var(--bg);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
color: var(--accent-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sk_theme #sk_frame {
|
||||||
|
background: var(--bg);
|
||||||
|
opacity: 0.2;
|
||||||
|
color: var(--accent-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Omnibar ---------- */
|
||||||
|
/* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */
|
||||||
|
/* .sk_theme#sk_omnibar {
|
||||||
|
width: 100%;
|
||||||
|
left: 0;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.sk_theme .title {
|
||||||
|
color: var(--accent-fg);
|
||||||
|
}
|
||||||
|
|
||||||
.sk_theme .url {
|
.sk_theme .url {
|
||||||
color: #61afef;
|
color: var(--main-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sk_theme .annotation {
|
.sk_theme .annotation {
|
||||||
color: #56b6c2;
|
color: var(--accent-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sk_theme .omnibar_highlight {
|
.sk_theme .omnibar_highlight {
|
||||||
color: #528bff;
|
color: var(--accent-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sk_theme .omnibar_timestamp {
|
.sk_theme .omnibar_timestamp {
|
||||||
color: #e5c07b;
|
color: var(--info-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sk_theme .omnibar_visitcount {
|
.sk_theme .omnibar_visitcount {
|
||||||
color: #98c379;
|
color: var(--accent-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) {
|
.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) {
|
||||||
background: #303030;
|
background: var(--bg-dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sk_theme #sk_omnibarSearchResult ul li.focused {
|
.sk_theme #sk_omnibarSearchResult ul li.focused {
|
||||||
background: #3e4452;
|
background: var(--border);
|
||||||
}
|
}
|
||||||
#sk_status, #sk_find {
|
|
||||||
font-size: 20pt;
|
.sk_theme #sk_omnibarSearchArea {
|
||||||
|
border-top-color: var(--border);
|
||||||
|
border-bottom-color: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sk_theme #sk_omnibarSearchArea input,
|
||||||
|
.sk_theme #sk_omnibarSearchArea span {
|
||||||
|
font-size: var(--font-size);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sk_theme .separator {
|
||||||
|
color: var(--accent-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Popup Notification Banner ---------- */
|
||||||
|
#sk_banner {
|
||||||
|
font-family: var(--font);
|
||||||
|
font-size: var(--font-size);
|
||||||
|
font-weight: var(--font-weight);
|
||||||
|
background: var(--bg);
|
||||||
|
border-color: var(--border);
|
||||||
|
color: var(--fg);
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Popup Keys ---------- */
|
||||||
|
#sk_keystroke {
|
||||||
|
background-color: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sk_theme kbd .candidates {
|
||||||
|
color: var(--info-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sk_theme span.annotation {
|
||||||
|
color: var(--accent-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Popup Translation Bubble ---------- */
|
||||||
|
#sk_bubble {
|
||||||
|
background-color: var(--bg) !important;
|
||||||
|
color: var(--fg) !important;
|
||||||
|
border-color: var(--border) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sk_bubble * {
|
||||||
|
color: var(--fg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sk_bubble div.sk_arrow div:nth-of-type(1) {
|
||||||
|
border-top-color: var(--border) !important;
|
||||||
|
border-bottom-color: var(--border) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sk_bubble div.sk_arrow div:nth-of-type(2) {
|
||||||
|
border-top-color: var(--bg) !important;
|
||||||
|
border-bottom-color: var(--bg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Search ---------- */
|
||||||
|
#sk_status,
|
||||||
|
#sk_find {
|
||||||
|
font-size: var(--font-size);
|
||||||
|
border-color: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sk_theme kbd {
|
||||||
|
background: var(--bg-dark);
|
||||||
|
border-color: var(--border);
|
||||||
|
box-shadow: none;
|
||||||
|
color: var(--fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sk_theme .feature_name span {
|
||||||
|
color: var(--main-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- ACE Editor ---------- */
|
||||||
|
#sk_editor {
|
||||||
|
background: var(--bg-dark) !important;
|
||||||
|
height: 50% !important;
|
||||||
|
/* Remove this to restore the default editor size */
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace_dialog-bottom {
|
||||||
|
border-top: 1px solid var(--bg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-chrome .ace_print-margin,
|
||||||
|
.ace_gutter,
|
||||||
|
.ace_gutter-cell,
|
||||||
|
.ace_dialog {
|
||||||
|
background: var(--bg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace-chrome {
|
||||||
|
color: var(--fg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace_gutter,
|
||||||
|
.ace_dialog {
|
||||||
|
color: var(--fg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace_cursor {
|
||||||
|
color: var(--fg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normal-mode .ace_cursor {
|
||||||
|
background-color: var(--fg) !important;
|
||||||
|
border: var(--fg) !important;
|
||||||
|
opacity: 0.7 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace_marker-layer .ace_selection {
|
||||||
|
background: var(--select) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace_editor,
|
||||||
|
.ace_dialog span,
|
||||||
|
.ace_dialog input {
|
||||||
|
font-family: var(--font);
|
||||||
|
font-size: var(--font-size);
|
||||||
|
font-weight: var(--font-weight);
|
||||||
}`;
|
}`;
|
||||||
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y>
|
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y>
|
||||||
|
|
@ -1,29 +1,23 @@
|
||||||
"vim.vimrc.path": "$HOME/.vscode.vimrc", // from vscode settings.json
|
" ~/.config/vscode/vscode.vimrc
|
||||||
|
" New-Item -ItemType SymbolicLink -Path ~\.config\vscode\vscode.vimrc -Target ~\.dotfiles\vscode\vscode.vimrc
|
||||||
|
" mkdir -p ~/.config/vscode && ln -s ~/.config/vscode/vscode.vimrc ~/.vimrc
|
||||||
|
" And go to vscode vim setting:
|
||||||
|
"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc",
|
||||||
|
|
||||||
" Colemak 方向键映射 (hnei)
|
" Word wrap
|
||||||
nnoremap k n
|
noremap n gj
|
||||||
nnoremap K N
|
noremap e gk
|
||||||
nnoremap j e
|
noremap i l
|
||||||
vnoremap j e
|
|
||||||
nnoremap l i
|
" Similar position to i
|
||||||
nnoremap N J
|
noremap l i
|
||||||
nnoremap E K
|
noremap L I
|
||||||
nnoremap I L
|
" ne[k]st
|
||||||
nnoremap J E
|
noremap k n
|
||||||
vnoremap J E
|
noremap K N
|
||||||
nnoremap L I
|
" [j]ump
|
||||||
nnoremap k n
|
noremap j e
|
||||||
nnoremap K N
|
noremap J E
|
||||||
nnoremap j e
|
|
||||||
vnoremap j e
|
" Y to yank to end of line
|
||||||
nnoremap l i
|
noremap Y y$
|
||||||
nnoremap N J
|
|
||||||
nnoremap E K
|
|
||||||
nnoremap I L
|
|
||||||
nnoremap J E
|
|
||||||
vnoremap J E
|
|
||||||
nnoremap L I
|
|
||||||
" 方向键映射
|
|
||||||
noremap n <Down> " 向下
|
|
||||||
noremap e <Up> " 向上
|
|
||||||
noremap i <Right> " 向右
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
; [wsl2]
|
# ~/.wslconfig
|
||||||
; networkingMode=mirrored
|
# New-Item -ItemType SymbolicLink -Path ~\.wslconfig -Target ~\.dotfiles\win\.wslconfig
|
||||||
; dnsTunneling=true
|
[wsl2]
|
||||||
; firewall=true
|
networkingMode=mirrored
|
||||||
; autoProxy=true
|
dnsTunneling=true
|
||||||
|
firewall=true
|
||||||
|
autoProxy=true
|
||||||
|
|
||||||
; [experimental]
|
[experimental]
|
||||||
; # requires dnsTunneling but are also OPTIONAL
|
# requires dnsTunneling but are also OPTIONAL
|
||||||
; bestEffortDnsParsing=true
|
bestEffortDnsParsing=true
|
||||||
; useWindowsDnsCache=true
|
hostAddressLoopback=true
|
||||||
; hostAddressLoopback=true
|
|
||||||
|
|
@ -1,60 +1,33 @@
|
||||||
### Variables ###
|
|
||||||
|
|
||||||
$DOTFILES = "$HOME\Documents\.dotfiles"
|
|
||||||
|
|
||||||
### Load Configs ###
|
### Load Configs ###
|
||||||
|
$DOTFILES = "$HOME\.dotfiles"
|
||||||
Get-ChildItem -Path $DOTFILES\powershell -Filter *.ps1 | ForEach-Object {. $_}
|
Get-ChildItem -Path $DOTFILES\powershell -Filter *.ps1 | ForEach-Object {. $_}
|
||||||
Get-ChildItem -Path $DOTFILES\powershell_private -Filter *.ps1 | ForEach-Object {. $_}
|
Get-ChildItem -Path $DOTFILES\powershell_private -Filter *.ps1 | ForEach-Object {. $_}
|
||||||
|
|
||||||
### Aliases ###
|
### Aliases ###
|
||||||
|
|
||||||
# Shell Equivalents #
|
# Shell Equivalents #
|
||||||
|
Set-Alias "grep" "Select-String"
|
||||||
Set-Alias "open" "Invoke-Item" # Use ii instead of explorer.exe
|
${function:which} = { (Get-Command $args[0]).Path }
|
||||||
|
|
||||||
# Shell Configurations #
|
# Shell Configurations #
|
||||||
|
|
||||||
${function:shcfg} = { code $PROFILE }
|
${function:shcfg} = { code $PROFILE }
|
||||||
${function:reload} = { . $PROFILE }
|
${function:reload} = { & $PROFILE }
|
||||||
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
|
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
|
||||||
Set-Alias "pwshcfg" "shcfg"
|
Set-Alias "pwshcfg" "shcfg"
|
||||||
|
|
||||||
# C & C++ #
|
# C & C++ #
|
||||||
|
|
||||||
# Set-Alias "cl" "clang"
|
# Set-Alias "cl" "clang"
|
||||||
# Set-Alias "clpp" "clang++"
|
# Set-Alias "clpp" "clang++"
|
||||||
# ${function:clang} = { clang -std=c99 $args[0] }
|
# ${function:clang} = { clang -std=c99 $args[0] }
|
||||||
# ${function:clang++} = { clang -std=c++2b $args[0] }
|
# ${function:clang++} = { clang -std=c++2b $args[0] }
|
||||||
|
|
||||||
# Python & Conda #
|
|
||||||
|
|
||||||
Set-Alias "python3" "python"
|
|
||||||
Set-Alias "pip3" "pip"
|
|
||||||
|
|
||||||
# Git #
|
|
||||||
|
|
||||||
# Set-Alias "g" "git"
|
|
||||||
# Set-Alias "ginit" "git init"
|
|
||||||
# Set-Alias "ga" "git add"
|
|
||||||
# Set-Alias "gaa" "git add --all"
|
|
||||||
# Set-Alias "gc" "git commit --message"
|
|
||||||
# Set-Alias "gca" "git commit --all --message"
|
|
||||||
# Set-Alias "gcl" "git clone"
|
|
||||||
# Set-Alias "gclnh" "git clone --depth 1"
|
|
||||||
# Set-Alias "gs" "git status"
|
|
||||||
# Set-Alias "gpl" "git pull"
|
|
||||||
# Set-Alias "gps" "git push"
|
|
||||||
|
|
||||||
|
|
||||||
# WSL #
|
# WSL #
|
||||||
|
|
||||||
${function:wsl1} = {wsl.exe --distribution Debian}
|
${function:wsl1} = {wsl.exe --distribution Debian}
|
||||||
${function:wsl2} = {wsl.exe --distribution Ubuntu-22.04}
|
${function:wsl2} = {wsl.exe --distribution Ubuntu-22.04}
|
||||||
|
New-PSDrive -Name WSL -PSProvider FileSystem -Root \\wsl.localhost\Ubuntu-22.04
|
||||||
|
|
||||||
# Search Software #
|
# Search Software #
|
||||||
|
function Find-AppPackageListRemote {
|
||||||
function Get-AppPackageListRemote {
|
|
||||||
param(
|
param(
|
||||||
[string]$Name
|
[string]$Name
|
||||||
)
|
)
|
||||||
|
|
@ -68,16 +41,14 @@ function Get-AppPackageListRemote {
|
||||||
Write-Host "=== choco ==="
|
Write-Host "=== choco ==="
|
||||||
choco search $Name
|
choco search $Name
|
||||||
}
|
}
|
||||||
|
|
||||||
Set-Alias "pkgsearch" "Get-AppPackageListRemote"
|
Set-Alias "pkgsearch" "Get-AppPackageListRemote"
|
||||||
|
|
||||||
function Get-AppPackageListLocal {
|
function Get-AppPackageListLocal {
|
||||||
winget list
|
winget list
|
||||||
choco list
|
choco list
|
||||||
scoop list
|
scoop list
|
||||||
}
|
}
|
||||||
# Toggle Theme #
|
|
||||||
|
|
||||||
|
# Toggle Theme #
|
||||||
function Set-SystemTheme {
|
function Set-SystemTheme {
|
||||||
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||||
$currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme"
|
$currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme"
|
||||||
|
|
@ -90,27 +61,14 @@ function Set-SystemTheme {
|
||||||
Write-Host "已切换到浅色模式"
|
Write-Host "已切换到浅色模式"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set-Alias "theme" "Set-SystemTheme"
|
Set-Alias "theme" "Set-SystemTheme"
|
||||||
|
|
||||||
# Miscs #
|
# Miscs #
|
||||||
|
|
||||||
### Modules ###
|
|
||||||
|
|
||||||
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
|
|
||||||
Import-Module CompletionPredictor
|
|
||||||
# Import-Module syntax-highlighting # Buggy
|
|
||||||
|
|
||||||
### Misc ###
|
### Misc ###
|
||||||
|
|
||||||
${function:qwen} = "ollama run qwen2.5:14b"
|
${function:qwen} = "ollama run qwen2.5:14b"
|
||||||
|
|
||||||
# ## Oh-My-Posh ##
|
|
||||||
|
|
||||||
# Oh-My-Posh init pwsh --config "$HOME\AppData\Local\Programs\oh-my-posh\themes\tokyonight_storm.omp.json" | Invoke-Expression
|
|
||||||
|
|
||||||
## Conda ##
|
## Conda ##
|
||||||
|
|
||||||
#region conda initialize
|
#region conda initialize
|
||||||
# !! Contents within this block are managed by 'conda init' !!
|
# !! Contents within this block are managed by 'conda init' !!
|
||||||
If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
|
If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
|
||||||
|
|
@ -134,12 +92,6 @@ if (-not ($__lastStartup -eq $_currentDate)) {
|
||||||
# 记录当前日期到日志文件
|
# 记录当前日期到日志文件
|
||||||
$_currentDate | Out-File -FilePath $SystemlogFilePath -Append
|
$_currentDate | Out-File -FilePath $SystemlogFilePath -Append
|
||||||
}
|
}
|
||||||
|
|
||||||
Remove-Variable SystemlogFilePath
|
Remove-Variable SystemlogFilePath
|
||||||
Remove-Variable __lastStartup
|
Remove-Variable __lastStartup
|
||||||
Remove-Variable _currentDate
|
Remove-Variable _currentDate
|
||||||
|
|
||||||
## Chocolatey ##
|
|
||||||
|
|
||||||
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
|
||||||
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1 @@
|
||||||
# Configs for Windows
|
# Windows dotfiles
|
||||||
|
|
||||||
## Navigator
|
|
||||||
|
|
||||||
- [WSL Config](./.wslconfig)
|
|
||||||
- [Windows Terminal Config](./WindowsTerminal.json)
|
|
||||||
- [PowerShell Config](./Microsoft.PowerShell_profile.ps1)
|
|
||||||
- [Neovide](./neovide.toml)
|
|
||||||
128
win/setup_win.ps1
Normal file
128
win/setup_win.ps1
Normal file
|
|
@ -0,0 +1,128 @@
|
||||||
|
#!C:\Program Files\WindowsApps\Microsoft.PowerShell_7.4.6.0_x64__8wekyb3d8bbwe\pwsh.EXE
|
||||||
|
# Run with PowerShell 7
|
||||||
|
# Use PowerShell as Administrator
|
||||||
|
winget install -e --id Git.Git
|
||||||
|
git clone https://github.com/js0ny/dotfiles.git ~\.dotfiles
|
||||||
|
Set-Location -Path ~\.dotfiles
|
||||||
|
Remove-Item -Force $PROFILE
|
||||||
|
$DOTFILES = "$HOME\.dotfiles"
|
||||||
|
New-Item -ItemType SymbolicLink -Path $PROFILE -Target "$DOTFILES\win\Microsoft.PowerShell_profile.ps1"
|
||||||
|
. $PROFILE
|
||||||
|
# Install Scoop
|
||||||
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||||
|
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
|
||||||
|
# Install Chocolatey
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||||
|
|
||||||
|
# Set Dotfiles
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.condarc" -Target "$DOTFILES\.condarc"
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.gitconfig" -Target "$DOTFILES\.gitconfig"
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.haskline" -Target "$DOTFILES\.haskline"
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.ideavimrc" -Target "$DOTFILES\.ideavimrc"
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.markdownlint.json" -Target "$DOTFILES\.markdownlint.json"
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.npmrc" -Target "$DOTFILES\.npmrc"
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.pip.conf" -Target "$DOTFILES\.pip.conf"
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.wslconfig" -Target "$DOTFILES\win\.wslconfig"
|
||||||
|
New-Item -ItemType SymbolicLink -Path "~\.vscode.vimrc" -Target "$DOTFILES\vscode\vscode.vimrc"
|
||||||
|
Get-ChildItem -Force -Filter .* | ForEach-Object { $_.Attributes += "Hidden" } # Hide dotfiles
|
||||||
|
|
||||||
|
# Windows Terminal
|
||||||
|
if (Get-Command wt -ErrorAction SilentlyContinue) {
|
||||||
|
Write-Output "Windows Terminal (wt) installed"
|
||||||
|
} else {
|
||||||
|
winget install -e --id Microsoft.WindowsTerminal
|
||||||
|
}
|
||||||
|
|
||||||
|
# Uninstall Windows Apps
|
||||||
|
Get-AppxPackage *solit* | Remove-AppxPackage # 纸牌
|
||||||
|
Get-AppxPackage *sound* | Remove-AppxPackage # 錄音機
|
||||||
|
Get-AppxPackage *camera* | Remove-AppxPackage # 相機
|
||||||
|
Get-AppxPackage *weather* | Remove-AppxPackage # 天氣
|
||||||
|
Get-AppxPackage *Map* | Remove-AppxPackage # 地圖
|
||||||
|
# Get-AppxPackage *clipchamp* | Remove-AppxPackage # 其實這個還行
|
||||||
|
|
||||||
|
# Added Packages
|
||||||
|
scoop add bucket nerd-fonts
|
||||||
|
scoop add bucket extras
|
||||||
|
|
||||||
|
# CLI Tools
|
||||||
|
winget install -e --id GnuWin32.Grep
|
||||||
|
winget install -e --id GnuWin32.Make
|
||||||
|
winget install -e --id GnuWin32.Which
|
||||||
|
winget install -e --id junegunn.fzf
|
||||||
|
winget install -e --id BurntSushi.ripgrep.MSVC
|
||||||
|
winget install -e --id JernejSimoncic.Wget
|
||||||
|
winget install -e --id GNU.Wget2
|
||||||
|
|
||||||
|
# File Management
|
||||||
|
winget install -e --id voidtools.Everything
|
||||||
|
winget install -e --id 7zip.7zip
|
||||||
|
winget install -e --id Bandisoft.Bandizip
|
||||||
|
winget install -e --id JohnMacFarlane.Pandoc
|
||||||
|
winget install -e --id SumatraPDF.SumatraPDF
|
||||||
|
winget install -e --id Google.GoogleDrive
|
||||||
|
|
||||||
|
# System Enhancements
|
||||||
|
winget install -e --id Rem0o.FanControl
|
||||||
|
winget install -e --id Microsoft.PowerToys
|
||||||
|
winget install -e --id Guru3D.Afterburner
|
||||||
|
winget install -e --id Yuanli.uTools
|
||||||
|
winget install -e --id GeekUninstaller.GeekUninstaller
|
||||||
|
# winget install -e --id Flow-Launcher.Flow-Launcher
|
||||||
|
winget install -e --id AutoHotkey.AutoHotkey
|
||||||
|
winget install -e --id Mactype.Mactype
|
||||||
|
# winget install -e --id Nilesoft.Shell
|
||||||
|
# scoop install umi-ocr-paddle
|
||||||
|
|
||||||
|
# Editor
|
||||||
|
winget install -e --id vim.vim
|
||||||
|
winget install -e --id Neovim.Neovim
|
||||||
|
winget install -e --id VSCodium.VSCodium
|
||||||
|
winget install -e --id Microsoft.VisualStudioCode
|
||||||
|
winget install -e --id Neovide.Neovide
|
||||||
|
|
||||||
|
# Security
|
||||||
|
winget install -e --id Bitwarden.Bitwarden
|
||||||
|
|
||||||
|
# PKM
|
||||||
|
winget install -e --id Obsidian.Obsidian
|
||||||
|
winget install -e --id B3log.SiYuan
|
||||||
|
winget install -e --id appmakes.Typora
|
||||||
|
winget install -e --id DigitalScholar.Zotero
|
||||||
|
winget install -e --id Anki.Anki
|
||||||
|
winget install -e --id Notion.Notion
|
||||||
|
|
||||||
|
# Browser
|
||||||
|
winget install -e --id TheBrowserCompany.Arc
|
||||||
|
winget install -e --id Mozilla.Firefox.Nightly
|
||||||
|
|
||||||
|
# Programming Languages
|
||||||
|
winget install -e --id Python.Python.3.12
|
||||||
|
winget install -e --id Anaconda.Miniconda3
|
||||||
|
winget install -e --id OpenJS.NodeJS
|
||||||
|
winget install -e --id Rustlang.Rustup
|
||||||
|
winget install -e --id Microsoft.DotNet.SDK.8
|
||||||
|
|
||||||
|
# Dev/IDE
|
||||||
|
winget install -e --id Docker.DockerDesktop
|
||||||
|
winget install -e --id JesseDuffield.lazygit
|
||||||
|
|
||||||
|
# Gaming
|
||||||
|
winget install -e --id Valve.Steam
|
||||||
|
|
||||||
|
# IME
|
||||||
|
winget install -e --id Rime.Weasel
|
||||||
|
|
||||||
|
# Social
|
||||||
|
winget install -e --id 9N97ZCKPD60Q --source msstore # Unigram (Telegram client)
|
||||||
|
winget install -e --id Tencent.QQ.NT
|
||||||
|
winget install -e --id Tencent.WeChat
|
||||||
|
|
||||||
|
# Others
|
||||||
|
winget install -e --id Appest.TickTick
|
||||||
|
|
||||||
|
# Fonts
|
||||||
|
scoop install FiraCode-NF
|
||||||
|
scoop install CascadiaCode-NF
|
||||||
|
scoop install LXGWWenKai # 霞鹜文楷
|
||||||
|
scoop install LXGWWenKaiMono # 霞鹜文楷Mono
|
||||||
0
win/setup_win_full.ps1
Normal file
0
win/setup_win_full.ps1
Normal file
86
wsl/.zshrc
Normal file
86
wsl/.zshrc
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
# ~/.config/zsh/.zshrc
|
||||||
|
# ln -s ~/.dotfiles/wsl/.zshrc ~/.config/zsh/.zshrc
|
||||||
|
### Variables ###
|
||||||
|
|
||||||
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
|
source $DOTFILES/zsh/*.zsh
|
||||||
|
export ARCHFLAGS="-arch x86_64"
|
||||||
|
|
||||||
|
# Absolute navigation
|
||||||
|
alias src="cd ~/Source && ls"
|
||||||
|
alias dotfiles="cd $DOTFILES && ls"
|
||||||
|
|
||||||
|
|
||||||
|
### WSL Options ###
|
||||||
|
|
||||||
|
# WSL open
|
||||||
|
open() {
|
||||||
|
local target=$1
|
||||||
|
|
||||||
|
if command -v explorer.exe > /dev/null; then
|
||||||
|
explorer.exe "$target"
|
||||||
|
else
|
||||||
|
command open "$target"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# WSL Neovide
|
||||||
|
gvi() {
|
||||||
|
local target=$1
|
||||||
|
|
||||||
|
if command -v neovide.exe > /dev/null; then
|
||||||
|
neovide.exe "$target"
|
||||||
|
else
|
||||||
|
if command -v neovide > /dev/null; then
|
||||||
|
neovide "$target"
|
||||||
|
else
|
||||||
|
echo "neovide is not installed"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
### Misc ###
|
||||||
|
|
||||||
|
export PATH=/opt/bin:$PATH
|
||||||
|
|
||||||
|
# Conda #
|
||||||
|
|
||||||
|
# >>> conda initialize >>>
|
||||||
|
# !! Contents within this block are managed by 'conda init' !!
|
||||||
|
__conda_setup="$('/home/js0ny/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
eval "$__conda_setup"
|
||||||
|
else
|
||||||
|
if [ -f "/home/js0ny/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||||
|
. "/home/js0ny/miniconda3/etc/profile.d/conda.sh"
|
||||||
|
else
|
||||||
|
export PATH="/home/js0ny/miniconda3/bin:$PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset __conda_setup
|
||||||
|
# <<< conda initialize <<<
|
||||||
|
|
||||||
|
# Ubuntu Command Not Found #
|
||||||
|
|
||||||
|
if [[ -x /usr/lib/command-not-found ]] ; then
|
||||||
|
if (( ! ${+functions[command_not_found_handler]} )) ; then
|
||||||
|
function command_not_found_handler {
|
||||||
|
[[ -x /usr/lib/command-not-found ]] || return 1
|
||||||
|
/usr/lib/command-not-found -- ${1+"$1"} && :
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# LinuxBrew #
|
||||||
|
|
||||||
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||||
|
# Set PATH, MANPATH, etc., for Homebrew.
|
||||||
|
|
||||||
|
# >>> juliaup initialize >>>
|
||||||
|
|
||||||
|
# !! Contents within this block are managed by juliaup !!
|
||||||
|
|
||||||
|
path=('/home/js0ny/.juliaup/bin' $path)
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
# <<< juliaup initialize <<<
|
||||||
7
zsh/.zshenv
Normal file
7
zsh/.zshenv
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# ~/.zshenv
|
||||||
|
# ln -s ~/.dotfiles/zsh/.zshenv ~/.zshenv
|
||||||
|
# This file is sourced by all zsh sessions upon startup.
|
||||||
|
|
||||||
|
# Use XDG Base Directory Specification
|
||||||
|
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
|
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
|
||||||
45
zsh/alias.zsh
Normal file
45
zsh/alias.zsh
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
# PowerShell Equivalent #
|
||||||
|
alias ni=touch
|
||||||
|
alias cls=clear
|
||||||
|
|
||||||
|
# Dev #
|
||||||
|
alias g++='g++ -std=c++2b' # Set the default C++ standard to C++20
|
||||||
|
alias gcc='gcc -std=c99' # Set the default C standard to C99
|
||||||
|
alias cl='clang -std=c99'
|
||||||
|
alias clpp='clang++ -std=c++2b'
|
||||||
|
alias python=python3 # Set the default Python version to Python 3
|
||||||
|
alias py=python # Alias for Python
|
||||||
|
alias bashcfg="nvim ~/.bashrc"
|
||||||
|
alias zshcfg="nvim ~/.zshrc"
|
||||||
|
alias shcfg=zshcfg
|
||||||
|
alias reload="source ~/.zshrc"
|
||||||
|
alias nvimrc="nvim ~/.config/nvim/"
|
||||||
|
alias ohmyzsh="code ~/.oh-my-zsh"
|
||||||
|
alias pulldots="cd $DOTFILES && git pull"
|
||||||
|
|
||||||
|
# Conda #
|
||||||
|
alias pyact="conda activate"
|
||||||
|
alias pydact="conda deactivate"
|
||||||
|
alias pylsenv="conda env list"
|
||||||
|
alias pymkenv="conda create --name"
|
||||||
|
|
||||||
|
# Editors #
|
||||||
|
alias v=nvim
|
||||||
|
alias c=code
|
||||||
|
|
||||||
|
# Misc #
|
||||||
|
alias cf=cfiles
|
||||||
|
|
||||||
|
# Functions #
|
||||||
|
mcd() {
|
||||||
|
mkdir -p -- "$0" && cd -P -- "$1"
|
||||||
|
}
|
||||||
|
cdls(){
|
||||||
|
cd $1 && ls
|
||||||
|
}
|
||||||
|
tc(){
|
||||||
|
touch $1 && code $1
|
||||||
|
}
|
||||||
|
tv(){
|
||||||
|
touch $1 && nvim $1
|
||||||
|
}
|
||||||
24
zsh/config.zsh
Normal file
24
zsh/config.zsh
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
### ZSH Config ###
|
||||||
|
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||||
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
ZSH_THEME="avit"
|
||||||
|
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||||
|
# DISABLE_LS_COLORS="true"
|
||||||
|
# DISABLE_AUTO_TITLE="true"
|
||||||
|
# ENABLE_CORRECTION="true"
|
||||||
|
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||||
|
# You can also set it to another string to have that shown instead of the default red dots.
|
||||||
|
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
|
||||||
|
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
|
||||||
|
# COMPLETION_WAITING_DOTS="true"
|
||||||
|
# Uncomment the following line if you want to disable marking untracked files
|
||||||
|
# under VCS as dirty. This makes repository status check for large repositories
|
||||||
|
# much, much faster.
|
||||||
|
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||||
|
HIST_STAMPS="yyyy-mm-dd"
|
||||||
|
plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions)
|
||||||
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
source .private.env.sh
|
||||||
|
|
||||||
|
# export MANPATH="/usr/local/man:$MANPATH"
|
||||||
|
# export LANG= "en_US.UTF-8"
|
||||||
20
zsh/keymap.zsh
Normal file
20
zsh/keymap.zsh
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
# ~/.dotfiles/keymap.zsh
|
||||||
|
bindkey -v # Vi Keybindings
|
||||||
|
|
||||||
|
# Colemak hnei
|
||||||
|
# bindkey -M vicmd 'h' vi-backward-char # No change
|
||||||
|
bindkey -M vicmd 'n' down-line-or-history
|
||||||
|
bindkey -M vicmd 'e' up-line-or-history
|
||||||
|
bindkey -M vicmd 'i' vi-forward-char
|
||||||
|
|
||||||
|
# Similar position to [i] in QWERTY
|
||||||
|
bindkey -M vicmd 'l' vi-insert
|
||||||
|
bindkey -M vicmd 'L' vi-insert-bol
|
||||||
|
# Ne{[k]s}t
|
||||||
|
bindkey -M vicmd 'k' vi-repeat-search
|
||||||
|
bindkey -M vicmd 'K' vi-rev-repeat-search
|
||||||
|
# [J]ump
|
||||||
|
bindkey -M vicmd 'j' vi-forward-word-end
|
||||||
|
bindkey -M vicmd 'J' vi-forward-blank-word-end
|
||||||
|
# Use N to Join
|
||||||
|
bindkey -M vicmd 'N' vi-join
|
||||||
7
zsh/navi.zsh
Normal file
7
zsh/navi.zsh
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
# Relative navigation
|
||||||
|
alias ..="cd .."
|
||||||
|
alias ...="cd ../.."
|
||||||
|
alias ....="cd ../../.."
|
||||||
|
alias .....="cd ../../../.."
|
||||||
|
alias ......="cd ../../../../.."
|
||||||
Loading…
Add table
Add a link
Reference in a new issue