summaryrefslogtreecommitdiff
path: root/.zshrc
blob: 583421c63b7ba9c5194cf63d5dd2b51c6b361dd4 (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
autoload -U colors && colors
# PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%(4~|…/%2~|%~)%{$fg[red]%}]%{$reset_color%}$%b "
PS1="%B%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M%{$reset_color%}%b:%B%{$fg[magenta]%}%~%{$reset_color%}%b
%B%{$fg[yellow]%}$%{$reset_color%}%b "
# PS1="%{$fg[magenta]%}%~%{$reset_color%}
# %B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M%{$fg[red]%}]%{$reset_color%}$%b "
#History in cache directory
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history

# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files

#bindkey -v
#export KEYTIMEOUT=1
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect '^?' backward-delete-char

# Use lf to switch directories and bind it to ctrl-o

lfcd () {
    tmp="$(mktemp)"
    lf -last-dir-path="$tmp" "$@"
    if [ -f "$tmp" ]; then
        dir="$(cat "$tmp")"
        rm -f "$tmp"
        [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
    fi
}
bindkey -s '^o' 'lfcd\n'

bindkey '^P' up-line-or-history 
bindkey '^N' down-line-or-history 
bindkey '^ ' autosuggest-accept
bindkey '^E' end-of-line
setopt NO_BEEP

alias dict='dict_func'
alias in='nvim'
alias emacs='emacsclient -nw'
alias ls='ls --color=auto'
dict_func() { command dict "$1" | colorit; }
alias ytdl='noglob yt-dlp'
alias ncm='ncmpcpp'
alias news='newsboat'

#WSL aliases 
alias start='explorer.exe'
alias pwsh='pwsh.exe'
alias sup='powershell.exe -Command "scoop update *"'

export GPG_TTY=$(tty)

setopt autocd
eval "$(zoxide init zsh)"
alias j='z'
eval "$(mcfly init zsh)"
Back to https://optics-design.com