aboutsummaryrefslogtreecommitdiff
path: root/config/zsh
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-02-25 15:17:37 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-02-25 15:26:09 +0100
commitd59a26f882017a62b4119a7649ca3d4b43f65725 (patch)
tree3ec808804ef398651a9bcc9a021f16c5d30b7b88 /config/zsh
parentbb72eb10b6c7148ad3107c50a4232dea080d1468 (diff)
downloaddotfiles-d59a26f882017a62b4119a7649ca3d4b43f65725.tar.gz
dotfiles-d59a26f882017a62b4119a7649ca3d4b43f65725.tar.bz2
dotfiles-d59a26f882017a62b4119a7649ca3d4b43f65725.zip
Added vint and flake8 to lint vim and qutebrowser conf, Added shellcheck to zsh files, Fixing all linting errors
Diffstat (limited to 'config/zsh')
-rw-r--r--config/zsh/.zshrc31
-rw-r--r--config/zsh/aliases.zsh12
-rwxr-xr-xconfig/zsh/zprofile21
3 files changed, 28 insertions, 36 deletions
diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc
index 372b828..0c69f31 100644
--- a/config/zsh/.zshrc
+++ b/config/zsh/.zshrc
@@ -1,24 +1,22 @@
-###############
-# zshrc #
-###############
-
+#!/bin/zsh
# load aliases
-source $XDG_CONFIG_HOME/zsh/aliases.zsh
+# shellcheck source=/dev/null
+. "$XDG_CONFIG_HOME/zsh/aliases.zsh"
# prompt
-case `tty` in
+case $(tty) in
/dev/tty[1-9])
# %~ path ('~' if $HOME)
# %B/%b start/stop bold
# %B/%b start/stop color
- NEWLINE=$'\n'
+ NEWLINE=$(printf '\n')
export PROMPT="${NEWLINE}%B%F{blue}%~%f${NEWLINE}%F{red}> %f%b"
;;
*)
# pure prompt
export FPATH="$FPATH:$XDG_DATA_HOME/zsh/pure"
- ZSH_THEME="pure"
+ export ZSH_THEME='pure'
autoload -U promptinit
promptinit
prompt pure
@@ -53,26 +51,25 @@ setopt list_rows_first # cycle through row first in menu
# setopt extendedglob
# executed when changing directory
-function chpwd() {
- content=$(ls | wc -l)
+chpwd() {
+ content="$(find . -maxdepth 1 | wc -l)"
([ "$content" -lt 20 ] && ls -l) ||
echo "$(pwd) contains $content entries"
[ "$(stat -c "%U" .)" = "$USER" ] && touch . # to sort by last cd
}
-# add command-not-found package suggestion
-#source /etc/zsh_command_not_found
-
-
+# shellcheck disable=SC2034,SC2039
fignore=(o hi) # ignore extensions in autocomplete
# pluggins
-source $XDG_DATA_HOME/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # prompt syntax highlight
+# shellcheck source=/dev/null
+. "$XDG_DATA_HOME/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" # prompt syntax highlight
export YSU_MESSAGE_POSITION="after" # you-should-use message after command output
-source $XDG_DATA_HOME/zsh/zsh-you-should-use/you-should-use.plugin.zsh # alias reminder
+. "$XDG_DATA_HOME/zsh/zsh-you-should-use/you-should-use.plugin.zsh" # alias reminder
# set tab to 4 spaces
tabs 4
-export GPG_TTY=$(tty) # fixing gpg fatal error about tty
+GPG_TTY=$(tty) # fixing gpg fatal error about tty
+export GPG_TTY
diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh
index 3d2cfa1..ff036f2 100644
--- a/config/zsh/aliases.zsh
+++ b/config/zsh/aliases.zsh
@@ -1,6 +1,4 @@
-###############
-# zsh aliases #
-###############
+#!/bin/zsh
# color
alias grep='grep --color=auto'
@@ -113,7 +111,7 @@ alias cagor='RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo run'
# wifi
wificonnect() {
- nmcli device wifi connect $1 password $2
+ nmcli device wifi connect "$1" password "$2"
}
# alias mutt='neomutt'
@@ -126,12 +124,8 @@ alias qmvdest='qmv --format=do'
alias xclip='xclip -selection clipboard'
-pacman-url() {
+pacman_url() {
pacman -Si "$1" | grep URL | tr -s ' ' | cut -d ' ' -f 3
}
-grep-kill() {
- ps aux | grep "$1" | tr -s ' ' | cut -d ' ' -f 2 | xargs kill
-}
-
alias filter-valgrind="sed -e 's/==[0-9]*==/==/' -e 's/0x[0-9A-F]*//'"
diff --git a/config/zsh/zprofile b/config/zsh/zprofile
index 1713b9e..68a9b48 100755
--- a/config/zsh/zprofile
+++ b/config/zsh/zprofile
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/zsh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:$HOME/.local/bin"
@@ -20,6 +20,7 @@ export XMONAD_DATA_HOME="$XDG_DATA_HOME"
export XMONAD_CACHE_HOME="$XDG_CACHE_HOME"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
+# shellcheck disable=SC2016
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter"
@@ -33,14 +34,15 @@ export LESSHISTFILE='-' # no ~/.lesshst
# runtime
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
+# shellcheck disable=SC2155
# color in man (less pager)
-export LESS_TERMCAP_mb=$'\e[1;32m'
-export LESS_TERMCAP_md=$'\e[1;32m'
-export LESS_TERMCAP_me=$'\e[0m'
-export LESS_TERMCAP_se=$'\e[0m'
-export LESS_TERMCAP_so=$'\e[01;33m'
-export LESS_TERMCAP_ue=$'\e[0m'
-export LESS_TERMCAP_us=$'\e[1;4;31m'
+export LESS_TERMCAP_mb=$(printf '%b' '\e[1;32m')
+export LESS_TERMCAP_md=$(printf '%b' '\e[1;32m')
+export LESS_TERMCAP_me=$(printf '%b' '\e[0m')
+export LESS_TERMCAP_se=$(printf '%b' '\e[0m')
+export LESS_TERMCAP_so=$(printf '%b' '\e[01;33m')
+export LESS_TERMCAP_ue=$(printf '%b' '\e[0m')
+export LESS_TERMCAP_us=$(printf '%b' '\e[1;4;31m')
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
export LESS_TERMCAP_ZN=$(tput ssubm)
@@ -48,7 +50,6 @@ export LESS_TERMCAP_ZV=$(tput rsubm)
export LESS_TERMCAP_ZO=$(tput ssupm)
export LESS_TERMCAP_ZW=$(tput rsupm)
-
export MINIKUBE_IN_STYLE=false # disable cringe minikube emojies
# school env
@@ -57,4 +58,4 @@ export MINISHELL_TEST_PAGER=vim
export MINISHELL_TEST_FLAGS=-DMINISHELL_TEST
export WEBSERV_FLAGS=-DWEBSERV_CACHARLE
-[ "$(tty)" = '/dev/tty1' ] && exec startx
+[ "$(tty)" = '/dev/tty1' ] && HOME="$XDG_CONFIG_HOME/x11" exec startx