summaryrefslogtreecommitdiff
path: root/config/essentials
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-01-05 16:56:42 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-01-05 16:56:42 +0100
commite6e98313b9769b431d8a66c0aac2b82295d2bf1e (patch)
tree1cdbc2075815fa88a0b80818174542e00a41f855 /config/essentials
parent541ab2e483efe77d08ae5d04119a834f24b6d150 (diff)
parent0d10205772b2745356969176de6f52510527e5a6 (diff)
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'config/essentials')
-rw-r--r--config/essentials/git/config7
-rw-r--r--config/essentials/nvim/after/plugin/telescope.lua13
-rw-r--r--config/essentials/nvim/lua/user/init.lua4
-rw-r--r--config/essentials/nvim/lua/user/packer.lua2
-rw-r--r--config/essentials/nvim/lua/user/treesitter.lua31
-rw-r--r--config/essentials/nvim/lua/user/zk.lua5
-rw-r--r--config/essentials/shell/aliases.sh (renamed from config/essentials/zsh/aliases.sh)75
-rw-r--r--config/essentials/shell/functions.sh (renamed from config/essentials/zsh/functions.zsh)72
-rw-r--r--config/essentials/zsh/.zshrc64
9 files changed, 163 insertions, 110 deletions
diff --git a/config/essentials/git/config b/config/essentials/git/config
index 66ed53e..fcf80db 100644
--- a/config/essentials/git/config
+++ b/config/essentials/git/config
@@ -3,7 +3,10 @@
[user]
email = raymaekers.luca@gmail.com
name = Raymaekers Luca
+ signingkey = 3A626DD20A32EB2E5DD9CE71CFD9ABC97158CD5D
+[push]
+ autosetupremote = true
[pull]
rebase = false
-[merge]
- ff = false
+[commit]
+ gpgsign = true
diff --git a/config/essentials/nvim/after/plugin/telescope.lua b/config/essentials/nvim/after/plugin/telescope.lua
index 7a2ef34..32a7fbf 100644
--- a/config/essentials/nvim/after/plugin/telescope.lua
+++ b/config/essentials/nvim/after/plugin/telescope.lua
@@ -1,3 +1,4 @@
+-- require('telescope').load_extension('fzf')
require('telescope').load_extension('media_files')
require('telescope').setup({
@@ -11,12 +12,12 @@ require('telescope').setup({
dynamic_preview_title = true,
},
extensions = {
- fzf = {
- fuzzy = true,
- override_generic_sorter = true,
- override_file_sorter = true,
- case_mode = "smart_case",
- },
+ -- fzf = {
+ -- fuzzy = true,
+ -- override_generic_sorter = true,
+ -- override_file_sorter = true,
+ -- case_mode = "smart_case",
+ -- },
media_files = {
filetypes = {"png", "webp", "jpg", "jpeg"},
find_cmd = "rg"
diff --git a/config/essentials/nvim/lua/user/init.lua b/config/essentials/nvim/lua/user/init.lua
index f195e4f..de96b5c 100644
--- a/config/essentials/nvim/lua/user/init.lua
+++ b/config/essentials/nvim/lua/user/init.lua
@@ -1,8 +1,8 @@
-require("user.lazy")
+require("user.packer")
require("user.remap")
require("user.treesitter")
require("user.set")
-require("user.cmp")
+-- require("user.cmp")
require("user.zk")
require("user.live-server")
vim.cmd.source(vim.fn.stdpath("config") .. "/lua/user/aucommands.vim")
diff --git a/config/essentials/nvim/lua/user/packer.lua b/config/essentials/nvim/lua/user/packer.lua
index 8091d85..edb763d 100644
--- a/config/essentials/nvim/lua/user/packer.lua
+++ b/config/essentials/nvim/lua/user/packer.lua
@@ -42,7 +42,7 @@ return require('packer').startup(function(use)
use('ojroques/vim-oscyank', { branch = "main" })
use("potamides/pantran.nvim")
use('alx741/vinfo')
- use('sheerun/vim-polyglot')
+ -- use('sheerun/vim-polyglot') TODO: fix error conflicting with telekasten
-- use('github/copilot.vim')
--
use {
diff --git a/config/essentials/nvim/lua/user/treesitter.lua b/config/essentials/nvim/lua/user/treesitter.lua
index 5b1fc5e..2355215 100644
--- a/config/essentials/nvim/lua/user/treesitter.lua
+++ b/config/essentials/nvim/lua/user/treesitter.lua
@@ -9,36 +9,9 @@ require'nvim-treesitter.configs'.setup {
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
- -- List of parsers to ignore installing (or "all")
- ignore_install = { "javascript" },
+ indent = { enable = on },
- ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
- -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
- indent = {
- enable = on
- },
+ highlight = { enable = true, },
- highlight = {
- enable = true,
-
- -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
- -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
- -- the name of the parser)
- -- list of language that will be disabled
- disable = { "c", "rust" },
- -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
- disable = function(lang, buf)
- local max_filesize = 100 * 1024 -- 100 KB
- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
- if ok and stats and stats.size > max_filesize then
- return true
- end
- end,
-
- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
- -- Using this option may slow down your editor, and you may see some duplicate highlights.
- -- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
- },
}
diff --git a/config/essentials/nvim/lua/user/zk.lua b/config/essentials/nvim/lua/user/zk.lua
index 98476ca..3641025 100644
--- a/config/essentials/nvim/lua/user/zk.lua
+++ b/config/essentials/nvim/lua/user/zk.lua
@@ -41,6 +41,11 @@ require("telekasten").setup({
media_previewer = "telescope-media-files",
follow_url_fallback = nil,
vaults = {
+ Ideas = {
+ home = home .. "/" .. "Ideas",
+ template_new_note = home .. "/" .. "templates/new_note.md",
+ new_note_filename = "title",
+ },
Driving = {
home = home .. "/" .. "Driving",
template_new_note = home .. "/" .. "templates/new_note.md",
diff --git a/config/essentials/zsh/aliases.sh b/config/essentials/shell/aliases.sh
index 0da835a..99c49d8 100644
--- a/config/essentials/zsh/aliases.sh
+++ b/config/essentials/shell/aliases.sh
@@ -1,6 +1,9 @@
-#!/bin/zsh
+#!/bin/sh
# s/alias \([^-]\)/alias -g \1
+# The most important one
+alias vi='emacsclient -nw'
+
# Zsh specific aliases
if [ $SHELL = "/bin/zsh" ]
then
@@ -137,7 +140,7 @@ alias ss4='ss -tln4p'
alias mdb='mariadb -u admin -ppass admindb'
alias mdbw='mariadb -h 0.0.0.0 -u padmin -pbulbizarre padmindb'
alias mdbwa='mariadb -h 10.3.50.5 -u padmin -pbulbizarre padmindb'
-alias tmux='tmux a || tmux'
+alias tmux='pgrep tmux && tmux attach || tmux new-session'
# ssh
alias sha='ssh-add'
@@ -180,7 +183,7 @@ alias gdate='date +%y_%m_%d-%T'
alias tpid='tail -f /dev/null --pid'
alias pwdcp='pwd | clipp'
alias gw="grep -ri"
-alias srcsupd='echo ~/src/{installdrier,dotfiles,password-store} | supd'
+alias srcsupd='echo ~/src/{installdrier,dotfiles,password-store} ~/.config/emacs | supd'
# systemctl aliases
alias smc='systemctl'
@@ -191,15 +194,17 @@ alias smcr='systemctl restart'
alias smcrl='systemctl reload'
alias smcd='systemctl daemon-reload'
alias smce='systemctl edit'
+alias smcen='systemctl enable'
#user
alias smcu='systemctl --user'
-alias smcus='systemctl status --user'
-alias smcust='systemctl start --user'
-alias smcuS='systemctl stop --user'
-alias smcur='systemctl restart --user'
-alias smcurl='systemctl reload --user'
-alias smcud='systemctl daemon-reload --user'
-alias smcue='systemctl edit --user'
+alias smcus='systemctl --user status'
+alias smcust='systemctl --user start'
+alias smcuS='systemctl --user stop'
+alias smcur='systemctl --user restart'
+alias smcurl='systemctl --user reload'
+alias smcud='systemctl --user daemon-reload'
+alias smcue='systemctl --user edit'
+alias smcuen='systemctl --user enable'
#doas
alias dsmc='doas systemctl'
alias dsmcs='doas systemctl status'
@@ -209,6 +214,7 @@ alias dsmcr='doas systemctl restart'
alias dsmcrl='doas systemctl reload'
alias dsmcd='doas systemctl daemon-reload'
alias dsmce='doas systemctl edit'
+alias dsmcen='doas systemctl enable'
# virtualbox aliases
alias vbm='vboxmanage'
@@ -217,28 +223,29 @@ alias vblsr='vbm list runningvms'
alias vb='vbm startvm'
# quick config
-alias ez='$EDITOR ${ZDOTDIR:-~}/.zshrc'
-alias eza='$EDITOR ${ZDOTDIR}/aliases.sh'
-alias ezf='$EDITOR ${ZDOTDIR}/functions.zsh'
-alias eto='$EDITOR ~/sync/TODO'
-alias edw='$EDITOR ~/proj/suckless/dwm/config.def.h'
-alias edm='$EDITOR ~/proj/suckless/dmenu/config.def.h'
-alias ehst='$EDITOR $ZDOTDIR/histfile'
-alias ezh=' $EDITOR $HISTFILE'
-alias est='$EDITOR ~/proj/suckless/st/config.def.h'
-alias esl='$EDITOR ~/proj/suckless/slock/config.def.h'
-alias esls='$EDITOR ~/proj/suckless/slstatus/config.def.h'
-alias ehy='$EDITOR ~/.config/hypr/hyprland.conf'
-alias ehyb='$EDITOR ~/.config/hypr/binds.conf'
-alias ewbj='$EDITOR ~/.config/waybar/config.jsonc'
-alias ewbs='$EDITOR ~/.config/waybar/style.css'
-alias cfd='$EDITOR config.def.h'
+alias ez='vi ${ZDOTDIR:-~}/.zshrc'
+alias eza='vi $HOME/.config/shell/aliases.sh'
+alias ezf='vi $HOME/.config/shell/functions.sh'
+alias eto='vi ~/sync/TODO'
+alias edw='vi ~/proj/suckless/dwm/config.def.h'
+alias edm='vi ~/proj/suckless/dmenu/config.def.h'
+alias ehst='vi $ZDOTDIR/histfile'
+alias ezh=' vi $HISTFILE'
+alias est='vi ~/proj/suckless/st/config.def.h'
+alias esl='vi ~/proj/suckless/slock/config.def.h'
+alias esls='vi ~/proj/suckless/slstatus/config.def.h'
+alias ehy='vi ~/.config/hypr/hyprland.conf'
+alias ehyb='vi ~/.config/hypr/binds.conf'
+alias ewbj='vi ~/.config/waybar/config.jsonc'
+alias ewbs='vi ~/.config/waybar/style.css'
+alias cfd='vi config.def.h'
# /# quick cd jV}k:!sort -t "'" -k 2
alias cdl='cd ~/dl'
alias cdoc='cd ~/docs'
alias czk='cd ~/docs/zk'
alias cda='cd ~/docs/android/projects'
alias csv='cd ~/docs/school/Vakken'
+alias cdpj='cd ~/docs/school/Vakken/ITProj'
alias cdm='cd ~/music'
alias cdp='cd ~/pics'
alias cdpa='cd ~/pics/ai-outputs/'
@@ -265,21 +272,28 @@ alias czo='cd ~/zot/'
alias cdpw='cd ${PASSWORD_STORE_DIR:-~/.password-store}'
alias cdng='cd /etc/nginx'
alias cdrs='cd /srv/'
+alias cdv='cd ~/vids'
alias god='cd "$(find . -mindepth 1 -maxdepth 1 -type d | fzf)"'
+alias gov='go ~/vids d'
# fzf aliases
alias ppj='cd ~/proj/personal/"$(find ~/proj/personal -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | fzf)"'
alias ppjs='cd ~/proj/personal/scripts/"$(find ~/proj/personal/scripts -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | fzf)"'
alias scr='edit_in_dir ~/proj/personal/scripts/'
alias fil='edit_in_dir ~/docs/filios/'
-alias cfg='edit_in_dir ~/src/dotfiles'
alias fzps='ps aux | tail +2 | fzf | tee /dev/stderr | awk '\''{print $2}'\'' | clipp'
alias asf='alias | fzf'
-alias fzh="tac $HISTFILE | fzf | tee /dev/stderr | clipp"
+alias fzh="fzf --tac < $HISTFILE | tee /dev/stderr | clipp"
alias ffwin='hyprctl clients -j | jq '\''.[].pid'\'' | fzf --preview "hyprctl clients -j | jq '\''.[] | select(.pid == {}) | {class, title, workspace, xwayland}'\''"'
alias pff='find ${PASSWORD_STORE_DIR:=~/src/password-store/} -name "*.gpg" | sed -e "s@$PASSWORD_STORE_DIR/@@" -e '\''s/\.gpg$//'\'' | fzf | xargs pass show -c'
alias fzps='fzf --print0 | xargs -0I{}'
-alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s - %(title)s.%(ext)s"'
+alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s/%(title)s.%(ext)s"'
+alias ytplay='mpv "$(ytlink)"'
+
+# emacs aliases
+alias emacsd='emacs --daemon'
+alias emacsdbg='emacs --debug-init'
+alias e='emacsclient -c -a "emacs"'
# docker aliases
alias dcb='docker build'
@@ -300,7 +314,8 @@ alias dbsmu='rsync -aPz db:/media/basilisk/music/ /media/kilimanjaro/music'
# oh-my-zsh git aliases
alias config='GIT_WORK_TREE=~/src/dotfiles/ GIT_DIR=~/src/dotfiles/.git'
-alias gmod='git status --short | sed '\''/^\s*M/!d;s/^\s*M\s*//'\'' | fzf | xargs $EDITOR'
+alias cfg='vi ~/src/dotfiles/"$(config git ls-files | fzf || exit)"'
+alias gmod='git status --short | sed '\''/^\s*M/!d;s/^\s*M\s*//'\'' | fzf | xargs vi'
alias g='git'
alias ga='git add'
alias gaa='git add --all'
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/shell/functions.sh
index 4145813..b699a86 100644
--- a/config/essentials/zsh/functions.zsh
+++ b/config/essentials/shell/functions.sh
@@ -1,4 +1,4 @@
-#!/bin/zsh
+#!/bin/sh
log() { >&2 printf '%s' "$@"; }
logn() { >&2 printf '%s\n' "$@"; }
@@ -9,12 +9,12 @@ vmp() {
-c 'set ft=man nolist nonu nornu'
}
nvf() {
- local cache="$HOME/.cache/nvf"
- local match="$(grep -m1 "$1$" "$cache" 2> /dev/null)"
+ cache="$HOME/.cache/nvf"
+ match="$(grep -m1 "$1$" "$cache" 2> /dev/null)"
if test ! -f "$match"
then
logn "resetting cache..."
- match="$(goo | tee "$cache" | grep -m 1 "$1$" 2> /dev/null)"
+ match="$(goo f "$HOME" | tee "$cache" | grep -m 1 "$1$" 2> /dev/null)"
# # Alternative:
# match="$(goo | grep -m 1 "$1" 2> /dev/null | tee -a | "$cache")"
fi
@@ -26,8 +26,8 @@ nvf() {
fi
}
-nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit }
-ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit }
+nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit; }
+ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit; }
# googoo aliases
_googoo_fzf_opt()
@@ -62,7 +62,7 @@ vimh() { vi -c "help $1" -c 'call feedkeys("\<c-w>o")'; }
dgo() { cd "$(goo d ~ | fzf --filter "$@" | head -n 1)"; }
open() { $EDITOR "$(goo f ~ | fzf --filter "$@" | head -n 1)"; }
pkbs() { doas pacman -Sy "$(pkgfile -b "$1" | tee /dev/stderr)"; }
-oclip() { printf "\033]52;c;$(echo -n "$@" | base64)\a"; }
+oclip() { printf "\033]52;c;$(printf '%s' "$@" | base64)\a"; }
sms() { ssh -t phone sendmsg "$1" "'$2'"; }
trcp() { scp "$1" db:/media/basilisk/downloads/transmission/torrents/; }
rln() { ln -s "$(readlink -f "$1")" "$2"; }
@@ -70,7 +70,7 @@ getgit() { git clone git@db:"$1"; }
ipc()
{
- if [[ "$(ip link show eno1 | awk -F, 'NR=1 {print $3}')" == "UP" ]]
+ if [ "$(ip link show eno1 | awk -F, 'NR=1 {print $3}')" = "UP" ]
then
doas ip link set eno1 down
else
@@ -85,7 +85,6 @@ psgrep()
}
unique() {
- local f
f="$(mktemp)"
awk '!x[$0]++' "$1" > "$f"
mv "$f" "$1"
@@ -111,7 +110,7 @@ __git_files() {
}
esc() {
- $EDITOR "$(which $1)"
+ eval "$EDITOR '$(which $1)'"
}
delfile() {
@@ -152,16 +151,16 @@ ginit()
# Returns current branch
git_current_branch()
{
- command git rev-parse --git-dir &>/dev/null || return
+ command git rev-parse --git-dir > /dev/null 2>&1 || return
git branch --show-current
}
# Check if main exists and use instead of master
git_main_branch()
{
- command git rev-parse --git-dir &>/dev/null || return
- local ref
- for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}; do
+ command git rev-parse --git-dir > /dev/null 2>&1 || return
+ for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}
+ do
if command git show-ref -q --verify $ref; then
echo ${ref:t}
return
@@ -172,10 +171,11 @@ git_main_branch()
# Check for develop and similarly named branches
function git_develop_branch() {
- command git rev-parse --git-dir &>/dev/null || return
- local branch
- for branch in dev devel development; do
- if command git show-ref -q --verify refs/heads/$branch; then
+ command git rev-parse --git-dir > /dev/null 2>&1 || return
+ for branch in dev devel development
+ do
+ if command git show-ref -q --verify refs/heads/$branch
+ then
echo $branch
return
fi
@@ -186,11 +186,14 @@ function git_develop_branch() {
# gpg backup
gpg_backup()
{
- gpg --export-secret-keys --armor > private.asc
- gpg --export --armor > public.asc
- gpg --export-ownertrust --armor > trust.asc
- tar czf gpg_backup.tar.gz {public,private,trust}.asc
- shred -uz {public,private,trust}.asc
+ # $1: option
+ # $2: output file (without .asc)
+ gpg_command() { gpg "$1" --armor > "$2".asc; }
+ gpg_command --export-secret-keys "private"
+ gpg_command --export "public"
+ gpg_command --export-ownertrust "trust"
+ tar -czvf gpg_backup.tar.gz public.asc private.asc trust.asc
+ shred -uz public.asc private.asc trust.asc
}
gpg_import()
@@ -200,7 +203,7 @@ gpg_import()
gpg --import public.asc
gpg --import-ownertrust trust.asc
gpg --import private.asc
- shred -uz {public,private,trust}.asc
+ shred -uz public.asc private.asc trust.asc
}
ngenable()
@@ -242,17 +245,23 @@ pacsize()
mime-default ()
{
- logn "Setting '$1' as default for its mimetypes"
- grep "MimeType=" /usr/share/applications/"$1".desktop |
+ [ "${mime:=$1}" ] ||
+ mime="$(find /usr/share/applications/ -iname '*.desktop' -printf '%f\n' |
+ sed 's/\.desktop$//' |
+ fzf)"
+
+ logn "Setting '$mime' as default for its mimetypes"
+ [ "$mime" ] || exit 1
+ grep "MimeType=" /usr/share/applications/"$mime".desktop |
cut -d '=' -f 2- | tr ';' '\0' |
- xargs -0I{} xdg-mime default "$1".desktop "{}"
+ xargs -0I{} xdg-mime default "$mime".desktop "{}"
logn "Done."
}
addedkeys() {
find ~/.ssh -iname "*.pub" | while read key
do
- local fingerprint="$(ssh-keygen -lf "$key" 2>/dev/null)"
+ fingerprint="$(ssh-keygen -lf "$key" 2>/dev/null)"
if ssh-add -l | grep -q "$fingerprint"
then
echo "$key"
@@ -270,8 +279,6 @@ fpass() {
muttmail()
{
- local config
- local mail
config="$HOME/.config/mutt"
mail="$(find "$config"/configs -type f -printf '%f\n' | fzf)"
[ "$mail" ] || return 1
@@ -292,3 +299,8 @@ edit_in_dir() {
[ -f "$file" ] || return 1
$EDITOR "$file"
}
+
+to_webm()
+{
+ ffmpeg -y -i "$1" -vcodec libvpx -cpu-used -12 -deadline realtime "${1%.*}".webm
+}
diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc
index 76ff87f..90f4b14 100644
--- a/config/essentials/zsh/.zshrc
+++ b/config/essentials/zsh/.zshrc
@@ -15,24 +15,67 @@ autoload -U select-word-style
autoload -z edit-command-line
zle -N edit-command-line
zstyle ':compinstall' filename '/home/aluc/.zshrc'
+
+### Completion
+# cache
+zstyle ':completion:*' use-cache on
+zstyle ':completion:*' cache-path "$ZDOTDIR/zcompcache"
+
+# completers
+zstyle ':completion:*' completer _extensions _complete
+
+# format
+zstyle ':completion:*:*:*:*:descriptions' format '%F{blue}-- %D%d --%f'
+zstyle ':completion:*:*:*:*:messages' format '%F{purple}-- %d --%f'
+zstyle ':completion:*:*:*:*:warnings' format '%F{red}-- no matches found --%f'
+zstyle ':completion:*:default' list-prompt '%S%M matches%s'
+# show a 'ls -a' like outptut when listing files
+zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS}
+
+# Group completions by categories
+zstyle ':completion:*' group-name ''
+zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands
+
+zstyle ':completion:*' squeeze-slashes true
+
+# Prefer completing for an option (think cd -)
+zstyle ':completion:*' complete-options true
+
+# keep prefix when completing
+zstyle ':completion:*' keep-prefix true
+
+# ui
zstyle ':completion:*' menu select
-autoload -Uz compinit
+# Move around using h j k l in completion menu
+zmodload zsh/complist
+bindkey -M menuselect 'h' vi-backward-char
+bindkey -M menuselect 'k' vi-up-line-or-history
+bindkey -M menuselect 'j' vi-down-line-or-history
+bindkey -M menuselect 'l' vi-forward-char
+bindkey -M menuselect '^xg' clear-screen
+# interactive mode
+bindkey -M menuselect '^xi' vi-insert
+bindkey -M menuselect '^xh' accept-and-hold # Hold
+bindkey -M menuselect '^xn' accept-and-infer-next-history # Next
+bindkey -M menuselect '^xu' undo # Undo
+
+autoload -Uz compinit; compinit
+
autoload -Uz surround
zle -N delete-surround surround
zle -N add-surround surround
zle -N change-surround surround
-compinit
# Source files
-. $ZDOTDIR/functions.zsh
-. $ZDOTDIR/aliases.sh
+. $XDG_CONFIG_HOME/shell/functions.sh
+. $XDG_CONFIG_HOME/shell/aliases.sh
for file in /{etc,usr/lib}/os-release
do [ -f "$file" ] && . "$file" && break
done
case "${ID:=unknown}" in
debian|ubuntu) PLUGPATH=/usr/share/ ;;
- unknown) PLUGPATH=$HOME/.config/zsh/plugins ;;
+ unknown) PLUGPATH=$ZDOTDIR/plugins ;;
*) PLUGPATH=/usr/share/zsh/plugins ;;
esac
. $PLUGPATH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
@@ -102,15 +145,16 @@ function osc7 {
add-zsh-hook -Uz chpwd osc7
command_not_found_handler () {
if [[ -o interactive ]] && isTextFile "$1"
- then
- "$EDITOR" "$1"
- else
- echo "zsh: command not found: $1" >&2
+ then "$EDITOR" "$1"
+ else echo "zsh: command not found: $1" >&2
fi
}
+# automatic ls after cd
+add-zsh-hook -Uz chpwd (){[ "$PWD" != "$HOME" ] && ls -a; }
+
# prompt
-PS1=' %B%(#.%F{1}.%F{13})[%n%b%f@%B%F{6}%m]%b%f %3~ '
+PS1=' %K{16}%B%(#.%F{1}.%F{13})%n%b%f@%B%F{6}%m%b%f %3~%k '
RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)'
setopt prompt_subst