summaryrefslogtreecommitdiff
path: root/.zshrc
blob: 33564e0ed40e88e8993bbb1efba6e923d06aa9da (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
setopt correct
setopt histignoredups
setopt sharehistory
setopt incappendhistory
setopt interactivecomments

HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000

bindkey -v
export KEYTIMEOUT=1

autoload -Uz compinit && compinit
autoload -Uz bashcompinit && bashcompinit
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'


autoload -Uz vcs_info

precmd() { vcs_info }
setopt prompt_subst

zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:*' formats ' (%b%u%c)'
zstyle ':vcs_info:git:*' stagedstr '+'
zstyle ':vcs_info:git:*' unstagedstr '*'

PROMPT='%F{#C9DE95}%n@%m%f %F{#F6D99D}%3~%f${vcs_info_msg_0_} '

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

 
alias grep='grep --color=auto'
alias ll='lsd -all'
alias ls='lsd -all'
alias l='lsd -l'
alias v='nvim'
alias vi='nvim'
alias vim='nvim'
alias c='clear'


alias y='yazi'
alias pdf='sioyek'
alias wiki='wikiman'
alias lg='lazygit'
alias blue='bluetui'
alias op='xdg-open'
alias open='xdg-open'

bindkey -M vicmd 'jj' vi-cmd-mode
bindkey -M viins 'jj' vi-cmd-mode


function zle-keymap-select {
  if [[ $KEYMAP == vicmd ]]; then
    echo -ne "\e[1 q" 
  else
    echo -ne "\e[5 q"
  fi
}
zle -N zle-keymap-select

function zle-line-init {
  echo -ne "\e[5 q"
}
zle -N zle-line-init


# plugins ==========================================
AUTOSUGGEST_DIR="${HOME}/.config/zsh/.zsh-autosuggestions"
if [ ! -d "$AUTOSUGGEST_DIR" ]; then
  git clone https://github.com/zsh-users/zsh-autosuggestions "$AUTOSUGGEST_DIR"
fi
source "$AUTOSUGGEST_DIR/zsh-autosuggestions.zsh"

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'

SYNTAX_HIGHLIGHTING="${HOME}/.config/zsh/.zsh-syntax-highlighting"
if [ ! -d "$SYNTAX_HIGHLIGHTING" ]; then
  git clone https://github.com/zsh-users/zsh-syntax-highlighting "$SYNTAX_HIGHLIGHTING"
fi
source "$SYNTAX_HIGHLIGHTING/zsh-syntax-highlighting.zsh"


# tmux shit
if command -v tmux >/dev/null 2>&1; then
  if [ -z "$TMUX" ] && [ -n "$PS1" ] && [[ "$TERM" != "linux" ]]; then
    tmux attach -t default || tmux new -s default
  fi
fi

[[ -r "/usr/share/z/z.sh" ]] && source /usr/share/z/z.sh

export QT_QPA_PLATFORM=wayland

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/cli/sf/bin:$HOME/.platformio/penv/bin:$HOME/scripts"

. "$HOME/.local/bin/env"

# _fzf_search() {
#     local base_dir=$1
#     local type=$2
#     local mode=$3
#
#     if [[ "$mode" == "ripgrep" ]]; then
#         local res=$(rg --column --line-number --no-heading --color=always --smart-case "" "$base_dir" | \
#             fzf --ansi --delimiter : --preview 'bat --style=numbers --color=always --highlight-line {2} {1}')
#         [[ -n "$res" ]] && nvim $(echo $res | cut -d: -f1) +$(echo $res | cut -d: -f2)
#     else
#         local res=$(fd --type "$type" . "$base_dir" | fzf --preview '[[ -d {} ]] && eza -T {} || bat --color=always {}')
#         if [[ -n "$res" ]]; then
#             if [[ "$type" == "d" ]]; then
#                 cd "$res"
#             else
#                 nvim "$res"
#             fi
#         fi
#     fi
#     zle reset-prompt
# }
#
# fzf_here_f()  { _fzf_search . f }
# fzf_here_d()  { _fzf_search . d }
# fzf_here_rg() { _fzf_search . "" ripgrep }
# fzf_home_f()  { _fzf_search ~ f }
# fzf_home_d()  { _fzf_search ~ d }
# fzf_home_rg() { _fzf_search ~ "" ripgrep }
# fzf_root_f()  { _fzf_search / f }
# fzf_root_g()  { _fzf_search / d }
#
# zle -N fzf_here_f
# zle -N fzf_here_d
# zle -N fzf_here_rg
# zle -N fzf_home_f
# zle -N fzf_home_d
# zle -N fzf_home_rg
# zle -N fzf_root_f
# zle -N fzf_root_g
#
# bindkey '^j' fzf_here_f
# bindkey '^g' fzf_here_d
# bindkey '^k' fzf_here_rg
#
# bindkey '^@j' fzf_home_f
# bindkey '^@g' fzf_home_d
# bindkey '^@k' fzf_home_rg
#
# bindkey '^[^@j' fzf_root_f
# bindkey '^[^@g' fzf_root_g