From d14df507e83b75361f8735897be709a0b79fbb33 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 20 Nov 2024 14:45:10 +0000 Subject: [PATCH] fix: shell script to lf from crlf --- .editorconfig | 4 +- .obsidian.vimrc | 118 +++++++++++++++++++++---------------------- mac/.zshrc | 88 ++++++++++++++++---------------- mac/set_mirror.sh | 66 ++++++++++++------------ mirror/set_mirror.sh | 44 ++++++++-------- zsh/.zshenv | 40 +++++++-------- zsh/keymap.zsh | 38 +++++++------- zsh/navi.zsh | 16 +++--- 8 files changed, 208 insertions(+), 206 deletions(-) diff --git a/.editorconfig b/.editorconfig index 2528ba8..7a14577 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,12 +4,14 @@ root = true [*] charset = utf-8 -end_of_line = lf insert_final_newline = true indent_style = space indent_size = 4 trim_trailing_whitespace = true +[*.{sh,zsh,zshrc,zshenv,bashrc}] +end_of_line = lf + [*.md] trim_trailing_whitespace = false indent_style = space diff --git a/.obsidian.vimrc b/.obsidian.vimrc index 01679ea..09c7427 100644 --- a/.obsidian.vimrc +++ b/.obsidian.vimrc @@ -1,59 +1,59 @@ -" Put this in OBSIDIAN_VAULT/.obsidian.vimrc -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 -exmap addbold obcommand editor:toogle-bold -exmap additalic obcommand editor:toogle-italic -exmap addhighlight obcommand editor:toogle-highlight -exmap addcode obcommand editor:toogle-code -exmap adddel obcommand editor:toogle-strikethrough -vnoremap ~ :adddel " Add delete to selection -vnoremap ` c`"` " editor:toogle-code is buggy -vnoremap * :addbold " Add bold to selection -vnoremap _ :additalic " Add italic to selection -vnoremap = :addhighlight " Add highlight to selection - -exmap prevtab obcommand workspace:previous-tab -exmap nexttab obcommand workspace:next-tab -nnoremap H :prevtab -nnoremap I :nexttab - -exmap reload :source .obsidian.vimrc - -unmap -exmap vsplit obcommand workspace:split-vertical -exmap hsplit obcommand workspace:split-horizontal -map | :vsplit -map - :hsplit -" map bd - -exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt -map ai :chat - -exmap omnisearch obcommand omnisearch:show-modal -map :omnisearch - -exmap command-palette obcommand command-palette:open -map : :command-palette - -""" g-commands -exmap tsource obcommand editor:toggle-source -nnoremap gs :tsource +" Put this in OBSIDIAN_VAULT/.obsidian.vimrc +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 +exmap addbold obcommand editor:toogle-bold +exmap additalic obcommand editor:toogle-italic +exmap addhighlight obcommand editor:toogle-highlight +exmap addcode obcommand editor:toogle-code +exmap adddel obcommand editor:toogle-strikethrough +vnoremap ~ :adddel " Add delete to selection +vnoremap ` c`"` " editor:toogle-code is buggy +vnoremap * :addbold " Add bold to selection +vnoremap _ :additalic " Add italic to selection +vnoremap = :addhighlight " Add highlight to selection + +exmap prevtab obcommand workspace:previous-tab +exmap nexttab obcommand workspace:next-tab +nnoremap H :prevtab +nnoremap I :nexttab + +exmap reload :source .obsidian.vimrc + +unmap +exmap vsplit obcommand workspace:split-vertical +exmap hsplit obcommand workspace:split-horizontal +map | :vsplit +map - :hsplit +" map bd + +exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt +map ai :chat + +exmap omnisearch obcommand omnisearch:show-modal +map :omnisearch + +exmap command-palette obcommand command-palette:open +map : :command-palette + +""" g-commands +exmap tsource obcommand editor:toggle-source +nnoremap gs :tsource diff --git a/mac/.zshrc b/mac/.zshrc index 8e06b87..afefec8 100644 --- a/mac/.zshrc +++ b/mac/.zshrc @@ -1,44 +1,44 @@ -# $XDG_CONFIG_HOME/zsh/.zshrc -# ln -s $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc -### Variables ### - -export DOTFILES="$HOME/.dotfiles" -export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH -for file in $DOTFILES/zsh/*.zsh; do - source $file -done -export ARCHFLAGS="-arch arm64" - -### Navigation ### -# Absolute navigation -alias doku="cd ~/doku && ls" -alias dotfiles="cd $DOTFILES && ls" -alias docs="cd ~/Documents" -alias dt="cd ~/Desktop" -alias down="cd ~/Downloads" -alias one="cd ~/OneDrive" -alias gdrive="cd ~/Google\ Drive" - -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! -__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then - . "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" - else - export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH" - fi -fi -unset __conda_setup -# <<< conda initialize <<< - -# >>> juliaup initialize >>> - -# !! Contents within this block are managed by juliaup !! - -path=('$HOME/.juliaup/bin' $path) -export PATH - -# <<< juliaup initialize <<< +# $XDG_CONFIG_HOME/zsh/.zshrc +# ln -s $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc +### Variables ### + +export DOTFILES="$HOME/.dotfiles" +export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH +for file in $DOTFILES/zsh/*.zsh; do + source $file +done +export ARCHFLAGS="-arch arm64" + +### Navigation ### +# Absolute navigation +alias doku="cd ~/doku && ls" +alias dotfiles="cd $DOTFILES && ls" +alias docs="cd ~/Documents" +alias dt="cd ~/Desktop" +alias down="cd ~/Downloads" +alias one="cd ~/OneDrive" +alias gdrive="cd ~/Google\ Drive" + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then + . "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" + else + export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< + +# >>> juliaup initialize >>> + +# !! Contents within this block are managed by juliaup !! + +path=('$HOME/.juliaup/bin' $path) +export PATH + +# <<< juliaup initialize <<< diff --git a/mac/set_mirror.sh b/mac/set_mirror.sh index b5454d3..1c7b27b 100644 --- a/mac/set_mirror.sh +++ b/mac/set_mirror.sh @@ -1,33 +1,33 @@ -# pip -alias pip=pip3 -alias python=python3 -python -m pip install --upgrade pip -pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -# npm -npm config set registry https://registry.npmmirror.com - - - -# Homebrew -# 手动设置 -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" - -# 注:自 brew 4.0 起,大部分 Homebrew 用户无需设置 homebrew/core 和 homebrew/cask 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 -# 如果需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 和 homebrew/cask 镜像。 -# 请按需执行如下两行命令: -brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git -brew tap --custom-remote --force-auto-update homebrew/cask https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git - -# 除 homebrew/core 和 homebrew/cask 仓库外的 tap 仓库仍然需要设置镜像 -brew tap --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git -brew tap --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git -brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git -brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git -brew update - -# 或使用下面的几行命令自动设置 -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" -for tap in core cask{,-fonts,-versions} command-not-found services; do - brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git" -done -brew update +# pip +alias pip=pip3 +alias python=python3 +python -m pip install --upgrade pip +pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple +# npm +npm config set registry https://registry.npmmirror.com + + + +# Homebrew +# 手动设置 +export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" + +# 注:自 brew 4.0 起,大部分 Homebrew 用户无需设置 homebrew/core 和 homebrew/cask 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 +# 如果需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 和 homebrew/cask 镜像。 +# 请按需执行如下两行命令: +brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git +brew tap --custom-remote --force-auto-update homebrew/cask https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git + +# 除 homebrew/core 和 homebrew/cask 仓库外的 tap 仓库仍然需要设置镜像 +brew tap --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git +brew tap --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git +brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git +brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git +brew update + +# 或使用下面的几行命令自动设置 +export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" +for tap in core cask{,-fonts,-versions} command-not-found services; do + brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git" +done +brew update diff --git a/mirror/set_mirror.sh b/mirror/set_mirror.sh index 6f5df72..1c04b24 100644 --- a/mirror/set_mirror.sh +++ b/mirror/set_mirror.sh @@ -1,22 +1,22 @@ -# pip -alias pip=pip3 -alias python=python3 -python -m pip install --upgrade pip -pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -# npm -npm config set registry https://registry.npmmirror.com - - - -# Linuxbrew -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" - -# 注:自 brew 4.0 起,使用默认 prefix (即 "/home/linuxbrew/.linuxbrew") 的大部分 Homebrew 用户无需设置 homebrew/core 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 -# 如果不是默认 prefix 或者需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 镜像。 -# 请按需执行如下命令: -brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git - -# 除 homebrew/core 仓库外的 tap 仓库仍然需要设置镜像 -brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git -brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git -brew update \ No newline at end of file +# pip +alias pip=pip3 +alias python=python3 +python -m pip install --upgrade pip +pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple +# npm +npm config set registry https://registry.npmmirror.com + + + +# Linuxbrew +export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" + +# 注:自 brew 4.0 起,使用默认 prefix (即 "/home/linuxbrew/.linuxbrew") 的大部分 Homebrew 用户无需设置 homebrew/core 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 +# 如果不是默认 prefix 或者需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 镜像。 +# 请按需执行如下命令: +brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git + +# 除 homebrew/core 仓库外的 tap 仓库仍然需要设置镜像 +brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git +brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git +brew update diff --git a/zsh/.zshenv b/zsh/.zshenv index d8106ef..9c83239 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,20 +1,20 @@ -# ~/.zshenv -# ln -s $DOTFILES/zsh/.zshenv $ZDOTDIR/.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 XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" -export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" -export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" -export XDG_RUNTIME_DIR="/run/user/$(id -u)" -# Disable shell sessions on macOS when using default terminal -SHELL_SESSIONS_DISABLE=1 - -# Zsh -export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" - -# Also put in /etc/zsh/zshenv -# or /etc/zshenv in macOS -# sudo cp $DOTFILES/zsh/.zshenv /etc/zsh/zshenv -# sudo cp $DOTFILES/zsh/.zshenv /etc/zshenv +# ~/.zshenv +# ln -s $DOTFILES/zsh/.zshenv $ZDOTDIR/.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 XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" +export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" +export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" +export XDG_RUNTIME_DIR="/run/user/$(id -u)" +# Disable shell sessions on macOS when using default terminal +SHELL_SESSIONS_DISABLE=1 + +# Zsh +export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" + +# Also put in /etc/zsh/zshenv +# or /etc/zshenv in macOS +# sudo cp $DOTFILES/zsh/.zshenv /etc/zsh/zshenv +# sudo cp $DOTFILES/zsh/.zshenv /etc/zshenv diff --git a/zsh/keymap.zsh b/zsh/keymap.zsh index 0639b89..32cceb0 100644 --- a/zsh/keymap.zsh +++ b/zsh/keymap.zsh @@ -1,20 +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 +# $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 \ No newline at end of file diff --git a/zsh/navi.zsh b/zsh/navi.zsh index 1b24b16..27e008f 100644 --- a/zsh/navi.zsh +++ b/zsh/navi.zsh @@ -1,9 +1,9 @@ - -# Relative navigation -alias ..="cd .." -alias ...="cd ../.." -alias ....="cd ../../.." -alias .....="cd ../../../.." -alias ......="cd ../../../../.." - + +# Relative navigation +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." +alias ......="cd ../../../../.." + eval "$(zoxide init zsh)" \ No newline at end of file