1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00

Replace zsh with fish

This commit is contained in:
Ryan Kes 2020-02-17 14:13:34 +01:00
parent 9e1bf10151
commit 61fd643c08
13 changed files with 243 additions and 262 deletions

View File

@ -8,14 +8,14 @@
- [[#maintainers][Maintainers]] - [[#maintainers][Maintainers]]
- [[#prerequisites][Prerequisites]] - [[#prerequisites][Prerequisites]]
- [[#configured-applications][Configured Applications]] - [[#configured-applications][Configured Applications]]
- [[#zsh][Zsh]] - [[#fish][Fish]]
- [[#theme][Theme]] - [[#theme][Theme]]
- [[#plugin-manager][Plugin Manager]] - [[#package-manager][Package Manager]]
- [[#plugins][Plugins]] - [[#packages][Packages]]
- [[#neovim][Neovim]] - [[#neovim][Neovim]]
- [[#theme-1][Theme]] - [[#theme-1][Theme]]
- [[#plugin-manager-1][Plugin Manager]] - [[#plugin-manager][Plugin Manager]]
- [[#plugins-1][Plugins]] - [[#plugins][Plugins]]
- [[#general][General]] - [[#general][General]]
- [[#programming][Programming]] - [[#programming][Programming]]
- [[#ui][UI]] - [[#ui][UI]]
@ -31,17 +31,25 @@ A repository of my personal configuration files.
+ [[https://github.com/alrayyes][@alrayyes]] + [[https://github.com/alrayyes][@alrayyes]]
* Prerequisites * Prerequisites
- [[https://brave.com/][brave]]
- [[https://github.com/baskerville/bspwm][bspwm]]
- [[https://the.exa.website/][exa]]
- [[https://github.com/junegunn/fzf][fzf]]
- [[https://git-scm.com/][git]]
- [[http://www.gnu.org/software/stow/][stow]] - [[http://www.gnu.org/software/stow/][stow]]
- [[https://www.python.org/][Python]] - [[https://www.python.org/][Python]]
- [[https://fishshell.com/][fish]]
- [[https://github.com/baskerville/sxhkd][sxhkd]]
- [[https://github.com/freedesktop/xcompmgr][xcompmgr]]
- [[https://github.com/stoeckmann/xwallpaper][xwallpaper]]
* Configured Applications * Configured Applications
- [[https://github.com/alacritty/][alacritty]] - [[https://github.com/alacritty/][alacritty]]
- [[https://brave.com/][brave]]
- [[https://github.com/baskerville/bspwm][bspwm]] - [[https://github.com/baskerville/bspwm][bspwm]]
- [[https://github.com/hlissner/doom-emacs][Doom Emacs]] - [[https://github.com/hlissner/doom-emacs][Doom Emacs]]
- [[https://dunst-project.org/][dunst]] - [[https://dunst-project.org/][dunst]]
- [[https://the.exa.website/][exa]]
- [[https://firejail.wordpress.com/][firejail]] - [[https://firejail.wordpress.com/][firejail]]
- [[https://fishshell.com/][fish]]
- [[https://git-scm.com/][git]] - [[https://git-scm.com/][git]]
- [[https://gnupg.org/][gnupg]] - [[https://gnupg.org/][gnupg]]
- [[https://www.gtk.org/][gtk]] - [[https://www.gtk.org/][gtk]]
@ -54,32 +62,20 @@ A repository of my personal configuration files.
- [[https://tmux.github.io/][tmux]] - [[https://tmux.github.io/][tmux]]
- [[https://vifm.info/][vifm]] - [[https://vifm.info/][vifm]]
- [[https://weechat.org/][weechat]] - [[https://weechat.org/][weechat]]
- [[https://github.com/freedesktop/xcompmgr][xcompmgr]]
- [[https://github.com/stoeckmann/xwallpaper][xwallpaper]]
* Zsh * Fish
** Theme *** Theme
- [[https://github.com/denysdovhan/spaceship-prompt][spaceship zsh]] - [[https://github.com/oh-my-fish/theme-bobthefish][bobthefish]]
** Plugin Manager *** Package Manager
- [[https://github.com/zplug/zplug][zplug]] - [[https://github.com/oh-my-fish/oh-my-fish][oh-my-fish]]
** Plugins *** Packages
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/archlinux][archlinux]] - [[https://github.com/patrickf3139/Colored-Man-Pages][colored-man-pages]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/composer][composer]] - [[https://github.com/oh-my-fish/plugin-extract][extract]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker][docker]] - [[https://github.com/jethrokuan/fzf][fzf]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker-compose][docker-compose]] - [[https://github.com/oh-my-fish/plugin-gi][gi]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/extract][extract]] - [[https://github.com/oh-my-fish/plugin-git-flow][git-flow]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/fzf][fzf]] - [[https://github.com/oh-my-fish/plugin-sudope.git][sudope]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git][git]] - [[https://github.com/oh-my-fish/plugin-wttr][wttr]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitignore][gitignore]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/pass][pass]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ripgrep][ripgrep]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/rsync][rsync]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo][sudo]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/systemd][systemd]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/tmux][tmux]]
- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/vi-mode][vi-mode]]
- [[https://github.com/zsh-users/zsh-autosuggestions][zsh-autosuggestions]]
- [[https://github.com/zsh-users/zsh-syntax-highlighting][zsh-syntax-highlighting]]
* Neovim * Neovim
** Theme ** Theme

View File

@ -320,7 +320,7 @@ background_opacity: 0.8
#semantic_escape_chars: ",`|:\"' ()[]{}<>\t" #semantic_escape_chars: ",`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard. # When set to `true`, selected text will be copied to the primary clipboard.
#save_to_clipboard: false save_to_clipboard: true
# Allow terminal applications to change Alacritty's window title. # Allow terminal applications to change Alacritty's window title.
#dynamic_title: true #dynamic_title: true

View File

@ -1,38 +1,37 @@
#! /bin/sh #!/usr/bin/env fish
sxhkd & sxhkd &
# Set screen orientation if second monitor is connected # Set screen orientation if second monitor is connected
SCREENCOUNT=$(xrandr | grep -c "\*") set SCREENCOUNT (xrandr | grep -c "\*")
# If multi screen add special mode for monitor so it supports 1440p over HDMI # If multi screen add special mode for monitor so it supports 1440p over HDMI
if [ "$SCREENCOUNT" -eq 2 ]; then if [ "$SCREENCOUNT" -eq 2 ]
bspc monitor DP-1 -d 2 3 4 5 6 7 8 9 10 bspc monitor DP-1 -d 2 3 4 5 6 7 8 9 10
bspc monitor HDMI-2 -d 1 bspc monitor HDMI-2 -d 1
if [ -f "$HOME/.local/bin/screen_desktop" ]; then if [ -f "$HOME/.local/bin/screen_desktop" ]
screen_desktop screen_desktop
fi end
if [ -f "$HOME/.local/bin/polybar-desktop" ]; then if [ -f "$HOME/.local/bin/polybar-desktop" ]
polybar-desktop polybar-desktop
fi end
else else
bspc monitor -d 1 2 3 4 5 6 7 8 9 0 bspc monitor -d 1 2 3 4 5 6 7 8 9 0
if [ -f "$HOME/.local/bin/screen" ]; then if [ -f "$HOME/.local/bin/screen" ]
screen screen
fi end
if [ -f "$HOME/.local/bin/polybar-laptop" ]; then if [ -f "$HOME/.local/bin/polybar-laptop" ]
polybar laptop-top & polybar-laptop
polybar laptop-bottom & end
fi end
fi
xcompmgr & xcompmgr &
if [ -e ~/.cache/wall1.png ] && [ -e ~/.cache/wall2.png ]; then if [ -e ~/.cache/wall1.png ] && [ -e ~/.cache/wall2.png ]
xwallpaper --output HDMI-2 --zoom ~/.cache/wall2.png --output DP-1 --zoom ~/.cache/wall1.png & xwallpaper --output HDMI-2 --zoom ~/.cache/wall2.png --output DP-1 --zoom ~/.cache/wall1.png &
elif [ -e ~/.cache/wall1.png ]; then else if [ -e ~/.cache/wall1.png ]
xwallpaper --output eDP1 --zoom ~/.cache/wall1.png & xwallpaper --output eDP1 --zoom ~/.cache/wall1.png &
fi end
# switch off microphones # switch off microphones
amixer -c 2 set Mic nocap amixer -c 2 set Mic nocap
@ -52,15 +51,15 @@ alacritty --class Spt,Spt -e spt &
xss-lock -n ~/.local/bin/lock -- ~/.local/bin/lock & xss-lock -n ~/.local/bin/lock -- ~/.local/bin/lock &
xautolock -time 10 -locker ~/.local/bin/lock & xautolock -time 10 -locker ~/.local/bin/lock &
if [ -e /usr/bin/brave ]; then if [ -e /usr/bin/brave ]
brave & brave &
else else
if [ -e /usr/bin/firefox ]; then if [ -e /usr/bin/firefox ]
firefox & firefox &
elif [ -e /usr/bin/iceweasel ]; then else if [ -e /usr/bin/iceweasel ]
iceweasel & iceweasel &
fi end
fi end
bspc config border_width 2 bspc config border_width 2
bspc config window_gap 12 bspc config window_gap 12

View File

@ -1,14 +1,4 @@
setxkbmap -option caps:escape setxkbmap -option caps:escape
xrdb -merge -I$HOME ~/.Xresources
[[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources
# Enable numberlock
if [ -x /usr/bin/numlockx ]; then
/usr/bin/numlockx on
fi
export _JAVA_AWT_WM_NONREPARENTING=1
export AWT_TOOLKIT=MToolkit
wmname LG3D
exec bspwm exec bspwm

107
fish/.config/omf/init.fish Normal file
View File

@ -0,0 +1,107 @@
# Start X at login
if status is-login
if test -z "$DISPLAY" -a $XDG_VTNR = 1
set -g -x SXHKD_SHELL '/usr/bin/sh'
# Enable numberlock
if [ -x "/usr/bin/numlockx" ]
/usr/bin/numlockx on
end
exec startx -- -keeptty
end
end
function fish_greeting
neofetch
end
function path_if_exists
if [ -d "$argv" ]
set PATH $PATH "$argv"
end
end
# Add paths
path_if_exists ~/.config/yarn/global/node_modules/.bin
path_if_exists ~/.local/bin
path_if_exists ~/.emacs.d/bin
# Set GPG TTY
set GPG_TTY (tty)
# Set default browser
if [ -e "/usr/bin/brave" ]
set -g BROWSER "brave"
else
if [ -e "/usr/bin/firefox" ]
set -g BROWSER "firefox"
else if [ -e "/usr/bin/iceweasel" ]
set -g BROWSER "iceweasel"
end
end
# Set default terminal
set -g TERMINAL "alacritty"
# pkg editor
set -g VISUAL "nvim"
# editor
set -g EDITOR "nvim"
# Enable password store extensions
set -g PASSWORD_STORE_ENABLE_EXTENSIONS "true"
# Use alternative muhome
set -g MU_HOME "/home/alrayyes/.cache/mu"
# bobthefish
set -g theme_nerd_fonts yes
set -g theme_color_scheme gruvbox
# sudope
set -g sudope_sequence \e\e
# nvim alias
alias v="nvim"
alias sv="sudo nvim"
# ls alias
alias ls="exa"
alias l="exa -al"
# vifm alias
alias vifm="vifmrun"
# pacman aliases
alias pacrmorphans="sudo pacman -Rs (pacman -Qtdq)"
alias pacrem="sudo pacman -Rns"
alias gpoat="git push origin --all && git push origin --tags"
# Refresh gpg-agent tty in case user switches into an X session
gpg-connect-agent updatestartuptty /bye >/dev/null
# Set fzf keybindings here for now as they don't work with stable version of omf https://github.com/jethrokuan/fzf/issues/109
bind \co '__fzf_find_file'
bind \cr '__fzf_reverse_isearch'
bind \ec '__fzf_cd'
bind \eC '__fzf_cd --hidden'
bind \eO '__fzf_open'
bind \eo '__fzf_open --editor'
if bind -M insert >/dev/null 2>/dev/null
bind -M insert \co '__fzf_find_file'
bind -M insert \cr '__fzf_reverse_isearch'
bind -M insert \ec '__fzf_cd'
bind -M insert \eC '__fzf_cd --hidden'
bind -M insert \eO '__fzf_open'
bind -M insert \eo '__fzf_open --editor'
end
if set -q FZF_COMPLETE
bind \t '__fzf_complete'
if bind -M insert >/dev/null 2>/dev/null
bind -M insert \t '__fzf_complete'
end
end

100
install
View File

@ -1,52 +1,78 @@
#!/usr/bin/env sh #!/usr/bin/env fish
# We need the environment to be able to symlink files accordingly function mkdir_if_not_exist
case "$1" in if [ ! -d "$argv" ]
desktop) echo "Creating directory $argv"
EXTENSION="desktop" mkdir -p "$argv"
;; end
thinkpad) end
EXTENSION="thinkpad"
;;
esac
# Create nvim config directory if it doesn't exist function install_omf_package_if_not_exist
if [ ! -d ~/.config/nvim ]; then if test (omf list | grep -c "$argv") -eq 0
echo "Creating ~/.config/nvim" omf install "$argv"
mkdir -p ~/.config/nvim end
fi end
for d in $(find -- */ -maxdepth 0 -type d | cut -f1 -d '/'); do # Create directories that need to exist
echo "Linking $d..." mkdir_if_not_exist ~/.cache/mpd
(stow -t "$HOME" "$d") mkdir_if_not_exist ~/.config/alacritty
done mkdir_if_not_exist ~/.config/nvim
mkdir_if_not_exist ~/.config/fish
mkdir_if_not_exist ~/.config/omf
mkdir_if_not_exist ~/.config/mpd
mkdir_if_not_exist ~/.weechat
for d in (find -- */ -maxdepth 0 -type d | cut -f1 -d '/')
echo "Linking $d..."
stow -t "$HOME" "$d"
end
# Refresh xgd # Refresh xgd
update-desktop-database ~/.local/share/applications/ if test (grep -c 'x-scheme-handler/org-protocol=org-protocol.desktop' ~/.config/mimeapps.list) -eq 0
xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol echo "Refreshing xgd to handle org-protocol"
update-desktop-database ~/.local/share/applications/
xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol
end
# Install zplug if it doesn't exist yet # Install oh-my-fish if it isn't installed
if [ ! -d ~/.zplug ]; then if [ ! -d ~/.local/share/omf ]
echo "Installing zplug" curl -L https://get.oh-my.fish | fish
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh end
fi
# Install oh-my-fish plugins
install_omf_package_if_not_exist bobthefish
install_omf_package_if_not_exist colored-man-pages
install_omf_package_if_not_exist extract
install_omf_package_if_not_exist fzf
install_omf_package_if_not_exist gi
install_omf_package_if_not_exist git-flow
install_omf_package_if_not_exist sudope
install_omf_package_if_not_exist wttr
# Install vim plugins & requirements # Install vim plugins & requirements
if [ ! "$(pip list --user | grep 'pynvim' | wc -l)" -ge 1 ]; then if test (pip list --user | grep -c 'pynvim') -ne 1
pip install --user pynvim pip install --user pynvim
fi end
# Install plug package manager if it doesn't exist # Install plug package manager if it doesn't exist
if [ ! -d ~/.config/nvim/plugged ]; then if [ ! -d ~/.config/nvim/plugged ]
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi end
# Install Neovim plugins # Install Neovim plugins
nvim +PlugInstall +qall nvim +PlugInstall +qall
# Setup broot if not done already
if [ ! -d ~/.local/share/broot ]
broot --install
end
# Update fish completions (auto generated from man pages)
fish_update_completions
# Notify user to manually symlink files # Notify user to manually symlink files
if [ ! -z "$EXTENSION" ]; then if [ -n "$argv[1]" ]
echo "\n\nDon't forget to symlink these files:\n\n" printf "\n\nDon't forget to symlink these files:\n\n"
find ~ \( -type l -o -type f \) -name "*.$EXTENSION" -exec ls -al {} \; find ~ \( -type l -o -type f \) -name "*.$argv[1]" -exec ls -al {} \;
fi end

View File

@ -1,10 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env fish
# Terminate already running bar instances # Terminate already running bar instances
killall -q polybar killall -q polybar
# Wait until the processes have been shut down # Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done while pgrep -u $UID -x polybar >/dev/null
sleep 1
end
# Launch bar1 and bar2 # Launch bar1 and bar2
polybar monitor1 & polybar monitor1 &

View File

@ -1,10 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env fish
# Terminate already running bar instances # Terminate already running bar instances
killall -q polybar killall -q polybar
# Wait until the processes have been shut down # Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done while pgrep -u $UID -x polybar >/dev/null
sleep 1
end
# Launch bar1 and bar2 # Launch bar1 and bar2
polybar laptop-top & polybar laptop-top &

View File

@ -64,7 +64,7 @@ shift + XF86Eject
# terminal emulator # terminal emulator
super + Return super + Return
$TERMINAL alacritty
# program launcher # program launcher
super + @space super + @space

View File

@ -12,7 +12,7 @@ set -g @themepack 'powerline/double/magenta'
set -g @resurrect-strategy-nvim 'session' set -g @resurrect-strategy-nvim 'session'
# Set zsh as default command so profile etc is properly loaded # Set zsh as default command so profile etc is properly loaded
set-option -g default-command zsh set-option -g default-command fish
# Other examples: # Other examples:
# set -g @plugin 'github_username/plugin_name' # set -g @plugin 'github_username/plugin_name'

View File

@ -1,3 +0,0 @@
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx
fi

View File

@ -1,57 +0,0 @@
path_if_exists() {
if [[ -d $1 ]]; then
export PATH="$1:$PATH"
fi
}
# Stop tmux bitching about 256 colours
TERM="xterm-256color"
# PATH
path_if_exists ~/.config/yarn/global/node_modules/.bin
path_if_exists ~/.local/bin
path_if_exists ~/.emacs.d/bin
# Set GPG TTY
export GPG_TTY="$(tty)"
# Set default browser
if [ -e "/usr/bin/brave" ]; then
export BROWSER="brave"
else
if [ -e "/usr/bin/firefox" ]; then
export BROWSER="firefox"
elif [ -e "/usr/bin/iceweasel" ]; then
export BROWSER="iceweasel"
fi
fi
# Set default terminal
export TERMINAL="alacritty"
# pkg editor
export VISUAL="nvim"
# editor
export EDITOR="nvim"
# Enable password store extensions
export PASSWORD_STORE_ENABLE_EXTENSIONS="true"
# This needs to be set for bspwm to see config
export XDG_CONFIG_HOME="$HOME/.config"
# Save history file in proper place
HISTFILE=~/.cache/zsh/history
# Use alternative muhome
export MU_HOME="/home/alrayyes/.cache/mu"
# Needed to get zsh to play nice with emacs vterm
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
alias clear='printf "\e]51;Evterm-clear-scrollback\e\\";tput clear'
fi
vterm_prompt_end() {
printf "\e]51;A$(whoami)@$(hostname):$(pwd)\e\\"
}
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'

View File

@ -1,81 +0,0 @@
source_if_exists() {
if [[ -f $1 ]]; then
source $1
fi
}
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
git clone https://github.com/b4b4r07/zplug ~/.zplug
fi
source ~/.zplug/init.zsh
# Spaceship theme
zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
# Oh my zsh lugins
# sudo must start after vi-mode for it to work properly
zplug "plugins/archlinux", from:oh-my-zsh
zplug "plugins/composer", from:oh-my-zsh
zplug "plugins/docker", from:oh-my-zsh
zplug "plugins/docker-compose", from:oh-my-zsh
zplug "plugins/extract", from:oh-my-zsh
zplug "plugins/fzf", from:oh-my-zsh
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/gitignore", from:oh-my-zsh
zplug "plugins/pass", from:oh-my-zsh
zplug "plugins/ripgrep", from:oh-my-zsh
zplug "plugins/rsync", from:oh-my-zsh
zplug "plugins/systemd", from:oh-my-zsh
zplug "plugins/tmux", from:oh-my-zsh
zplug "plugins/vi-mode", from:oh-my-zsh
zplug "plugins/sudo", from:oh-my-zsh
zplug "plugins/yarn", from:oh-my-zsh
zplug "zsh-users/zsh-autosuggestions", from:github, defer:3
zplug "zsh-users/zsh-syntax-highlighting", from:github, defer:3
# Install packages
if ! zplug check --verbose; then
printf "Install zplug plugins? [y/N]: "
if read -q; then
echo
zplug install
fi
fi
zplug load
# vim alias
alias v="nvim"
alias sv="sudo nvim"
# ls alias
alias ls="exa"
alias l="exa -al"
# vifm alias
alias vifm="vifmrun"
# Use lf to switch directories and bind it to ctrl-o
lfcd() {
tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
bindkey -s '^o' 'lfcd\n'
# Set GPG TTY
export GPG_TTY="$(tty)"
# Refresh gpg-agent tty in case user switches into an X session
gpg-connect-agent updatestartuptty /bye >/dev/null
# Needed for broot
source /home/alrayyes/.config/broot/launcher/bash/br
neofetch