feat(zsh, ipython): New symblink scripts, IPython linked with directory

This commit is contained in:
js0ny 2024-11-30 02:03:30 +00:00
parent fdf460a547
commit f69dc967e0
12 changed files with 75 additions and 37 deletions

7
.gitignore vendored
View file

@ -15,13 +15,6 @@ test.*
# Utils
xdg-ninja/
# IPython config cache
tools/ipython/profile_default/db
tools/ipython/profile_default/log
tools/ipython/profile_default/pid
tools/ipython/profile_default/security
tools/ipython/profile_default/history.sqlite
# nvim config cache
tools/nvim/tt.*
tools/nvim/.tests

View file

@ -13,10 +13,14 @@
"nvim/init.lua": "vim",
"markdownlint.json": "markdownlint",
".wslconfig": "settings",
"*.hsnips": ""
},
"material-icon-theme.folders.associations": {
"bootstrap": "admin"
"bootstrap": "admin",
"ipython": "jupyter",
"zsh": "command",
"starship": "ui",
"nvim": "config",
"wsl": "linux"
},
"files.associations": {
"ideavimrc": "Vimscript",

View file

@ -1,8 +1,7 @@
#! /bin/sh
# This script is used to setup a new mac
# In a new mac (Sequoia)
# Enter the following command in the terminal
#! curl -fsSL https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/setup/mac_setup.sh | sh # Do not use this command
#! /bin/zsh
# $DOTFILES/bootstrap/macOS.zsh
# Run this script to set up macOS
# 运行此脚本以设置 macOS
echo "Running the setup script"
@ -11,6 +10,9 @@ echo "[INFO] Installing Xcode Command Line Tools"
echo "[ACTION] Request Human Takeover"
xcode-select --install
# Press any key to continue (if Xcode Command Line Tools are installed)
read -n 1 -s -r -p "Press any key to continue when xcode CLI tools are installed"
# System Preferences
# Installation Sources
echo "[INFO] Setting Installation Sources"

View file

@ -0,0 +1,24 @@
#! /bin/bash
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython
mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory
# mkdir -p $WAKATIME_HOME
# mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view
mkdir -p $HOME/Obsidian
# $DOTFILES/common
ln -sf $DOTFILES/common/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc
ln -sf $DOTFILES/common/gitconfig $XDG_CONFIG_HOME/git/config
ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml
ln -sf $DOTFILES/common/haskeline ~/.haskeline
ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc
ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey
ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG
ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
ln -sf $DOTFILES/common/obsidian.vimrc $HOME/Obsidian/.obsidian.vimrc
ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf
ln -sf $DOTFILES/common/vimrc $XDG_CONFIG_HOME/vim/vimrc
ln -sf $DOTFILES/common/zellij.config.kdl ~/.config/zellij/config.kdl
# $DOTFILES/tools
ln -sf $DOTFILES/tools/ipython $XDG_CONFIG_HOME/ipython
ln -sf $DOTFILES/tools/nvim $XDG_CONFIG_HOME/nvim

View file

@ -1,22 +0,0 @@
#! /bin/sh
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm
mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory
mkdir -p $WAKATIME_HOME
mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view
# $DOTFILES/.config
ln -sf $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc
ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config
ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
ln -sf $DOTFILES/.config/markdownlint/.markdownlint.json $XDG_CONFIG_HOME/markdownlint/markdownlint.json
ln -sf $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG
ln -sf $DOTFILES/.config/NuGet/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim
ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf
ln -sf $DOTFILES/.config/vim/vimrc $XDG_CONFIG_HOME/vim/vimrc
ln -sf $DOTFILES/.config/zellij/config.kdl ~/.config/zellij/config.kdl
ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey
# $DOTFILES/vscode
ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode.vimrc
# $DOTFILES root
ln -sf $DOTFILES/.haskeline ~/.haskeline

View file

@ -1,3 +1,4 @@
#!/bin/zsh
# $DOTFILES/scripts/update.zsh
# call by `update` alias defined in tools/zsh/alias.zsh
# 使用别名 `update` 引用,别名定义于 tools/zsh/alias.zsh

6
tools/ipython/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
# IPython config cache
*/db/
*/log/
*/pid/
*/security/
*/history.sqlite

View file

@ -0,0 +1,11 @@
This is the IPython startup directory
.py and .ipy files in this directory will be run *prior* to any code or files specified
via the exec_lines or exec_files configurables whenever you load this profile.
Files will be run in lexicographical order, so you can control the execution order of files
with a prefix, e.g.::
00-first.py
50-middle.py
99-last.ipy

View file

@ -0,0 +1,11 @@
This is the IPython startup directory
.py and .ipy files in this directory will be run *prior* to any code or files specified
via the exec_lines or exec_files configurables whenever you load this profile.
Files will be run in lexicographical order, so you can control the execution order of files
with a prefix, e.g.::
00-first.py
50-middle.py
99-last.ipy

View file

@ -2,7 +2,7 @@ from IPython.core.magic import register_line_magic
@register_line_magic
def ps(cmd):
output = get_ipython().getoutput(f"powershell -Command {cmd}")
output = get_ipython().getoutput(f"pwsh -NoProfile -Command {cmd}")
# If no variable is assigned to the output, print it
if get_ipython().last_execution_result is None:
print("\n".join(output))

8
tools/zsh/mod/env.zsh Normal file
View file

@ -0,0 +1,8 @@
# $DOTFILES/tools/zsh/mod/env.zsh
# Sourced by user's zshrc 在用户的 zshrc 中被引用
# This file stores only environment variables that only called by
# interactive session.
# 这个文件只存储只在交互式会话中调用的环境变量。
export IPYTHONDIR="$XDG_CONFIG_HOME"/ipython