-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc_personal
178 lines (128 loc) · 4.66 KB
/
.zshrc_personal
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# dummy comment 1
#to install ohmyzsh
#sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
export PATH="$PATH:/Users/jordanmandel/.local/bin"
export PATH="$PATH:/Users/jordanmandel/bin"
# ``````````Vim configuration things`````
export vimrc="$HOME/dotfiles/.config/nvim/init.lua"
export zshrc="$HOME/dotfiles/.zshrc_personal"
alias vi='nvim'
alias vin='nvim --cmd "let g:flatten_allow_nesting = v:true"'
alias van="man -P 'nvim -c Man! -c set\ nonumber -c set\ norelativenumber --cmd let\ g:flatten_allow_nesting=v:true'"
export MANPAGER='nvim --clean -c Man! -c set\ nonumber -c set\ norelativenumber --cmd let\ g:flatten_allow_nesting=v:true'
alias ptpython='ptpython --vi --dark-bg'
alias python='python'
alias pdflatex="pdflatex -synctex=1"
alias cb=clipboard
alias ll='ls -lG'
alias ls='ls -G'
alias pd='pandoc'
export TERMINAL="kitty"
if [[ "$(uname -s)" == "Darwin" ]]; then
alias vim="mvim -v"
fi
export BROWSER="/usr/bin/firefox-developer-edition"
export EDITOR="nvim"
case "$OSTYPE" in
darwin*) VISUAL='/usr/local/bin/nvim --cmd "let g:flatten_allow_nesting = v:true"' ;; # macOS
linux*) VISUAL="$HOME/.visual_editor.bash" ;; # Linux
esac
export VIMCONFIG=~/.config/nvim #vim configuration directory
export VIMDATA=~/.local/share/nvim # vim data directory (need to learn more about this)
export NVIM_SWAP="$HOME/.local/state/nvim/swap"
bindkey -e -r '^[x'
bindkey -a -r ':'
set -o vi #use vi editing mode in the terminal
KEYTIMEOUT=1 #get rid of pause after switching modes in vim mode
mkcd () {
mkdir "$1" && cd "$1"
}
mkcdp () {
mkdir -p "$1" && cd "$1"
}
#history settings
SAVEHIST=100000 #stting the history length
HISTSIZE=100000 #stting the history length
HISTFILE=~/.zhistory
bindkey "^R" history-incremental-pattern-search-backward
# setting some useful environment variables
export tododir="$HOME/Documents/diaries/"
export diaries="$HOME/Documents/diaries/"
export diaries_thoughts="$HOME/Documents/diaries/diaries_thoughts.md"
export diaries_todo="$HOME/Documents/diaries/to_do_short.md"
export diaries_plans="$HOME/Documents/diaries/to_do_long.md"
export diaries_memories="$HOME/Documents/diaries/diaries_memories.md"
export diaries_musings="$HOME/Documents/diaries/thoughts_unstructured.md"
export diaries_affirmations="$HOME/Documents/diaries/affirmations.md"
export diaries_dreams="$HOME/Documents/diaries/diaries_dreams.md"
export diaries_events="$HOME/Documents/diaries/diaries_events.md"
################### VCS info ########################
# Enabling and setting git info var to be used in prompt config.
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg
# This line obtains information from the vcs.
zstyle ':vcs_info:git*' formats "⎇%b"
get_vcs () {
vcs_info
}
precmd_functions+=(get_vcs)
############ making custom prompt #################
# perform parameter expansion/command substitution in prompt definition
setopt PROMPT_SUBST
vim_ins_mode=">"
vim_cmd_mode="%%"
vim_mode=$vim_ins_mode
function zle-keymap-select {
vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}"
zle reset-prompt
}
zle -N zle-keymap-select
function zle-line-finish {
vim_mode=$vim_ins_mode
}
zle -N zle-line-finish
# Define ANSI color variables outside precmd to avoid redefinition
export LIGHT_MAGENTA=$'\e[95m'
export RESET_COLOR=$'\e[0m'
if [[ "$EUID" = 0 ]]; then
PS1='%B%F{green}%M:su:%3~%f%b${vcs_info_msg_0_}%B%F{green}${vim_mode}%f%b '
else
PS1='%{$LIGHT_MAGENTA%}%B%M:%3~%{$RESET_COLOR%}${vcs_info_msg_0_}%{$LIGHT_MAGENTA%}${vim_mode}%{$RESET_COLOR%}%b '
fi
## done making prompt
# Define the 'glog' function
glog () {
git log --graph --all --decorate --oneline --pretty=format:'%C(auto)%h %d %s %cd' --date=short "$@"
}
# Enable git completion for the 'glog' function
autoload -Uz compinit && compinit -i
compdef glog=git
setopt noauto_pushd
function cheat ()
{
curl cheat.sh/$1
}
export FZF_DEFAULT_COMMAND='fd --type f --color=never'
export FZF_ALT_C_COMMAND='fd --type d . --color=never'
function setpwd {
OLDPWD=$PWD
export OLDPWD
PWD=$(pwd)
export PWD
}
precmd_functions+=(setpwd)
# Define a function that writes the current working directory to /tmp/[pid]
write_cwd_to_file () {
local USER=$(whoami) # Capture the username
echo $PWD > /tmp/whereami_$USER # write the current directory to a user-specific file
}
# Add the function to precmd_functions
precmd_functions+=(write_cwd_to_file)
alias luamake=/Users/jordanmandel/Documents/lua-language-server/3rd/luamake/luamake
if command -v zoxide >/dev/null 2>&1; then
eval "$(zoxide init --cmd cd zsh)"
else
echo "zoxide is not installed, falling back to standard cd"
fi
setopt completealiases
echo ".zshrc sourced"