diff --git a/.gitmodules b/.gitmodules index d932b65..77971d9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,27 +1,3 @@ [submodule "pure"] path = pure - url = https://github.com/sindresorhus/pure -[submodule "zsh-autosuggestions"] - path = zsh-autosuggestions - url = https://github.com/zsh-users/zsh-autosuggestions -[submodule "zsh-syntax-highlighting"] - path = zsh-syntax-highlighting - url = https://github.com/zsh-users/zsh-syntax-highlighting.git -[submodule "powerlevel10k"] - path = powerlevel10k - url = https://github.com/romkatv/powerlevel10k.git -[submodule "zsh-you-should-use"] - path = zsh-you-should-use - url = https://github.com/MichaelAquilina/zsh-you-should-use.git -[submodule "ssh-connect"] - path = ssh-connect - url = https://github.com/gko/ssh-connect.git -[submodule "web-search"] - path = web-search - url = https://github.com/sineto/web-search.git -[submodule "git"] - path = git - url = https://github.com/davidde/git.git -[submodule "zsh-z"] - path = zsh-z - url = https://github.com/agkozak/zsh-z.git + url = https://github.com/sindresorhus/pure.git diff --git a/zshrc.pure b/.zshrc similarity index 80% rename from zshrc.pure rename to .zshrc index 4602962..6a731aa 100644 --- a/zshrc.pure +++ b/.zshrc @@ -5,7 +5,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi -# Dependancies You Need for this Config +# Dependencies You Need for this Config # zsh-syntax-highlighting - syntax highlighting for ZSH in standard repos # autojump - jump to directories with j or jc for child or jo to open in file manager # zsh-autosuggestions - Suggestions based on your history @@ -21,14 +21,7 @@ autoload -U colors && colors PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " # Custom Variables -EDITOR=nano - -# Pure Prompt -fpath+=$HOME/zsh/pure -autoload -U promptinit; promptinit -prompt pure -PURE_PROMPT_SYMBOL=\$ -PURE_PROMPT_VICMD_SYMBOL=\< +EDITOR=vim # History in cache directory: HISTSIZE=10000 @@ -45,16 +38,13 @@ _comp_options+=(globdots) # Include hidden files. # Custom ZSH Binds bindkey '^ ' autosuggest-accept -bindkey "^[[H" beginning-of-line -bindkey "^[[F" end-of-line -bindkey "^[[3~" delete-char # Load aliases and shortcuts if existent. [ -f "$HOME/zsh/aliasrc" ] && source "$HOME/zsh/aliasrc" # Load ; should be last. -source $HOME/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null -source $HOME/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null +source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null source /usr/share/autojump/autojump.zsh 2>/dev/null source ~/powerlevel10k/powerlevel10k.zsh-theme diff --git a/README.md b/README.md index 1a044ef..1e340d8 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,34 @@ -# ZSH -My ZSH config +# zsh + +My ZSH Config ## Setup - - Clone the repository to your home folder -``` -cd ~ -git clone --recursive https://github.com/jiriks74/zsh -``` -### `powerlevel10k` theme - - Link the `zsh` file to your home folder as `.zshrc` -``` -ln -s ~/zsh/zshrc ~/.zshrc -``` - - Set the `powerlevel10k` theme the way you like it -``` -zsh -``` - - If configuration won't start automatically, just run -``` -p10k config -``` -### `pure` shell theme - - Link the `zsh.pure` file to your home folder as `.zshrc` -``` -ln -s ~/zsh/zshrc.pure ~/.zsh -``` -## Get Dependancies +``` +touch "$HOME/.cache/zshhistory" +#-- Setup Alias in $HOME/zsh/aliasrc +git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k +echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >> ~/.zshrc +``` -### Included in this repository - - [`zsh-z`](https://github.com/agkozak/zsh-z) - ZSH plugin that is alternative to `autojump`. Use `z dirname`to go to a specific directory on your system without having to type the whole path (eg `z et` will get you to `/etc`) - - [`dirhistory`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dirhistory) - Plugin from oh my zsh that allows you to easily go through history of directories (due to this not being a repository I have to update this plugin manually. If it's out of date, please create an issue) - - [`ssh-connect`](https://github.com/gko/ssh-connect) - Plugin that logs your `ssh` commands and provides a nice menu with your recent connections (alias: `sshc`) - - [`web-search`](https://github.com/sineto/web-search) - Allows you to DuckDuckGo, Google, etc. directly from your zsh. just run `ddg` or `google` - - [`zsh-you-should-use`](https://github.com/MichaelAquilina/zsh-you-should-use) - Usefull plugin that suggest existing aliases for a command you just ran (try it out with `ls -l`) - - [`zsh-autosuggestions`](https://github.com/zsh-users/zsh-autosuggestions) - Suggestions based on your history - - [`git`](https://github.com/davidde/git) - Usefull git aliases - - [`zsh-syntax-highlighting`](https://github.com/zsh-users/zsh-syntax-highlighting) - Syntax highlighting for ZSH - - [`powerlevel10k`](https://github.com/romkatv/powerlevel10k) theme - The the actual theme - - [`pure`](https://github.com/sindresorhus/pure) - Pure shell look for zsh +## Get Dependencies -### Install from your distribution's repository - - [`thefuck`](https://github.com/nvbn/thefuck) - Corrects errors in previous console commands (when you mess up a command, type `fuck`) +- zsh-syntax-highlighting - syntax highlighting for ZSH in standard repos +- autojump - jump to directories with j or jc for child or jo to open in file manager +- zsh-autosuggestions - Suggestions based on your history -### Recomended for `powerlevel10k` - - [`nerd-fonts`](https://github.com/ryanoasis/nerd-fonts "nerd-fonts github page") - I recomend `MesloLGS NF Regular` - - On Arch you can use `ttf-meslo-nerd-font-powerlevel10k` so you don't have to donwload the whole git repository +### Debian Dependencies -## Set as default -To set zsh as default shell for your user, edit `/etc/passwd` (from `/bin/bash` to `/bin/zsh`) +```bash +sudo apt install zsh-syntax-highlighting autojump zsh-autosuggestions +``` -### There are two ways: -#### Running this command: -- ```chsch $USER``` -- Input your password -- Input `/bin/zsh` +### Arch Dependencies -#### Modifying `/etc/passwd` - * Change your user in `/etc/passwd` to `/bin/zsh` instead of `/bin/bash` -
+```bash +yay -S zsh-syntax-highlighting autojump zsh-autosuggestions +``` + +Finish the conversion by changing your user in /etc/passwd to /bin/zsh instead of /bin/bash - * Find line containing your username - * Change the end of the line - From: ...`:/bin/bash` - - To: ...`:/bin/zsh` -
+or typing `chsh $USER` and entering `/bin/zsh` diff --git a/aliasrc b/aliasrc index 315b2e1..96c166c 100644 --- a/aliasrc +++ b/aliasrc @@ -1,6 +1,3 @@ -##pacman-update country -update=CZ - # # # ex - archive extractor # # usage: ex @@ -12,7 +9,7 @@ ex () *.tar.gz) tar xzf $1 ;; *.tar.xz) tar xJf $1 ;; *.bz2) bunzip2 $1 ;; - *.rar) unrar x $1 ;; + *.rar) unrar x $1 ;; *.gz) gunzip $1 ;; *.tar) tar xf $1 ;; *.tbz2) tar xjf $1 ;; @@ -27,18 +24,11 @@ ex () fi } -pacmanupdate () -{ - echo "Enter your country (like 'US' or 'CZ')"; - read update; - sudo reflector -c $update -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist; -} +export EDITOR=vim -export EDITOR=nano +alias pacman-update='sudo pacman-mirrors --geoip' -alias pacman-update='sudo reflector -c $country -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist' - -alias ls='ls --color' +alias ls='ls' alias ll='ls -l' # ls, the common ones I use a lot shortened for rapid fire usage alias l='ls -lFh' #size,show type,human readable @@ -85,27 +75,22 @@ alias unexport='unset' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' - -alias wallpaper=/home/$USER/.local/bin/wallpaper - -#alias vim='vim' -#alias vi='vim' -#gitpush() { -# git add . -# git commit -m "$*" -# git pull -# git push -#} -#gitupdate() { -# eval "$(ssh-agent -s)" -# ssh-add ~/.ssh/github -# ssh -T git@github.com -#} -#alias gp=gitpush -#alias gu=gitupdate - +alias vim='vim' +alias vi='vim' +alias gds-start='sudo systemctl start openvpn-client@gds' +alias gds-stop='sudo systemctl stop openvpn-client@gds' +gitpush() { + git add . + git commit -m "$*" + git pull + git push +} +gitupdate() { + eval "$(ssh-agent -s)" + ssh-add ~/.ssh/github + ssh -T git@github.com +} +alias gp=gitpush +alias gu=gitupdate +alias lbrynet='/opt/LBRY/resources/static/daemon/lbrynet' alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg' -#alias firefox='GTK_USE_PORTAL=1 firefox' -alias cls="clear" - -alias sshc='ssh-connect' diff --git a/git b/git deleted file mode 160000 index b60e5e3..0000000 --- a/git +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b60e5e36c65f76a29eeacbfb7f5de1cd00c86115 diff --git a/oh-my-zsh-dirhistory/dirhistory.plugin.zsh b/oh-my-zsh-dirhistory/dirhistory.plugin.zsh deleted file mode 100644 index 7021fc0..0000000 --- a/oh-my-zsh-dirhistory/dirhistory.plugin.zsh +++ /dev/null @@ -1,221 +0,0 @@ -## -# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories -# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. -# -# Navigate directory hierarchy using ALT-UP and ALT-DOWN. -# ALT-UP moves to higher hierarchy (cd ..) -# ALT-DOWN moves into the first directory found in alphabetical order -# - -dirhistory_past=($PWD) -dirhistory_future=() -export dirhistory_past -export dirhistory_future - -export DIRHISTORY_SIZE=30 - -# Pop the last element of dirhistory_past. -# Pass the name of the variable to return the result in. -# Returns the element if the array was not empty, -# otherwise returns empty string. -function pop_past() { - typeset -g $1="${dirhistory_past[$#dirhistory_past]}" - if [[ $#dirhistory_past -gt 0 ]]; then - dirhistory_past[$#dirhistory_past]=() - fi -} - -function pop_future() { - typeset -g $1="${dirhistory_future[$#dirhistory_future]}" - if [[ $#dirhistory_future -gt 0 ]]; then - dirhistory_future[$#dirhistory_future]=() - fi -} - -# Push a new element onto the end of dirhistory_past. If the size of the array -# is >= DIRHISTORY_SIZE, the array is shifted -function push_past() { - if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then - shift dirhistory_past - fi - if [[ $#dirhistory_past -eq 0 || $dirhistory_past[$#dirhistory_past] != "$1" ]]; then - dirhistory_past+=($1) - fi -} - -function push_future() { - if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then - shift dirhistory_future - fi - if [[ $#dirhistory_future -eq 0 || $dirhistory_futuret[$#dirhistory_future] != "$1" ]]; then - dirhistory_future+=($1) - fi -} - -# Called by zsh when directory changes -autoload -U add-zsh-hook -add-zsh-hook chpwd chpwd_dirhistory -function chpwd_dirhistory() { - push_past $PWD - # If DIRHISTORY_CD is not set... - if [[ -z "${DIRHISTORY_CD+x}" ]]; then - # ... clear future. - dirhistory_future=() - fi -} - -function dirhistory_cd(){ - DIRHISTORY_CD="1" - cd $1 - unset DIRHISTORY_CD -} - -# Move backward in directory history -function dirhistory_back() { - local cw="" - local d="" - # Last element in dirhistory_past is the cwd. - - pop_past cw - if [[ "" == "$cw" ]]; then - # Someone overwrote our variable. Recover it. - dirhistory_past=($PWD) - return - fi - - pop_past d - if [[ "" != "$d" ]]; then - dirhistory_cd $d - push_future $cw - else - push_past $cw - fi -} - - -# Move forward in directory history -function dirhistory_forward() { - local d="" - - pop_future d - if [[ "" != "$d" ]]; then - dirhistory_cd $d - push_past $d - fi -} - - -# Bind keys to history navigation -function dirhistory_zle_dirhistory_back() { - # Erase current line in buffer - zle .kill-buffer - dirhistory_back - zle .accept-line -} - -function dirhistory_zle_dirhistory_future() { - # Erase current line in buffer - zle .kill-buffer - dirhistory_forward - zle .accept-line -} - -zle -N dirhistory_zle_dirhistory_back -zle -N dirhistory_zle_dirhistory_future - -for keymap in emacs vicmd viins; do - # dirhistory_back - bindkey -M $keymap "\e[3D" dirhistory_zle_dirhistory_back # xterm in normal mode - bindkey -M $keymap "\e[1;3D" dirhistory_zle_dirhistory_back # xterm in normal mode - bindkey -M $keymap "\e\e[D" dirhistory_zle_dirhistory_back # Putty - bindkey -M $keymap "\eO3D" dirhistory_zle_dirhistory_back # GNU screen - - case "$TERM_PROGRAM" in - Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app - iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2 - esac - - if (( ${+terminfo[kcub1]} )); then - bindkey -M $keymap "^[${terminfo[kcub1]}" dirhistory_zle_dirhistory_back # urxvt - fi - - # dirhistory_future - bindkey -M $keymap "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode - bindkey -M $keymap "\e[1;3C" dirhistory_zle_dirhistory_future # xterm in normal mode - bindkey -M $keymap "\e\e[C" dirhistory_zle_dirhistory_future # Putty - bindkey -M $keymap "\eO3C" dirhistory_zle_dirhistory_future # GNU screen - - case "$TERM_PROGRAM" in - Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app - iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2 - esac - - if (( ${+terminfo[kcuf1]} )); then - bindkey -M $keymap "^[${terminfo[kcuf1]}" dirhistory_zle_dirhistory_future # urxvt - fi -done - -# -# HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings -# - -# Move up in hierarchy -function dirhistory_up() { - cd .. || return 1 -} - -# Move down in hierarchy -function dirhistory_down() { - cd "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return 1 -} - - -# Bind keys to hierarchy navigation -function dirhistory_zle_dirhistory_up() { - zle .kill-buffer # Erase current line in buffer - dirhistory_up - zle .accept-line -} - -function dirhistory_zle_dirhistory_down() { - zle .kill-buffer # Erase current line in buffer - dirhistory_down - zle .accept-line -} - -zle -N dirhistory_zle_dirhistory_up -zle -N dirhistory_zle_dirhistory_down - -for keymap in emacs vicmd viins; do - # dirhistory_up - bindkey -M $keymap "\e[3A" dirhistory_zle_dirhistory_up # xterm in normal mode - bindkey -M $keymap "\e[1;3A" dirhistory_zle_dirhistory_up # xterm in normal mode - bindkey -M $keymap "\e\e[A" dirhistory_zle_dirhistory_up # Putty - bindkey -M $keymap "\eO3A" dirhistory_zle_dirhistory_up # GNU screen - - case "$TERM_PROGRAM" in - Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app - iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2 - esac - - if (( ${+terminfo[kcuu1]} )); then - bindkey -M $keymap "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt - fi - - # dirhistory_down - bindkey -M $keymap "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode - bindkey -M $keymap "\e[1;3B" dirhistory_zle_dirhistory_down # xterm in normal mode - bindkey -M $keymap "\e\e[B" dirhistory_zle_dirhistory_down # Putty - bindkey -M $keymap "\eO3B" dirhistory_zle_dirhistory_down # GNU screen - - case "$TERM_PROGRAM" in - Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app - iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2 - esac - - if (( ${+terminfo[kcud1]} )); then - bindkey -M $keymap "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt - fi -done - -unset keymap diff --git a/powerlevel10k b/powerlevel10k deleted file mode 160000 index 683a485..0000000 --- a/powerlevel10k +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 683a485232d75978a79199a305c4fc4843772a77 diff --git a/pure b/pure deleted file mode 160000 index 90dc9cf..0000000 --- a/pure +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 90dc9cf908481cc155e1ce5611f684916523fc30 diff --git a/ssh-connect b/ssh-connect deleted file mode 160000 index 788d90f..0000000 --- a/ssh-connect +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 788d90f761bd3f2f24bad3780aceef7cf1efee94 diff --git a/web-search b/web-search deleted file mode 160000 index e2c498d..0000000 --- a/web-search +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e2c498dc9d573c731be69fb0d6000822ebe49185 diff --git a/zsh-autosuggestions b/zsh-autosuggestions deleted file mode 160000 index a411ef3..0000000 --- a/zsh-autosuggestions +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8 diff --git a/zsh-syntax-highlighting b/zsh-syntax-highlighting deleted file mode 160000 index c7caf57..0000000 --- a/zsh-syntax-highlighting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c7caf57ca805abd54f11f756fda6395dd4187f8a diff --git a/zsh-you-should-use b/zsh-you-should-use deleted file mode 160000 index 773ae5f..0000000 --- a/zsh-you-should-use +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 773ae5f414b296b4100f1ab6668ecffdab795128 diff --git a/zsh-z b/zsh-z deleted file mode 160000 index b5e61d0..0000000 --- a/zsh-z +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b5e61d03a42a84e9690de12915a006b6745c2a5f diff --git a/zshrc b/zshrc deleted file mode 100644 index b096726..0000000 --- a/zshrc +++ /dev/null @@ -1,55 +0,0 @@ -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block; everything else may go below. -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - -source ~/zsh/powerlevel10k/powerlevel10k.zsh-theme - -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - -# History in cache directory: -HISTSIZE=10000 -SAVEHIST=10000 -HISTFILE=~/.cache/zshhistory - -# Basic auto/tab complete: -autoload -U compinit -zstyle ':completion:*' menu select -zmodload zsh/complist -compinit -_comp_options+=(globdots) # Include hidden files. - -# Custom ZSH Binds -bindkey '^ ' autosuggest-accept -bindkey "^[[H" beginning-of-line -bindkey "^[[F" end-of-line -bindkey "^[[3~" delete-char - -# Some basic env setup -export PATH=$PATH:/home/$USER/.local/bin -export DOTNET_CLI_TELEMETRY_OPTOUT=1 -export YSU_MESSAGE_POSITION="after" - -# Load aliases and shortcuts if existent. -[ -f "$HOME/zsh/aliasrc" ] && source "$HOME/zsh/aliasrc" - -# Initialize `thefuck` -if command -v thefuck &> /dev/null -then - eval $(thefuck --alias) -fi - -# Load ; should be last. -source $HOME/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null -source $HOME/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null -source $HOME/zsh/zsh-you-should-use/you-should-use.plugin.zsh 2>/dev/null -source $HOME/zsh/git/git.plugin.zsh 2>/dev/null -source $HOME/zsh/ssh-connect/ssh-connect.sh 2>/dev/null -source $HOME/zsh/web-search/web_search.plugin.zsh 2>/dev/null -source $HOME/zsh/oh-my-zsh-dirhistory/dirhistory.plugin.zsh 2>/dev/null -source $HOME/zsh/zsh-z/zsh-z.plugin.zsh 2>/dev/null -#source /usr/share/autojump/autojump.zsh 2>/dev/null -alias mon2cam="deno run --unstable -A -r -q https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/mod.ts"