mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
chezmoi: bash, ipython, sioyek, zed
This commit is contained in:
parent
295f94ddb9
commit
81da252906
32 changed files with 51 additions and 644 deletions
134
dot_config/bash/bash_aliases
Normal file
134
dot_config/bash/bash_aliases
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
# vim:ft=bash
|
||||
# This should be in
|
||||
# ~/.bash_aliases
|
||||
# or in if antidots and wheel
|
||||
# ~/.config/bash/bash_aliases
|
||||
if command -v zoxide >/dev/null; then
|
||||
eval "$(zoxide init bash)"
|
||||
# Relative navigation #
|
||||
alias ..="z .."
|
||||
alias ...="z ../.."
|
||||
alias ....="z ../../.."
|
||||
alias .....="z ../../../.."
|
||||
alias ......="z ../../../../.."
|
||||
# Use `-` to jump to the previous directory
|
||||
# Oh-My-Zsh defines a similar one
|
||||
-() {
|
||||
z -
|
||||
}
|
||||
zls() {
|
||||
cd $1 && ls
|
||||
}
|
||||
else
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias ......="cd ../../../../.."
|
||||
-() {
|
||||
cd -
|
||||
}
|
||||
fi
|
||||
|
||||
alias ni=touch
|
||||
alias cls=clear
|
||||
alias ii=open
|
||||
|
||||
# Editors #
|
||||
alias v=nvim
|
||||
alias c=code
|
||||
# Use neovide as gVim
|
||||
alias gvi="neovide"
|
||||
alias svi="sudo vim -u ~/.dotfiles/common/vim.noxdg.vimrc" # Prevent conflicts with svelte-cli
|
||||
alias sn="sudo nvim -u ~/.config/nvim/init.lua"
|
||||
|
||||
# Dev #
|
||||
alias gpp='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 ipy=ipython
|
||||
|
||||
alias g=lazygit
|
||||
|
||||
alias doomd="emacsclient -t ~/.config/doom/"
|
||||
|
||||
# lsd - modern ls
|
||||
if command -v lsd >/dev/null; then
|
||||
alias ls='lsd'
|
||||
alias l='lsd -lah'
|
||||
alias ll='lsd -l'
|
||||
alias la='lsd -A'
|
||||
alias l.='lsd -d .*'
|
||||
alias tree='lsd --tree -A'
|
||||
else
|
||||
alias l='ls -lah'
|
||||
alias ll='ls -l'
|
||||
fi
|
||||
|
||||
# Functions #
|
||||
mkcd() {
|
||||
mkdir -p $1 && cd $1
|
||||
}
|
||||
cdls() {
|
||||
cd $1 && ls
|
||||
}
|
||||
tc() {
|
||||
touch $1 && code $1
|
||||
}
|
||||
tv() {
|
||||
touch $1 && nvim $1
|
||||
}
|
||||
mt() {
|
||||
mkdir -p $(dirname $1) && touch $1
|
||||
}
|
||||
mtv() {
|
||||
mkdir -p $(dirname $1) && touch $1 && nvim $1
|
||||
}
|
||||
|
||||
alias update="source $DOTFILES/scripts/update.zsh"
|
||||
|
||||
if command -v pacman >/dev/null; then
|
||||
alias pac="sudo pacman"
|
||||
alias paci="sudo pacman -S"
|
||||
alias pacr="sudo pacman -R"
|
||||
alias pacu="sudo pacman -Syu"
|
||||
alias pacl="pacman -Q"
|
||||
if command -v paru >/dev/null; then
|
||||
alias pacs="paru -Ss"
|
||||
elif command -v yay >/dev/null; then
|
||||
alias pacs="yay -Ss"
|
||||
else
|
||||
alias pacs="pacman -Ss"
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v apt >/dev/null; then
|
||||
alias apt="sudo apt"
|
||||
alias apti="sudo apt install"
|
||||
alias aptr="sudo apt remove"
|
||||
alias aptu="sudo apt update && sudo apt upgrade"
|
||||
alias apts="apt search"
|
||||
alias aptl="apt list --installed"
|
||||
fi
|
||||
|
||||
if command -v brew >/dev/null; then
|
||||
alias brewi="brew install"
|
||||
alias brewr="brew uninstall"
|
||||
alias brewu="brew update && brew upgrade"
|
||||
alias brews="brew search"
|
||||
alias brewl="brew list"
|
||||
fi
|
||||
|
||||
# TODO: Does not work
|
||||
if [ "$TERM" = "xterm-ghostty" ] || [ "$TERM" = "xterm-kitty" ]; then
|
||||
alias icat="kitten icat"
|
||||
elif [ "$TERM_PROGRAM" = "WezTerm" ]; then
|
||||
if [ -n "$WSL_DISTRO_NAME" ]; then
|
||||
alias icat="wezterm.exe imgcat"
|
||||
else
|
||||
alias icat="wezterm imgcat"
|
||||
fi
|
||||
fi
|
||||
33
dot_config/bash/bashrc
Normal file
33
dot_config/bash/bashrc
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# vim:ft=bash
|
||||
# If wheel and antidots:
|
||||
# ln -sf $DOTFILES/tools/bash/profile ~/.config/bash/bashrc
|
||||
# If not wheel or antidots:
|
||||
# ln -sf $DOTFILES/tools/bash/bashrc ~/.bashrc
|
||||
|
||||
export DOTFILES=$HOME/.dotfiles
|
||||
# Force to choose English font name
|
||||
export LC_CTYPE=en_GB.UTF-8
|
||||
|
||||
if [ -n "$WSL_DISTRO_NAME" ]; then
|
||||
alias clip="clip.exe"
|
||||
alias paste="pwsh.exe -NoProfile -Command 'Get-Clipboard'"
|
||||
elif [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
alias clip="wl-copy"
|
||||
alias paste="wl-paste"
|
||||
elif [ -n "$DISPLAY" ]; then
|
||||
alias clip="xclip"
|
||||
fi
|
||||
|
||||
source "$DOTFILES"/tools/bash/bash_aliases # For compatibility
|
||||
|
||||
export IPYTHONDIR="$XDG_CONFIG_HOME"/ipython
|
||||
|
||||
if command -v fzf >/dev/null; then
|
||||
eval "$(fzf --bash)"
|
||||
fi
|
||||
|
||||
if command -v starship >/dev/null; then
|
||||
eval "$(starship init bash)"
|
||||
fi
|
||||
#
|
||||
# bind 'set show-mode-in-prompt off'
|
||||
3
dot_config/bash/global.bashrc
Normal file
3
dot_config/bash/global.bashrc
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#:vim: set ft=bash:
|
||||
test -f $HOME/.config/bash/bashrc && source $HOME/.config/bash/bashrc
|
||||
test -f $HOME/.bashrc && source $HOME/.bashrc
|
||||
176
dot_config/bash/profile
Normal file
176
dot_config/bash/profile
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
# vim:ft=bash
|
||||
# Put this file in $XDG_CONFIG_HOME/bash/profile
|
||||
# This file is sourced by /etc/profile.d/xdg-compat.sh
|
||||
# and will source user's XDG-compliant Bash Run Commands
|
||||
|
||||
# If no admin rights, just
|
||||
# ln -sf $DOTFILES/tools/bash/profile ~/.bash_profile
|
||||
|
||||
# Before antidots
|
||||
if [ -n "$BASH_VERSION" ] && [ -f "$HOME/.bash_profile" ]; then
|
||||
. "$HOME/.bash_profile"
|
||||
fi
|
||||
|
||||
if [ -n "$BASH_VERSION" ] && [ -f "$XDG_CONFIG_HOME/bash/bashrc" ]; then
|
||||
. "$XDG_CONFIG_HOME/bash/bashrc"
|
||||
fi
|
||||
|
||||
pathadd() {
|
||||
# 检查是否存在且不在 PATH 中
|
||||
if [[ -d "$1" && ":$PATH:" != *":$1:"* ]]; then
|
||||
# 检查是否是符号链接
|
||||
if [[ -L "$1" ]]; then
|
||||
# 检查符号链接指向的目标是否存在
|
||||
if [[ -e "$1" ]]; then
|
||||
PATH="$1:$PATH"
|
||||
fi
|
||||
else
|
||||
# 普通目录直接添加
|
||||
PATH="$1:$PATH"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Dynamically Add Path
|
||||
minimal_path=(
|
||||
"/bin"
|
||||
"/sbin"
|
||||
"/usr/bin"
|
||||
"/usr/sbin"
|
||||
"/usr/local/bin"
|
||||
"/usr/local/sbin"
|
||||
"$HOME/.local/bin"
|
||||
"$HOME/.local/sbin"
|
||||
"$HOME/.local/scripts"
|
||||
)
|
||||
|
||||
export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
|
||||
|
||||
for p in "${minimal_path[@]}"; do
|
||||
pathadd "$p"
|
||||
done
|
||||
|
||||
if [ -d "/opt/homebrew/bin" ]; then # macOS
|
||||
export PATH="/opt/homebrew/bin:$PATH"
|
||||
elif [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then # Linux
|
||||
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
|
||||
fi
|
||||
|
||||
# macOS Specific
|
||||
# This syntax is POSIX standard, for portability
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
: # Do nothing
|
||||
fi
|
||||
|
||||
# Linux Specific
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
# CUDA
|
||||
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
|
||||
fi
|
||||
|
||||
# Azure CLI
|
||||
if command -v az > /dev/null; then
|
||||
export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure
|
||||
fi
|
||||
# Bun JS
|
||||
# mv ~/.bun $XDG_DATA_HOME/bun
|
||||
# ln -sf $XDG_DATA_HOME/bun/bin/bun ~/.local/bin/bun
|
||||
if command -v bun > /dev/null; then
|
||||
export BUN_INSTALL="$XDG_DATA_HOME"/bun
|
||||
export PATH="$BUN_INSTALL/bin:$PATH"
|
||||
[ -s "$BUN_INSTALL/_bun" ] && source "$BUN_INSTALL/_bun"
|
||||
fi
|
||||
# Cargo
|
||||
if command -v cargo > /dev/null; then
|
||||
export CARGO_HOME="$XDG_DATA_HOME"/cargo
|
||||
export PATH="$CARGO_HOME/bin:$PATH"
|
||||
fi
|
||||
# CGDB
|
||||
if command -v cgdb > /dev/null; then
|
||||
export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb
|
||||
fi
|
||||
# .NET
|
||||
if command -v dotnet > /dev/null; then
|
||||
export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet
|
||||
export PATH="$DOTNET_CLI_HOME/.dotnet/tools:$PATH"
|
||||
fi
|
||||
# Docker
|
||||
if command -v docker > /dev/null; then
|
||||
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
|
||||
fi
|
||||
# GnuPG
|
||||
if command -v gpg > /dev/null; then
|
||||
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
|
||||
fi
|
||||
# Go
|
||||
export GOPATH="$XDG_DATA_HOME"/go
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
# Julia
|
||||
if command -v julia > /dev/null; then
|
||||
export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH"
|
||||
fi
|
||||
# Node.js
|
||||
if command -v node > /dev/null; then
|
||||
export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history
|
||||
export TS_NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/ts_node_repl_history
|
||||
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
|
||||
export NPM_CONFIG_INIT_MODULE="$XDG_CONFIG_HOME"/npm/config/npm-init.js
|
||||
export NPM_CONFIG_CACHE="$XDG_CACHE_HOME"/npm
|
||||
export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm
|
||||
fi
|
||||
# Parallel
|
||||
if command -v parallel > /dev/null; then
|
||||
export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel
|
||||
fi
|
||||
# Python
|
||||
# Works only with Python 3.13.0a3 and later
|
||||
if command -v python3 > /dev/null; then
|
||||
export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history
|
||||
fi
|
||||
# GNU Screen
|
||||
if command -v screen > /dev/null; then
|
||||
export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
|
||||
export SCREENDIR="${XDG_RUNTIME_DIR}/screen"
|
||||
fi
|
||||
# Ruby Gem
|
||||
# Ruby Gem
|
||||
if command -v gem > /dev/null; then
|
||||
for dir in "$HOME/.local/share/gem/ruby/"*/bin; do
|
||||
if [ -d "$dir" ]; then
|
||||
export PATH="$dir:$PATH"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Spacemacs
|
||||
if command -v emacs > /dev/null; then
|
||||
export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs
|
||||
fi
|
||||
# tldr
|
||||
# Works only with C client (did not verify)
|
||||
if command -v tldr > /dev/null; then
|
||||
export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr
|
||||
fi
|
||||
# W3M
|
||||
if command -v w3m > /dev/null; then
|
||||
export W3M_DIR="$XDG_DATA_HOME"/w3m
|
||||
fi
|
||||
# Wakatime
|
||||
if command -v wakatime > /dev/null; then
|
||||
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
|
||||
fi
|
||||
# Wget
|
||||
if command -v wget > /dev/null; then
|
||||
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
|
||||
fi
|
||||
# zsh .zcompdump
|
||||
# compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
||||
# Vcpkg
|
||||
if command -v vcpkg > /dev/null; then
|
||||
export VCPKG_ROOT="$XDG_DATA_HOME"/vcpkg
|
||||
fi
|
||||
|
||||
|
||||
export PADER="less -R"
|
||||
export EDITOR="nvim"
|
||||
export VISUAL="nvim"
|
||||
19
dot_config/bash/xdg-compat.sh
Normal file
19
dot_config/bash/xdg-compat.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# $DOTFILES/tools/bash/xdg-compat.sh
|
||||
# Author: js0ny
|
||||
# Date: 2025-01-28
|
||||
# Sourced by /etc/profile
|
||||
|
||||
# Location: /etc/profile.d/xdg-compat.sh
|
||||
# cp $DOTFILES/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh
|
||||
|
||||
# Set XDG Base Directory Path
|
||||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
export XDG_CACHE_HOME="$HOME/.cache"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
export XDG_STATE_HOME="$HOME/.local/state"
|
||||
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
|
||||
|
||||
# Source user's XDG-compliant Bash configs
|
||||
if [ -f "$XDG_CONFIG_HOME/bash/profile" ]; then
|
||||
. "$XDG_CONFIG_HOME/bash/profile"
|
||||
fi
|
||||
6
dot_config/ipython/dot_gitignore
Normal file
6
dot_config/ipython/dot_gitignore
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# IPython config cache
|
||||
*/db/
|
||||
*/log/
|
||||
*/pid/
|
||||
*/security/
|
||||
*/history.sqlite
|
||||
0
dot_config/ipython/profile_default/db/.keep
Normal file
0
dot_config/ipython/profile_default/db/.keep
Normal file
BIN
dot_config/ipython/profile_default/history.sqlite
Normal file
BIN
dot_config/ipython/profile_default/history.sqlite
Normal file
Binary file not shown.
43
dot_config/ipython/profile_default/ipython_config.py
Normal file
43
dot_config/ipython/profile_default/ipython_config.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
c.TerminalIPythonApp.display_banner = False
|
||||
c.TerminalInteractiveShell.editing_mode = 'vi'
|
||||
c.TerminalInteractiveShell.confirm_exit = False
|
||||
|
||||
# Source: https://ipython.readthedocs.io/en/stable/config/details.html#keyboard-shortcuts
|
||||
def custom_return(shell):
|
||||
|
||||
"""This function is required by the API. It takes a reference to
|
||||
the shell, which is the same thing `get_ipython()` evaluates to.
|
||||
This function must return a function that handles each keypress
|
||||
event. That function, named `handle` here, references `shell`
|
||||
by closure."""
|
||||
|
||||
def handle(event):
|
||||
|
||||
"""This function is called each time `Enter` is pressed,
|
||||
and takes a reference to a Prompt Toolkit event object.
|
||||
If the current input starts with a bang or modulo, then
|
||||
the input is executed, otherwise a newline is entered,
|
||||
followed by any spaces needed to auto-indent."""
|
||||
|
||||
# set up a few handy references to nested items...
|
||||
|
||||
buffer = event.current_buffer
|
||||
document = buffer.document
|
||||
text = document.text
|
||||
|
||||
if text.startswith('!') or text.startswith('%'): # execute the input...
|
||||
|
||||
buffer.accept_action.validate_and_handle(event.cli, buffer)
|
||||
|
||||
else: # insert a newline with auto-indentation...
|
||||
|
||||
if document.line_count > 1: text = text[:document.cursor_position]
|
||||
indent = shell.check_complete(text)[1]
|
||||
buffer.insert_text('\n' + indent)
|
||||
|
||||
# if you just wanted a plain newline without any indentation, you
|
||||
# could use `buffer.insert_text('\n')` instead of the lines above
|
||||
|
||||
return handle
|
||||
|
||||
c.TerminalInteractiveShell.handle_return = custom_return
|
||||
0
dot_config/ipython/profile_default/log/.keep
Normal file
0
dot_config/ipython/profile_default/log/.keep
Normal file
11
dot_config/ipython/profile_default/startup/README
Normal file
11
dot_config/ipython/profile_default/startup/README
Normal 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
|
||||
69
dot_config/ipython/profile_default/startup/keymap.py
Normal file
69
dot_config/ipython/profile_default/startup/keymap.py
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
from prompt_toolkit.key_binding import KeyBindings
|
||||
from prompt_toolkit.key_binding.vi_state import InputMode
|
||||
from prompt_toolkit.filters import Condition
|
||||
from IPython import get_ipython
|
||||
|
||||
ip = get_ipython()
|
||||
key_bindings = KeyBindings()
|
||||
|
||||
@Condition
|
||||
def in_navigation_mode():
|
||||
return ip.pt_app.app.vi_state.input_mode == InputMode.NAVIGATION
|
||||
|
||||
# colemak keymap hnei
|
||||
@key_bindings.add("n", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor down by visual line"
|
||||
event.current_buffer.auto_down(count=event.arg)
|
||||
|
||||
@key_bindings.add("e", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor up by visual line"
|
||||
event.current_buffer.auto_up(count=event.arg)
|
||||
|
||||
@key_bindings.add("i", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor right"
|
||||
event.current_buffer.cursor_right(count=event.arg)
|
||||
|
||||
# Insert with 'l' and 'L'
|
||||
@key_bindings.add("l", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Enter insert mode (similar position to 'i' in Colemak)"
|
||||
event.app.vi_state.input_mode = InputMode.INSERT
|
||||
|
||||
@key_bindings.add("L", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Enter insert mode at the beginning of the line"
|
||||
event.current_buffer.cursor_position += event.current_buffer.document.get_start_of_line_position()
|
||||
|
||||
# Ne[k]st
|
||||
@key_bindings.add("k", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Find next match"
|
||||
event.current_buffer.forward_search()
|
||||
|
||||
@key_bindings.add("K", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Find previous match"
|
||||
event.current_buffer.reverse_search()
|
||||
|
||||
# [J]ump
|
||||
@key_bindings.add("j", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move to end of next word"
|
||||
event.current_buffer.cursor_right_word()
|
||||
|
||||
@key_bindings.add("J", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move to end of next word with capital E"
|
||||
event.current_buffer.cursor_right_word(end=True)
|
||||
|
||||
# Yank to end of line with 'Y'
|
||||
@key_bindings.add("Y", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Yank to the end of the line"
|
||||
text_to_yank = event.current_buffer.document.text_after_cursor
|
||||
event.app.clipboard.set_text(text_to_yank)
|
||||
|
||||
ip.pt_app.key_bindings = key_bindings
|
||||
21
dot_config/ipython/profile_default/startup/magic_ps.py
Normal file
21
dot_config/ipython/profile_default/startup/magic_ps.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from IPython.core.magic import register_line_magic
|
||||
|
||||
@register_line_magic
|
||||
def ps(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))
|
||||
else:
|
||||
return "\n".join(output)
|
||||
|
||||
|
||||
|
||||
@register_line_magic
|
||||
def nu(cmd):
|
||||
output = get_ipython().getoutput(f"nu -c {cmd}")
|
||||
# If no variable is assigned to the output, print it
|
||||
if get_ipython().last_execution_result is None:
|
||||
print("\n".join(output))
|
||||
else:
|
||||
return "\n".join(output)
|
||||
40
dot_config/sioyek/keys_user.config
Normal file
40
dot_config/sioyek/keys_user.config
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
### Movement
|
||||
# move_left h
|
||||
move_down n
|
||||
move_up e
|
||||
# move_right i
|
||||
|
||||
move_visual_mark_up e
|
||||
move_visual_mark_down n
|
||||
|
||||
screen_down N
|
||||
screen_up E
|
||||
|
||||
## Zoom
|
||||
|
||||
zoom_in =
|
||||
|
||||
|
||||
### Search
|
||||
next_item k
|
||||
previous_item K
|
||||
|
||||
|
||||
### Toggles
|
||||
toggle_fullscreen ,f
|
||||
toggle_custom_color ,d
|
||||
# toggle_dark_mode D
|
||||
toggle_dark_mode ,D
|
||||
## SyncTeX for LaTeX
|
||||
toggle_synctex ,s
|
||||
|
||||
# Mark
|
||||
goto_mark '
|
||||
|
||||
|
||||
### Misc
|
||||
quit Q
|
||||
|
||||
copy y
|
||||
|
||||
goto_toc <tab>
|
||||
34
dot_config/sioyek/prefs_user.config
Normal file
34
dot_config/sioyek/prefs_user.config
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
default_dark_mode 1
|
||||
font_size 14
|
||||
ui_font "PingFang SC"
|
||||
case_sensitive_search 0
|
||||
super_fast_search 1
|
||||
|
||||
### Colorscheme: CATPPUCCIN MOCHA
|
||||
### Trigger with D
|
||||
background_color #1e1e2e
|
||||
|
||||
text_highlight_color #f5c2e7
|
||||
visual_mark_color #7f849c
|
||||
|
||||
## Mauve
|
||||
search_highlight_color #cba6f7
|
||||
link_highlight_color #89b4fa
|
||||
synctex_highlight_color #a6e3a1
|
||||
|
||||
highlight_color_a #f9e2af
|
||||
highlight_color_b #a6e3a1
|
||||
highlight_color_c #89dceb
|
||||
highlight_color_d #eba0ac
|
||||
highlight_color_e #cba6f7
|
||||
highlight_color_f #f38ba8
|
||||
highlight_color_g #f9e2af
|
||||
|
||||
|
||||
custom_background_color #1e1e2e
|
||||
custom_text_color #cdd6f4
|
||||
|
||||
ui_text_color #cdd6f4
|
||||
ui_background_color #313244
|
||||
ui_selected_text_color #cdd6f4
|
||||
ui_selected_background_color #f5c2e7
|
||||
15
dot_config/user-dirs.dirs
Normal file
15
dot_config/user-dirs.dirs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# This file is written by xdg-user-dirs-update
|
||||
# If you want to change or add directories, just edit the line you're
|
||||
# interested in. All local changes will be retained on the next run.
|
||||
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
|
||||
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
|
||||
# absolute path. No other format is supported.
|
||||
#
|
||||
XDG_DESKTOP_DIR="$HOME/Desktop"
|
||||
XDG_DOWNLOAD_DIR="$HOME/Downloads"
|
||||
XDG_TEMPLATES_DIR="$HOME/Templates"
|
||||
XDG_PUBLICSHARE_DIR="$HOME/Public"
|
||||
XDG_DOCUMENTS_DIR="$HOME/Documents"
|
||||
XDG_MUSIC_DIR="$HOME/Music"
|
||||
XDG_PICTURES_DIR="$HOME/Pictures"
|
||||
XDG_VIDEOS_DIR="$HOME/Videos"
|
||||
1
dot_config/user-dirs.locale
Normal file
1
dot_config/user-dirs.locale
Normal file
|
|
@ -0,0 +1 @@
|
|||
zh_CN
|
||||
112
dot_config/zed/keymap.json
Normal file
112
dot_config/zed/keymap.json
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
// $DOTFILES/tools/zed/keymaps.json
|
||||
// Date: 2025-01-25
|
||||
// Author: js0ny
|
||||
// Description: Zed keymaps
|
||||
|
||||
// Location:
|
||||
// GNU/Linux: ~/.config/zed/keymaps.json
|
||||
// Windows: %APPDATA%\Zed\keymaps.json
|
||||
// Linking: (link the whole directory)
|
||||
// ln -sf $DOTFILES/tools/zed ~/.config/zed
|
||||
|
||||
// Zed keymap
|
||||
|
||||
//
|
||||
|
||||
// For information on binding keys, see the Zed
|
||||
|
||||
// documentation: https://zed.dev/docs/key-bindings
|
||||
|
||||
//
|
||||
|
||||
// To see the default key bindings run `zed: open default keymap`
|
||||
|
||||
// from the command palette.
|
||||
|
||||
// https://github.com/zed-industries/zed/tree/main/assets/keymaps
|
||||
// Sequence: https://zed.dev/docs/key-bindings#remapping-keys
|
||||
[
|
||||
{
|
||||
"context": "Workspace",
|
||||
|
||||
"bindings": {
|
||||
// "shift shift": "file_finder::Toggle"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"context": "Editor",
|
||||
|
||||
"bindings": {
|
||||
// "j k": ["workspace::SendKeystrokes", "escape"]
|
||||
"alt-e": "editor::AddSelectionAbove", // Insert Cursor Above
|
||||
"alt-n": "editor::AddSelectionBelow" // Insert Cursor Below
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "vim_mode == normal || vim_mode == visual",
|
||||
|
||||
"bindings": {
|
||||
"N": "vim::JoinLines",
|
||||
"l": "vim::InsertBefore",
|
||||
"L": "vim::InsertFirstNonWhitespace"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "vim_mode == visual || vim_mode == operator",
|
||||
|
||||
"bindings": {
|
||||
"H": "vim::StartOfLine",
|
||||
"I": "vim::EndOfLine"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "vim_mode == normal",
|
||||
|
||||
"bindings": {
|
||||
"H": "pane::ActivatePreviousItem",
|
||||
"I": "pane::ActivateNextItem"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "GitPanel || ProjectPanel || CollabPanel || OutlinePanel || ChatPanel || VimControl || EmptyPane || SharedScreen || MarkdownPreview || KeyContextView",
|
||||
|
||||
"bindings": {
|
||||
"space space": "file_finder::Toggle",
|
||||
"space ;": "command_palette::Toggle",
|
||||
"space f c": "zed::OpenSettings",
|
||||
"space f e c": "zed::OpenSettings",
|
||||
"space f t": "project_panel::ToggleFocus",
|
||||
"ctrl-w h": "workspace::ActivatePaneLeft",
|
||||
"ctrl-w i": "workspace::ActivatePaneRight",
|
||||
"ctrl-w e": "workspace::ActivatePaneUp",
|
||||
"ctrl-w n": "workspace::ActivatePaneDown"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "vim_mode == normal || vim_mode == visual || vim_mode == operator",
|
||||
|
||||
"bindings": {
|
||||
"n": "vim::Down",
|
||||
"e": "vim::Up",
|
||||
"i": "vim::Right",
|
||||
"k": "search::SelectNextMatch",
|
||||
"K": "search::SelectPreviousMatch",
|
||||
"N": ["workspace::SendKeystrokes", "n n n n n"],
|
||||
"E": ["workspace::SendKeystrokes", "e e e e e"],
|
||||
"Y": ["workspace::SendKeystrokes", "y $"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "ProjectPanel && not_editing",
|
||||
|
||||
"bindings": {
|
||||
"n": "menu::SelectNext",
|
||||
"e": "menu::SelectPrevious",
|
||||
"i": "project_panel::ExpandSelectedEntry",
|
||||
"A": "project_panel::NewDirectory",
|
||||
"a": "project_panel::NewFile",
|
||||
"d": "project_panel::Delete"
|
||||
}
|
||||
}
|
||||
]
|
||||
109
dot_config/zed/keymap_backup.json
Normal file
109
dot_config/zed/keymap_backup.json
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
// $DOTFILES/tools/zed/keymaps.json
|
||||
// Date: 2025-01-25
|
||||
// Author: js0ny
|
||||
// Description: Zed keymaps
|
||||
|
||||
// Location:
|
||||
// GNU/Linux: ~/.config/zed/keymaps.json
|
||||
// Windows: %APPDATA%\Zed\keymaps.json
|
||||
// Linking: (link the whole directory)
|
||||
// ln -sf $DOTFILES/tools/zed ~/.config/zed
|
||||
|
||||
// Zed keymap
|
||||
|
||||
//
|
||||
|
||||
// For information on binding keys, see the Zed
|
||||
|
||||
// documentation: https://zed.dev/docs/key-bindings
|
||||
|
||||
//
|
||||
|
||||
// To see the default key bindings run `zed: open default keymap`
|
||||
|
||||
// from the command palette.
|
||||
|
||||
// https://github.com/zed-industries/zed/tree/main/assets/keymaps
|
||||
// Sequence: https://zed.dev/docs/key-bindings#remapping-keys
|
||||
[
|
||||
{
|
||||
"context": "Workspace",
|
||||
|
||||
"bindings": {
|
||||
// "shift shift": "file_finder::Toggle"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"context": "Editor",
|
||||
|
||||
"bindings": {
|
||||
// "j k": ["workspace::SendKeystrokes", "escape"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "vim_mode == normal || vim_mode == visual",
|
||||
|
||||
"bindings": {
|
||||
"N": "vim::JoinLines",
|
||||
"l": "vim::InsertBefore",
|
||||
"L": "vim::InsertFirstNonWhitespace"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "vim_mode == visual || vim_mode == operator",
|
||||
|
||||
"bindings": {
|
||||
"H": "vim::StartOfLine",
|
||||
"I": "vim::EndOfLine"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "vim_mode == normal",
|
||||
|
||||
"bindings": {
|
||||
"H": "pane::ActivatePrevItem",
|
||||
"I": "pane::ActivateNextItem"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "GitPanel || ProjectPanel || CollabPanel || OutlinePanel || ChatPanel || VimControl || EmptyPane || SharedScreen || MarkdownPreview || KeyContextView",
|
||||
|
||||
"bindings": {
|
||||
"space space": "file_finder::Toggle",
|
||||
"space ;": "command_palette::Toggle",
|
||||
"space f c": "zed::OpenSettings",
|
||||
"space f e c": "zed::OpenSettings",
|
||||
"space f t": "project_panel::ToggleFocus",
|
||||
"ctrl-w h": "workspace::ActivatePaneLeft",
|
||||
"ctrl-w i": "workspace::ActivatePaneRight",
|
||||
"ctrl-w e": "workspace::ActivatePaneUp",
|
||||
"ctrl-w n": "workspace::ActivatePaneDown"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "vim_mode == normal || vim_mode == visual || vim_mode == operator",
|
||||
|
||||
"bindings": {
|
||||
"n": "vim::Down",
|
||||
"e": "vim::Up",
|
||||
"i": "vim::Right",
|
||||
"k": "search::SelectNextMatch",
|
||||
"K": "search::SelectPrevMatch",
|
||||
"N": ["workspace::SendKeystrokes", "n n n n n"],
|
||||
"E": ["workspace::SendKeystrokes", "e e e e e"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "ProjectPanel && not_editing",
|
||||
|
||||
"bindings": {
|
||||
"n": "menu::SelectNext",
|
||||
"e": "menu::SelectPrev",
|
||||
"i": "project_panel::ExpandSelectedEntry",
|
||||
"A": "project_panel::NewDirectory",
|
||||
"a": "project_panel::NewFile",
|
||||
"d": "project_panel::Delete"
|
||||
}
|
||||
}
|
||||
]
|
||||
63
dot_config/zed/settings.json
Normal file
63
dot_config/zed/settings.json
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
// $DOTFILES/tools/zed/settings.json
|
||||
// Date: 2025-01-25
|
||||
// Author: js0ny
|
||||
// Description: Zed settings (jsonc)
|
||||
|
||||
// Location:
|
||||
// GNU/Linux: ~/.config/zed/settings.json
|
||||
// Windows: %APPDATA%\Zed\settings.json
|
||||
// Linking: (link the whole directory)
|
||||
// ln -sf $DOTFILES/tools/zed ~/.config/zed
|
||||
//
|
||||
// Zed settings
|
||||
//
|
||||
// For information on how to configure Zed, see the Zed
|
||||
// documentation: https://zed.dev/docs/configuring-zed
|
||||
//
|
||||
// To see all of Zed's default settings without changing your
|
||||
// custom settings, run `zed: open default settings` from the
|
||||
// command palette (cmd-shift-p / ctrl-shift-p)
|
||||
{
|
||||
"features": {
|
||||
"edit_prediction_provider": "zed"
|
||||
},
|
||||
"outline_panel": {
|
||||
"dock": "right"
|
||||
},
|
||||
"edit_predictions": {
|
||||
"disabled_globs": ["*.bean", "*.env"],
|
||||
// "mode": "eager_preview",
|
||||
"copilot": {
|
||||
"proxy": null,
|
||||
"proxy_no_verify": null
|
||||
}
|
||||
},
|
||||
"base_keymap": "VSCode",
|
||||
"vim_mode": true,
|
||||
"ui_font_size": 16,
|
||||
"buffer_font_size": null,
|
||||
"theme": {
|
||||
"mode": "system",
|
||||
"light": "Rosé Pine Dawn",
|
||||
"dark": "Kanagawa Dragon"
|
||||
},
|
||||
"relative_line_numbers": true,
|
||||
"buffer_font_family": "Maple Mono NF CN",
|
||||
"remove_trailing_whitespace_on_save": true,
|
||||
"assistant": {
|
||||
"default_model": {
|
||||
"provider": "copilot_chat",
|
||||
"model": "claude-3-7-sonnet"
|
||||
},
|
||||
"version": "2"
|
||||
},
|
||||
"inlay_hints": {
|
||||
"enabled": true,
|
||||
"show_type_hints": true
|
||||
},
|
||||
"terminal": {
|
||||
"env": {
|
||||
"EDITOR": "zed --wait"
|
||||
}
|
||||
}
|
||||
}
|
||||
28
dot_config/zed/snippets/executable_c.json
Normal file
28
dot_config/zed/snippets/executable_c.json
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"main": {
|
||||
"prefix": "main",
|
||||
"body": [
|
||||
"int main() {",
|
||||
" $1",
|
||||
" return 0;",
|
||||
"}"
|
||||
],
|
||||
"description": "Main function with no arguments"
|
||||
},
|
||||
"mainn": {
|
||||
"prefix": "mainn",
|
||||
"body": [
|
||||
"",
|
||||
"int main(int argc, char *argv[]) {",
|
||||
" $1",
|
||||
" return 0;",
|
||||
"}"
|
||||
],
|
||||
"description": "Main function with arguments"
|
||||
},
|
||||
"once": {
|
||||
"prefix": "#once",
|
||||
"body": ["#ifndef $1", "#define $1", "", "$2", "", "#endif"],
|
||||
"description": "Include guard"
|
||||
}
|
||||
}
|
||||
27
dot_config/zed/snippets/org.json
Normal file
27
dot_config/zed/snippets/org.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"src": {
|
||||
"prefix": "src",
|
||||
"body": ["#+begin_src $1", "$0", "#+end_src"],
|
||||
"description": "Source code block"
|
||||
},
|
||||
"ex": {
|
||||
"prefix": "ex",
|
||||
"body": ["#+begin_example", "$0", "#+end_example"],
|
||||
"description": "Example block"
|
||||
},
|
||||
"begin": {
|
||||
"prefix": "begin",
|
||||
"body": ["#+begin_$1", "$0", "#+end_$1"],
|
||||
"description": "Begin block"
|
||||
},
|
||||
"【【": {
|
||||
"prefix": "[[",
|
||||
"body": ["[[$0]]"],
|
||||
"description": "Chinese link"
|
||||
},
|
||||
"elisp": {
|
||||
"prefix": "elisp",
|
||||
"body": ["#+begin_src emacs-lisp :tangle yes", "$0", "#+end_src"],
|
||||
"description": "Emacs Lisp code block"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue