Compare commits
	
		
			10 Commits
		
	
	
		
			9906e0c417
			...
			3230e6d872
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 3230e6d872 | ||
|   | c4e46206d7 | ||
|   | 2d0acc2d70 | ||
|   | 383a900c2d | ||
|   | fdf5efedb1 | ||
| 357bdad01b | |||
| 499b0f4329 | |||
| 15f2f88565 | |||
| 3790e1e28a | |||
| 1f982263e6 | 
| @@ -1,3 +1,5 @@ | ||||
| todo.md | ||||
| **/.DS_Store | ||||
| **/lazy-lock.json | ||||
|  | ||||
| **/.claude/settings.local.json | ||||
|   | ||||
| @@ -8,3 +8,4 @@ vim.o.timeoutlen = 0 | ||||
| -- setup prolog | ||||
| require('lspconfig/prolog_lsp') | ||||
| require('lspconfig').prolog_lsp.setup{} | ||||
| -- require('olinpin.intro').open() | ||||
|   | ||||
							
								
								
									
										122
									
								
								nvim/lua/olinpin/intro.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								nvim/lua/olinpin/intro.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,122 @@ | ||||
| local M = {} | ||||
| local api = vim.api | ||||
| local fn = vim.fn | ||||
| local strw = api.nvim_strwidth | ||||
| local opts = { | ||||
| 	header = { | ||||
| "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣴⣶⣶⣶⣶⣦⣤⡀⠀⠀⠀⠀", | ||||
| "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⠟⠉⠉⠉⠉⠉⠛⠻⢿⣷⣄⠀⠀", | ||||
| "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⠟⠁⠀⠀⢠⣤⣄⠀⠀⠀⠀⠙⣿⣷⠀", | ||||
| "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⠏⠀⠀⠀⠀⠘⠻⠋⠀⠀⠀⠀⠀⢸⣿⡇", | ||||
| "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⡏⠀⠀⣀⣀⣀⣠⣤⣤⣤⣤⣿⣄⠀⢠⣿⣧", | ||||
| "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⠀⠀⠀⠈⠻⣿⣶⠶⣶⣤⣤⣜⣿⣦⡈⢿⣿", | ||||
| "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠈⠙⠻⢶⣤⣭⣛⣿⣿⣷⣼⣿", | ||||
| "⠀⠀⠀⠀⠀⣰⣶⣾⠿⠿⢿⣷⣶⣄⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠛⠛⢛⣿⣿", | ||||
| "⠀⠀⠀⠀⠀⢹⣿⣆⠀⠀⠀⠈⠻⢿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⡏", | ||||
| "⠀⠀⠀⠀⠀⣸⣿⣿⠀⠀⠀⠀⠀⠀⢀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀", | ||||
| "⠀⠀⠀⢀⣾⣿⣿⡇⠀⠀⠀⠀⠀⠀⢸⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀", | ||||
| "⠀⠀⠀⣼⣿⠃⠹⣿⣷⣄⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠇⠀", | ||||
| "⠀⠀⠀⣿⡿⠀⠀⠈⠻⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀", | ||||
| "⠀⠀⢸⣿⣧⠀⠀⠀⠀⠸⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡷⠀⠀", | ||||
| "⠀⠀⠈⣿⣿⡄⠀⠀⠀⠀⢻⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⡀⠀", | ||||
| "⠀⠀⠀⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣧⠀", | ||||
| "⠀⠀⠀⢻⣿⡟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⡇", | ||||
| "⠀⠀⠀⠘⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⡿", | ||||
| "⠀⠀⠀⣤⣸⣿⣿⡷⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠃", | ||||
| "⠀⠀⠘⣿⡿⠿⣿⣿⣿⣷⡶⢶⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⠏⠀", | ||||
| "⠀⠀⢀⣿⡟⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡿⠟⠉⠀⠀", | ||||
| "⠀⠀⣼⣿⠇⠀⣴⣄⠀⠀⠀⠀⢹⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣿⠟⠁⠀⠀⠀⠀", | ||||
| "⢀⣼⣿⠋⠀⠀⠘⣿⣧⠀⠀⠀⢸⣿⣧⣄⣀⠀⠀⠀⢀⣀⣤⣶⣿⣿⠋⠁⠀⠀⠀⠀⠀⠀", | ||||
| "⢾⣯⣁⠀⠀⠀⠀⠈⢿⡄⠀⠀⣸⡿⠉⠙⠛⠛⠛⠛⢻⣿⡏⢹⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀", | ||||
| "⠀⠛⢿⣷⣦⣤⣀⡀⠀⠀⠀⣠⣿⣷⣶⣶⣶⣶⣶⣦⣤⣿⣿⡜⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀", | ||||
| "⠀⠀⠀⠈⠙⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⢻⡿⣷⣶⣤⣀⠀⠀⠀⠀", | ||||
| "⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣁⡸⠟⠈⣩⣿⣿⣿⠶⠀⠀", | ||||
| "⠀⠀⠀⣠⣴⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⠟⠋⠁⠀⠀⠀⠀", | ||||
| "⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀", | ||||
| "⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", | ||||
| "       WADDLE WADDLE WADDLE       ", | ||||
| }, | ||||
| 	buttons = {} | ||||
| } | ||||
|  | ||||
| M.open = function(buf, win, action) | ||||
|   action = action or "open" | ||||
|  | ||||
|   win = win or api.nvim_get_current_win() | ||||
|  | ||||
|   if not vim.bo.buflisted and action == "open" then | ||||
|     if vim.t.bufs[1] then | ||||
|       win = vim.fn.bufwinid(vim.t.bufs[1]) | ||||
|       api.nvim_set_current_win(win) | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   local ns = api.nvim_create_namespace "nvdash" | ||||
|   local winh = api.nvim_win_get_height(win) | ||||
|   local winw = api.nvim_win_get_width(win) | ||||
|   buf = buf or vim.api.nvim_create_buf(false, true) | ||||
|  | ||||
|   local nvdash_w = 0 | ||||
|  | ||||
|   if action == "open" then | ||||
|     api.nvim_win_set_buf(0, buf) | ||||
|   end | ||||
|  | ||||
|   opts.header = type(opts.header) == "function" and opts.header() or opts.header | ||||
|  | ||||
|   local ui = {} | ||||
|  | ||||
|   ------------------------ find largest string's width ----------------------------- | ||||
|   for _, v in ipairs(opts.header) do | ||||
|     local headerw = strw(v) | ||||
|     if headerw > nvdash_w then | ||||
|       nvdash_w = headerw | ||||
|     end | ||||
|  | ||||
|     local col = math.floor((winw / 2) - math.floor(strw(v) / 2)) - 6 | ||||
|     local opt = { virt_text_win_col = col, virt_text = { { v, "NvDashAscii" } } } | ||||
|     table.insert(ui, opt) | ||||
|   end | ||||
|  | ||||
|   opts.buttons = type(opts.buttons) == "table" and opts.buttons or opts.buttons() | ||||
|  | ||||
|   local key_lines = {} | ||||
|  | ||||
|   ----------------------- save display txt ----------------------------------------- | ||||
|   local dashboard_h = #ui + 3 | ||||
|  | ||||
|   -- if screen height is small | ||||
|   winh = dashboard_h > winh and dashboard_h or winh | ||||
|  | ||||
|   local row_i = math.floor((winh / 2) - (dashboard_h / 2)) | ||||
|  | ||||
|   for i, v in ipairs(key_lines) do | ||||
|     key_lines[i].i = v.i + row_i + 1 | ||||
|   end | ||||
|  | ||||
|   -- make all lines available | ||||
|   local empty_str = {} | ||||
|   for i = 1, winh do | ||||
|     empty_str[i] = "" | ||||
|   end | ||||
|  | ||||
|   ------------------------------ EXTMARKS : set text + highlight ------------------------------- | ||||
|   api.nvim_buf_set_lines(buf, 0, -1, false, empty_str) | ||||
|  | ||||
|   for i, v in ipairs(ui) do | ||||
|     api.nvim_buf_set_extmark(buf, ns, row_i + i, 0, v) | ||||
|   end | ||||
|  | ||||
|   if action == "redraw" then | ||||
|     return | ||||
|   end | ||||
|  | ||||
|   ------------------------------------ keybinds ------------------------------------------ | ||||
|   vim.wo[win].virtualedit = "all" | ||||
|  | ||||
|   if key_lines[1] then | ||||
|     api.nvim_win_set_cursor(win, { key_lines[1].i, key_lines[1].col }) | ||||
|   end | ||||
| end | ||||
|  | ||||
| return M | ||||
| @@ -127,12 +127,8 @@ function ccd() { | ||||
|   printf "%q" "$(pwd)" | pbcopy | ||||
| } | ||||
|  | ||||
| alias tat="tmux attach -t" | ||||
|  | ||||
| alias t="tmux" | ||||
|  | ||||
| alias tls="tmux ls" | ||||
|  | ||||
| function ip() { | ||||
|   dig +short myip.opendns.com @resolver1.opendns.com | ||||
| } | ||||
|   | ||||
| @@ -1,25 +1,21 @@ | ||||
| function mx() { | ||||
|     PROJECT_DIR=$1 | ||||
|     if [[ -z "$PROJECT_DIR" ]]; then | ||||
|         echo "Usage: mx <project_directory> [SESSION_NAME]" | ||||
|         return 1 | ||||
|     fi | ||||
|  | ||||
|     ALL_PROJECTS=$(get_mux_sessions) | ||||
|     IS_VALID_PROJECT=$(echo $ALL_PROJECTS | grep -o "\b$PROJECT_DIR\w*" | head -1) | ||||
| function tat() { | ||||
|     PROJECT_DIR=${1:-.} | ||||
|     SAFE_INPUT=$(printf '%s\n' "$PROJECT_DIR" | sed 's/[][\.^$*+?{}|()]/\\&/g') | ||||
|     ALL_PROJECTS=$(tls) | ||||
|     IS_VALID_PROJECT=$(echo $ALL_PROJECTS | grep -io "[[:<:]]$SAFE_INPUT\w*" | head -1) | ||||
|     if [[ $IS_VALID_PROJECT != "" ]]; then | ||||
|         echo $IS_VALID_PROJECT | ||||
|         tmuxinator start "$IS_VALID_PROJECT" | ||||
|         return 1 | ||||
|     fi | ||||
|  | ||||
|     SESSION_NAME=${2:-$(basename $(realpath "$PROJECT_DIR"))} | ||||
|     WHOLE_PATH=$(realpath "$PROJECT_DIR") | ||||
|     if [[ $WHOLE_PATH == "*No such file or directory*" ]]; then | ||||
|     if [ -d "$PROJECT_DIR" ]; then | ||||
|     else | ||||
|         echo "Directory does not exist: $PROJECT_DIR" | ||||
|         return 1 | ||||
|     fi | ||||
|  | ||||
|     WHOLE_PATH=$(realpath "$PROJECT_DIR") | ||||
|     SESSION_NAME=${2:-$(basename $WHOLE_PATH)} | ||||
|     # check if file doesn't exist yet in the tmuxinator config directory | ||||
|     TMUXINATOR_CONFIG=~/.config/tmuxinator/$SESSION_NAME.yml | ||||
|     if [[ -f $TMUXINATOR_CONFIG ]]; then | ||||
| @@ -34,21 +30,27 @@ function mx() { | ||||
|  | ||||
| } | ||||
|  | ||||
| function get_mux_sessions() { | ||||
|     ALL_PROJECTS=$(tmuxinator list | grep -v tmuxinator) | ||||
|     echo $ALL_PROJECTS | ||||
| function tls() { | ||||
|     tmuxinator list | grep -v tmuxinator | tr ' ' '\n' | grep -v '^$' | ||||
| } | ||||
|  | ||||
| function _mx_autocomplete() { | ||||
|     local cur | ||||
|     cur="${COMP_WORDS[COMP_CWORD]}" | ||||
|     local projects="$(get_mux_sessions)" | ||||
|     COMPREPLY=() | ||||
|     while IFS= read -r line; do | ||||
|       COMPREPLY+=("$line") | ||||
|     done < <( | ||||
|       { compgen -W "$projects" -- "$cur"; compgen -f -- "$cur"; } | sort -u | ||||
|     ) | ||||
|     local -a projects files dirs | ||||
|     local expl | ||||
|  | ||||
|     # Get tmuxinator projects | ||||
|     projects=(${(f)"$(tls)"}) | ||||
|  | ||||
|     # Get files and directories with proper completion | ||||
|     _alternative \ | ||||
|         'projects:tmuxinator projects:compadd -a projects' \ | ||||
|         'files:files:_files' | ||||
| } | ||||
|  | ||||
| complete -f -F _mx_autocomplete -o default mx | ||||
| # Register the completion function for zsh | ||||
| if [[ -n ${ZSH_VERSION-} ]]; then | ||||
|     compdef _mx_autocomplete tat | ||||
| else | ||||
|     # Fallback for bash | ||||
|     complete -f -F _mx_autocomplete -o default tat | ||||
| fi | ||||
|   | ||||
							
								
								
									
										42
									
								
								tmux/bin/fuzzy-switch.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								tmux/bin/fuzzy-switch.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| #!/usr/bin/env bash | ||||
| die() { | ||||
|   printf "\n[tmux-fuzzy] %s\n" "$1" >&2 | ||||
|   # keep popup visible if we're in a popup | ||||
|   if [ -n "${TMUX:-}" ]; then | ||||
|     printf "Press ENTER to close..." | ||||
|     read -r _ || true | ||||
|   fi | ||||
|   exit 1 | ||||
| } | ||||
|  | ||||
| list_projects() { | ||||
|   tmuxinator list 2>/dev/null \ | ||||
|     | sed '1{/tmuxinator projects:/d;}' \ | ||||
|     | tr -s '[:space:]' '\n' \ | ||||
|     | grep -E '^[[:alnum:]_.:-]+$' \ | ||||
|     || true | ||||
| } | ||||
|  | ||||
| # unique + sorted | ||||
| items="$(list_projects | sort -u)" | ||||
| [ -n "$items" ] || die "No tmuxinator projects found." | ||||
|  | ||||
| sel="$( | ||||
|   printf '%s\n' "$items" | fzf \ | ||||
|     --prompt='Project > ' \ | ||||
|     --height=100% --layout=reverse \ | ||||
|     --print-query --expect=enter \ | ||||
|     --bind 'tab:down,btab:up'  \ | ||||
|     --cycle | ||||
| )" || exit 0 | ||||
|  | ||||
| key="$(printf '%s\n' "$sel" | sed -n '1p')" | ||||
| query="$(printf '%s\n' "$sel" | sed -n '2p' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" | ||||
| choice="$(printf '%s\n' "$sel" | sed -n '3p')" | ||||
|  | ||||
| project="${choice:-$query}" | ||||
| [ -n "$project" ] || exit 0 | ||||
|  | ||||
| tmuxinator start "$project" | ||||
| exit 0 | ||||
|  | ||||
| @@ -66,5 +66,8 @@ set -g @plugin 'omerxx/tmux-sessionx' | ||||
|  | ||||
| set -g @plugin 'christoomey/vim-tmux-navigator' | ||||
|  | ||||
| bind-key s display-popup -w 30% -h 30% -E "~/.config/tmux/bin/fuzzy-switch.sh" | ||||
| bind-key f display-popup -w 30% -h 30% -E "~/.config/tmux/bin/fuzzy-switch.sh" | ||||
|  | ||||
| # Initialise tmux plugin manager (needs to be at the bottom of the file) | ||||
| run '~/.config/tmux/plugins/tpm/tpm' | ||||
|   | ||||
| @@ -5,6 +5,6 @@ windows: | ||||
| - zsh: | ||||
|     layout: b8f6,198x59,0,0[198x39,0,0,71,198x19,0,40{99x19,0,40,73,98x19,100,40,75}] | ||||
|     panes: | ||||
|         - nvim | ||||
|         - nvim . | ||||
|         -   | ||||
|         - dcud | ||||
|         -  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user