summaryrefslogtreecommitdiff
path: root/mac
diff options
context:
space:
mode:
Diffstat (limited to 'mac')
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua69
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua62
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua30
-rw-r--r--mac/.config/git/ignore2
-rw-r--r--mac/.config/shell/aliasrc8
-rw-r--r--mac/.config/zsh/scripts.zsh10
-rwxr-xr-xmac/.local/bin/fzffiles9
-rwxr-xr-xmac/.local/bin/hugow10
-rwxr-xr-xmac/.local/bin/opensessions5
-rwxr-xr-xmac/.local/bin/ylog40
10 files changed, 194 insertions, 51 deletions
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua
index 52ceb01..36bd545 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua
@@ -260,6 +260,75 @@ return {
},
},
{
+ "greggh/claude-code.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim", -- Required for git operations
+ },
+ config = function()
+ require("claude-code").setup({
+ -- Terminal window settings
+ window = {
+ split_ratio = 0.3, -- Percentage of screen for the terminal window (height for horizontal, width for vertical splits)
+ position = "vertical", -- Position of the window: "botright", "topleft", "vertical", "float", etc.
+ enter_insert = true, -- Whether to enter insert mode when opening Claude Code
+ hide_numbers = true, -- Hide line numbers in the terminal window
+ hide_signcolumn = true, -- Hide the sign column in the terminal window
+
+ -- Floating window configuration (only applies when position = "float")
+ float = {
+ width = "80%", -- Width: number of columns or percentage string
+ height = "80%", -- Height: number of rows or percentage string
+ row = "center", -- Row position: number, "center", or percentage string
+ col = "center", -- Column position: number, "center", or percentage string
+ relative = "editor", -- Relative to: "editor" or "cursor"
+ border = "rounded", -- Border style: "none", "single", "double", "rounded", "solid", "shadow"
+ },
+ },
+ -- File refresh settings
+ refresh = {
+ enable = true, -- Enable file change detection
+ updatetime = 100, -- updatetime when Claude Code is active (milliseconds)
+ timer_interval = 1000, -- How often to check for file changes (milliseconds)
+ show_notifications = true, -- Show notification when files are reloaded
+ },
+ -- Git project settings
+ git = {
+ use_git_root = true, -- Set CWD to git root when opening Claude Code (if in git project)
+ },
+ -- Shell-specific settings
+ shell = {
+ separator = "&&", -- Command separator used in shell commands
+ pushd_cmd = "pushd", -- Command to push directory onto stack (e.g., 'pushd' for bash/zsh, 'enter' for nushell)
+ popd_cmd = "popd", -- Command to pop directory from stack (e.g., 'popd' for bash/zsh, 'exit' for nushell)
+ },
+ -- Command settings
+ command = "claude", -- Command used to launch Claude Code
+ -- Command variants
+ command_variants = {
+ -- Conversation management
+ continue = "--continue", -- Resume the most recent conversation
+ resume = "--resume", -- Display an interactive conversation picker
+
+ -- Output options
+ verbose = "--verbose", -- Enable verbose logging with full turn-by-turn output
+ },
+ -- Keymaps
+ keymaps = {
+ toggle = {
+ normal = "<C-,>", -- Normal mode keymap for toggling Claude Code, false to disable
+ terminal = "<C-,>", -- Terminal mode keymap for toggling Claude Code, false to disable
+ variants = {
+ continue = "<leader>cC", -- Normal mode keymap for Claude Code with continue flag
+ verbose = "<leader>cV", -- Normal mode keymap for Claude Code with verbose flag
+ },
+ },
+ window_navigation = true, -- Enable window navigation keymaps (<C-h/j/k/l>)
+ scrolling = true, -- Enable scrolling keymaps (<C-f/b>) for page up/down
+ },
+ })
+ end,
+ },
+ {
"NickvanDyke/opencode.nvim",
dependencies = {
-- Recommended for `ask()` and `select()`.
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua
new file mode 100644
index 0000000..f1c636b
--- /dev/null
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua
@@ -0,0 +1,62 @@
+local ls = require("luasnip")
+
+local s = ls.snippet
+local i = ls.insert_node
+local f = ls.function_node
+local c = ls.choice_node
+local t = ls.text_node
+
+local fmt = require("luasnip.extras.fmt").fmta
+
+local function bgm_list()
+ local handle = io.popen("ssh root@thesiah.xyz 'ls /var/www/thesiah/bgm/' 2>/dev/null")
+ if not handle then
+ return nil
+ end
+
+ local result = handle:read("*a")
+ handle:close()
+
+ if not result or result == "" then
+ return nil
+ end
+
+ local choices = {}
+ for filename in result:gmatch("[^\r\n]+") do
+ table.insert(choices, t(filename))
+ end
+
+ if #choices == 0 then
+ return nil
+ end
+
+ return choices
+end
+
+local bgm_choices = bgm_list()
+local bgm_node = bgm_choices and c(2, bgm_choices) or i(2, "bgm")
+
+local diary_snippet = s(
+ "diary",
+ fmt(
+ [[---
+title: <title>
+date: <date>
+bgm: <bgm>
+---
+
+<story>
+]],
+ {
+ title = i(1, "My Journal"),
+ date = f(function()
+ return os.date("%Y-%m-%d")
+ end, {}),
+ bgm = bgm_node,
+ story = i(3),
+ }
+ )
+)
+
+ls.add_snippets("markdown", { diary_snippet })
+ls.add_snippets("quarto", { diary_snippet })
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua
deleted file mode 100644
index 9ce9124..0000000
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-local ls = require("luasnip")
-
-local s = ls.snippet
-local i = ls.insert_node
-local f = ls.function_node
-
-local fmt = require("luasnip.extras.fmt").fmta
-
-local recordings_snippet = s(
- "recordings",
- fmt(
- [[---
-title: <title>
-date: <date>
----
-
-<story>
-]],
- {
- title = i(1, "My Journal"),
- date = f(function()
- return os.date("%Y-%m-%d")
- end, {}),
- story = i(3),
- }
- )
-)
-
-ls.add_snippets("markdown", { recordings_snippet })
-ls.add_snippets("quarto", { recordings_snippet })
diff --git a/mac/.config/git/ignore b/mac/.config/git/ignore
index 2121586..7c177dc 100644
--- a/mac/.config/git/ignore
+++ b/mac/.config/git/ignore
@@ -119,3 +119,5 @@ thesiah.mom
# thesiah.mom
*/thesiah/thesiah.mom
+
+**/.claude/settings.local.json
diff --git a/mac/.config/shell/aliasrc b/mac/.config/shell/aliasrc
index 6dcdf7d..64783f8 100644
--- a/mac/.config/shell/aliasrc
+++ b/mac/.config/shell/aliasrc
@@ -383,7 +383,7 @@ alias skype='skypeforlinux'
# ssh
alias gts="ssh $THESIAH_SERVER"
-alias wwr="ssh recordings"
+alias wwr="ssh diary"
# sudo
alias su='sudo su -l root'
@@ -501,6 +501,6 @@ alias szs="source ${XDG_CONFIG_HOME:-${HOME}/.config}/zsh/.zshrc"
alias ylogh='ylog -s hidden -c us | grep $(LC_TIME=C date +%d/%b) | grep -E "[0-9]{2}:[0-9]{2}:[0-9]{2} "'
alias ylogi='ylog -s hidden -c us | grep $(LC_TIME=C date -v-1d +%d/%b) | grep -E "[0-9]{2}:[0-9]{2}:[0-9]{2} "'
-alias ylogt='ylog -s recordings -c us | grep $(LC_TIME=C date +%d/%b) | grep -E "[0-9]{2}:[0-9]{2}:[0-9]{2} "'
-alias ylogy='ylog -s recordings -c us | grep $(LC_TIME=C date -v-1d +%d/%b) | grep -E "[0-9]{2}:[0-9]{2}:[0-9]{2} "'
-alias ylogu='ylog -s recordings -c us'
+alias ylogt='ylog -s diary -c us | grep $(LC_TIME=C date +%d/%b) | grep -E "[0-9]{2}:[0-9]{2}:[0-9]{2} "'
+alias ylogy='ylog -s diary -c us | grep $(LC_TIME=C date -v-1d +%d/%b) | grep -E "[0-9]{2}:[0-9]{2}:[0-9]{2} "'
+alias ylogu='ylog -s diary -c us'
diff --git a/mac/.config/zsh/scripts.zsh b/mac/.config/zsh/scripts.zsh
index f92a6c4..ac59ca6 100644
--- a/mac/.config/zsh/scripts.zsh
+++ b/mac/.config/zsh/scripts.zsh
@@ -388,9 +388,13 @@ EOF
)
[[ -z "${SELECTED_DIRS// }" ]] && return
if [[ "$(echo "$SELECTED_DIRS" | wc -l)" -eq 1 ]]; then
- cd "$SELECTED_DIRS"
- if [[ -n "$(git -C "$SELECTED_DIRS" status --porcelain)" ]]; then
- git status --porcelain 2>/dev/null
+ if [[ -n "$TMUX" ]]; then
+ opensessions "$SELECTED_DIRS"
+ else
+ cd "$SELECTED_DIRS" || return
+ if [[ -n "$(git -C "$SELECTED_DIRS" status --porcelain 2>/dev/null)" ]]; then
+ git status --porcelain
+ fi
fi
else
opensessions "$SELECTED_DIRS"
diff --git a/mac/.local/bin/fzffiles b/mac/.local/bin/fzffiles
index 97047e9..6c0bcfd 100755
--- a/mac/.local/bin/fzffiles
+++ b/mac/.local/bin/fzffiles
@@ -11,7 +11,7 @@ IFS='
files=$(fzf-tmux \
--header "^a pwd ^b public ^d .dotfiles ^f configs ^g git ^h home ^k desktop ^r scripts ^s suckless ^u staged files ^v private ^/ help" \
--preview "selection={};
- clean=\$(printf '%s' \"\$selection\" | sed -e 's/^📄 //' -e 's/^✏️ //' -e 's/^✅ //' -e 's/^❌ //' -e 's/^🔀 //' -e 's/^❓ //');
+ clean=\$(printf '%s' \"\$selection\" | sed -e 's/^📄 //' -e 's/^✏️ //' -e 's/^✅ //' -e 's/^❌ //' -e 's/^🔀 //' -e 's/^🗑️ //' -e 's/^❓ //');
[ -z \"\$clean\" ] && { echo 'No selection'; exit 0; }
target=\$(readlink -f \"\$clean\" 2>/dev/null || printf '%s' \"\$clean\");
if [ -z \"\$target\" ]; then
@@ -35,7 +35,7 @@ files=$(fzf-tmux \
fi
fi
if [ -d \"\$target\" ]; then
- exa --color=always --long --all --header --icons --git \"\$target\"
+ eza --color=always --long --all --header --icons --git \"\$target\"
elif [ -f \"\$target\" ]; then
bat --color=always --style=header,grid --line-range=:500 \"\$target\"
else
@@ -61,7 +61,8 @@ files=$(fzf-tmux \
file=substr(\$0,4);
gsub(/^ +/, \"\", file);
if (file == \"\") next;
- if (staged == \"?\" && unstaged == \"?\") icon=\"📄\";
+ if (staged == \"D\" || unstaged == \"D\") icon=\"🗑️\";
+ else if (staged == \"?\" && unstaged == \"?\") icon=\"📄\";
else if (staged == \"!\" && unstaged == \"!\") icon=\"❌\";
else if (staged != \" \" && staged != \"?\" && unstaged != \" \" && unstaged != \"?\") icon=\"🔀\";
else if (staged != \" \" && staged != \"?\") icon=\"✅\";
@@ -85,7 +86,7 @@ files=$(fzf-tmux \
# Check if any files were selected, and exit if not
[ -z "$files" ] && exit 0
-files=$(printf '%s\n' "$files" | sed -e 's/^📄 //' -e 's/^✏️ //' -e 's/^✅ //' -e 's/^❌ //' -e 's/^🔀 //' -e 's/^❓ //')
+files=$(printf '%s\n' "$files" | sed -e 's/^📄 //' -e 's/^✏️ //' -e 's/^✅ //' -e 's/^❌ //' -e 's/^🔀 //' -e 's/^🗑️ //' -e 's/^❓ //')
if [ -d "$files" ]; then
absolute_files=$(realpath $files)
diff --git a/mac/.local/bin/hugow b/mac/.local/bin/hugow
index 972d285..13cdf51 100755
--- a/mac/.local/bin/hugow
+++ b/mac/.local/bin/hugow
@@ -2,11 +2,11 @@
set -eu
repodir="$HOME/Private/repos/THESIAH"
-out="$repodir/public/recordings/index.html"
+out="$repodir/public/diary/index.html"
server="${THESIAH_SERVER:-root@thesiah.xyz}"
-dest="/var/www/thesiah/recordings/"
+dest="/var/www/thesiah/diary/"
defaults="sy after foramonth"
-src="$repodir/public/recordings/"
+src="$repodir/public/diary/"
cd "$repodir"
hugo --cleanDestinationDir
@@ -27,7 +27,7 @@ fi
# name = a[i] ".mp4"
# insert = insert \
# " <li>\n" \
-# " <a href=\"/recordings/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \
+# " <a href=\"/diary/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \
# " </li>\n"
# }
# injected = 0
@@ -57,7 +57,7 @@ else
fi
if [ -n "${1-}" ]; then
- new="$repodir/content/recordings/$1"
+ new="$repodir/content/diary/$1"
if [ -f "$new" ]; then
rsync -az --update "$new" "$server:$dest"
elif [ -d "$new" ]; then
diff --git a/mac/.local/bin/opensessions b/mac/.local/bin/opensessions
index 6f9f236..d16f42f 100755
--- a/mac/.local/bin/opensessions
+++ b/mac/.local/bin/opensessions
@@ -18,7 +18,10 @@ set -- $dirs
for dir in $dirs; do
if [ -d "$dir" ]; then
session_name=$(get_session_name "$dir")
- if ! tmux has-session -t "$session_name" 2>/dev/null; then
+ if tmux has-session -t "$session_name" 2>/dev/null; then
+ session_path=$(tmux display-message -t "$session_name" -p '#{session_path}')
+ tmux send-keys -t "$session_name" "cd \"$session_path\"" C-m
+ else
tmux new-session -d -s "$session_name" -c "$dir"
if git -C "$dir" rev-parse --is-inside-work-tree >/dev/null 2>&1 && [ -n "$(git -C "$dir" status --porcelain)" ]; then
tmux send-keys -t "$session_name" "git status --porcelain" C-m
diff --git a/mac/.local/bin/ylog b/mac/.local/bin/ylog
index 254803b..c56df36 100755
--- a/mac/.local/bin/ylog
+++ b/mac/.local/bin/ylog
@@ -5,7 +5,7 @@ LOG_DIR="/var/log/nginx"
TARGET="all" # "all" means no target filter (show all lines)
COUNTRY="all" # all|kr|us
-SCOPE="all" # all|access|recordings
+SCOPE="all" # all|access|recordings|hidden|diary|peertube
EXCL_FIREFOX=0 # 1 = exclude Firefox lines by default
EXCLUDES="59.19.56.8" # default exclude pattern
ADD_EXCLUDES=""
@@ -24,13 +24,16 @@ Options:
-c COUNTRY Select country logs (default: all)
all : all logs
- kr : recordings.kr.log + recordings.access.log
- us : recordings.us.log + recordings.access.log
+ kr : recordings.kr.log + recordings.access.log (and diary.kr.log when -s diary)
+ us : recordings.us.log + recordings.access.log (and diary.us.log when -s diary)
-s SCOPE Select log scope (default: all)
- all : recordings + access
+ all : recordings + access + hidden + diary + peertube
recordings : recordings.* logs only
access : access.* logs only
+ hidden : hidden.access.* logs only
+ diary : diary.* logs only
+ peertube : peertube.* logs only
-n Disable Firefox exclusion (by default, Firefox lines are excluded)
@@ -51,7 +54,10 @@ Options:
Examples:
ylog # All logs, last 10 lines each
ylog -s recordings # Recordings logs only, last 10 lines each
+ ylog -s diary # Diary logs only, last 10 lines each
+ ylog -s peertube # Peertube logs only, last 10 lines each
ylog -c kr -t 1.2.3.4 # Search specific IP in Korean logs
+ ylog -c kr -s diary # Korean diary logs only
ylog -t all -l 50 # All logs, last 50 lines each
ylog -d 1 # Logs from 1 day ago only
ylog -d ~2 # Logs from 2 days ago to today
@@ -119,6 +125,32 @@ pick_files() {
[ -e "$q" ] && printf "%s\n" "$q"
done
fi
+ # diary logs: similar structure to recordings
+ if [ "$SCOPE" = "diary" ] || [ "$SCOPE" = "all" ]; then
+ if [ "$COUNTRY" = "all" ]; then
+ for q in "$LOG_DIR/diary.access.log" "$LOG_DIR/diary.access.log".*; do
+ [ -e "$q" ] && printf "%s\n" "$q"
+ done
+ fi
+ case "$COUNTRY" in
+ kr) for q in "$LOG_DIR/diary.kr.log" "$LOG_DIR/diary.kr.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;;
+ us) for q in "$LOG_DIR/diary.us.log" "$LOG_DIR/diary.us.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;;
+ all)
+ for p in diary.kr.log diary.us.log; do
+ for q in "$LOG_DIR/$p" "$LOG_DIR/$p".*; do [ -e "$q" ] && printf "%s\n" "$q"; done
+ done
+ ;;
+ esac
+ fi
+ # peertube logs
+ if [ "$SCOPE" = "peertube" ] || [ "$SCOPE" = "all" ]; then
+ for q in "$LOG_DIR/peertube.access.log" "$LOG_DIR/peertube.access.log".*; do
+ [ -e "$q" ] && printf "%s\n" "$q"
+ done
+ for q in "$LOG_DIR/peertube.error.log" "$LOG_DIR/peertube.error.log".*; do
+ [ -e "$q" ] && printf "%s\n" "$q"
+ done
+ fi
}
# build exclude regex