summaryrefslogtreecommitdiff
path: root/.config/fish/config.fish
blob: 376997e94420db949dc478c4b3868b5c76c7ad8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
if status is-interactive
    clear
end

function fish_greeting; end

function spf
    set os $(uname -s)

    if test "$os" = "Linux"
        set spf_last_dir "$HOME/.local/state/superfile/lastdir"
    end

    if test "$os" = "Darwin"
        set spf_last_dir "$HOME/Library/Application Support/superfile/lastdir"
    end

    command spf $argv

    if test -f "$spf_last_dir"
        source "$spf_last_dir"
        rm -f -- "$spf_last_dir" >> /dev/null
    end
end

function f
	set tmp (mktemp -t "yazi-cwd.XXXXXX")
	yazi $argv --cwd-file="$tmp"
	if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
		builtin cd -- "$cwd"
	end
	rm -f -- "$tmp"
end

function lt;
    eza --tree --color=always --icons=always --level=$argv
end

function a
    set max_depth 5
    set current_depth 0
    set dir (pwd)

    while test $current_depth -lt $max_depth
        if test -d "$dir/venv"
            source "$dir/venv/bin/activate.fish"
            return 0
        end
        set dir (dirname $dir)
        set current_depth (math $current_depth + 1)
    end

    echo "venv folder not found within $max_depth levels."
    return 1
end

function gitzip
    git ls-files | zip archive.zip -@
end

alias c=clear
alias g=fg
alias v=nvim
alias vv="nvim ."
alias ic="cd ~/Library/Mobile Documents/com~apple~CloudDocs"
alias cc="clear & cd"
alias l="eza --color=always --long --git --no-filesize --icons=always --no-time --no-user --no-permissions --group-directories-first"
alias ll="eza --color=always --long --git --icons=always --no-user --group-directories-first"
alias la="eza -a --color=always --long --git --no-filesize --icons=always --no-time --no-user --no-permissions --group-directories-first"
alias fa="fastfetch"
alias ff="yazi"
alias p=pgcli
alias t="tmux attach"
# alias d="deactivate"
alias d="zi"
alias venv="python3 -m venv venv"
alias cd="z"
# alias timewr="rm -rf ~/.local/share/timewarrior/data/"
alias s="ssh pi@tom.tinysun.net"
alias gi="git init && aig"
alias gs="git status"
alias aig="cp ~/.config/.gitignore-template ./.gitignore"
alias u="uv run"
alias vi="/Users/tom/Downloads/nvim-macos-arm64/bin/nvim -u /Users/tom/Downloads/nvim/init.lua"


function ga
    git add -A
    git commit -m "auto"
end

# Created by `pipx` on 2024-11-25 11:43:56
set PATH $PATH /Users/tom/.local/bin
# Cargo path
set PATH $HOME/.cargo/bin $PATH

eval "$(/opt/homebrew/bin/brew shellenv)"
zoxide init fish | source
atuin init fish --disable-up-arrow | source
export EDITOR="nvim"

# uv
fish_add_path "/Users/tom/.local/bin"

starship init fish | source
alias conda="/opt/homebrew/anaconda3/bin/conda"

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
# if test -f /opt/homebrew/anaconda3/bin/conda
#     eval /opt/homebrew/anaconda3/bin/conda "shell.fish" "hook" $argv | source
# else
#     if test -f "/opt/homebrew/anaconda3/etc/fish/conf.d/conda.fish"
#         . "/opt/homebrew/anaconda3/etc/fish/conf.d/conda.fish"
#     else
#         set -x PATH "/opt/homebrew/anaconda3/bin" $PATH
#     end
# end
# <<< conda initialize <<<

set -Ux CARAPACE_BRIDGES 'zsh,fish,bash,inshellisense' # optional
carapace _carapace | source
export PATH="$HOME/.local/apps/nvim-macos-arm64/bin:$PATH"
export NEOVIDE_CONFIG="$HOME/.config/neovide/config.toml"
set -gx EDITOR nvim
set -gx VISUAL nvim

function ginit
    if test (count $argv) -ne 2
        echo "Usage: ginit <name> <description>"
        return 1
    end
    ssh pi@git.tinysun.net "git init --bare --initial-branch=main /var/git/$argv[1].git && chmod -R g+rwX /var/git/$argv[1].git && git config --global --add safe.directory /var/git/$argv[1].git && echo '$argv[2]' > /var/git/$argv[1].git/description"
    git remote add origin "ssh://pi@git.tinysun.net/var/git/$argv[1].git"
    git push --set-upstream origin main
    echo "Created: https://git.tinysun.net/$argv[1].git"
end