-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.aliases
97 lines (74 loc) · 2.58 KB
/
.aliases
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
alias config='/usr/bin/git --git-dir=/home/rachartier/.cfg/ --work-tree=/home/rachartier'
alias lazygit='TERM=xterm-256color lazygit' # fix for lazygit with bad colors in tmux
alias f="fzf"
alias l="eza --tree --level 1 --group-directories-first --color=always --icons"
alias ls='eza --group-directories-first --color=always --icons=auto'
alias neo='neovide.exe --wsl --neovim-bin "/opt/nvim-linux64/bin/nvim" -- '
alias cneo='neovide.exe --wsl --neovim-bin "/opt/nvim-linux64/bin/nvim" --server="$1:7301 -- '
alias snvim='nvim --cmd "let g:neovide=1" --headless --listen 0.0.0.0:7301'
if [ -n "$DOTFILES_DOCKER" ]; then
alias nvim="env TERM=wezterm nvim"
fi
alias -g ...='../..'
alias -g ....='../../..'
alias -g .....='../../../..'
alias -g ......='../../../../..'
alias -g -- -h='-h 2>&1 | bat --language=help --style=plain -P'
alias -g -- --help='--help 2>&1 | bat --language=help --style=plain -P'
alias ssh='TERM=xterm ssh'
function __get_clipboard_contents() {
if command -v xclip &>/dev/null; then
xclip -o -selection clipboard
elif command -v pbpaste &>/dev/null; then
pbpaste
else
powershell.exe -NoLogo -NoProfile -c "[Console]::Out.Write(\$(Get-Clipboard -Raw).tostring().replace('\`r', ''))"
fi
}
function __copilot_cli_action() {
if [ -z "$1" ]; then
copilot-cli --copy-to-clipboard --action "$2" --prompt "$3: $(__get_clipboard_contents)"
return
fi
copilot-cli --copy-to-clipboard --action "$2" --prompt "$3: $1"
}
function enhance() {
__copilot_cli_action "$1" 'enhance'
}
function correct() {
__copilot_cli_action "$1" 'correct'
}
function translate() {
if [ -z "$2" ]; then
echo ok
__copilot_cli_action "$(__get_clipboard_contents)" 'translate' "Si le texte suivant est en français, traduit le en anglais. Autrement, traduit le en français"
return
fi
if [ "$1" = "--lang" ]; then
__copilot_cli_action "$3" 'translate' "$2"
return
fi
__copilot_cli_action "$2" 'translate' "Traduit en $1 le texte suivant: "
}
function ask() {
__copilot_cli_action "$1" 'ask'
}
function gitignore() {
echo "Generating .gitignore file for $1"
copilot-cli --action "gitignore" --prompt "$1" > .gitignore
}
function venv() {
if [ -z "$1" ]; then
echo "Usage: venv <name>"
return
fi
if ! [ -d "$1" ]; then
python3 -m venv "$1"
fi
source "$1/bin/activate"
if command -v direnv &>/dev/null; then
echo 'export VIRTUAL_ENV=."venv"' > .envrc
echo "layout python python3" > .envrc
direnv allow
fi
}