mirror of
https://github.com/GRFreire/dotfiles.git
synced 2026-01-09 04:09:38 +00:00
add support for debain
Debian packages bat (ls replacement) as `batcat`, while other distros, like archlinux, does not. This commits selects which binary to use depending if the current distro is debian. Also, debian's package for fzf places the zsh completitions file in other directory of what arch linux does, this commit also fixes this.
This commit is contained in:
parent
0bd7b0fd34
commit
6447059b01
@ -31,7 +31,11 @@ export ZSH_PLUGINS_ALIAS_TIPS_EXCLUDES="_"
|
||||
|
||||
# Fzf keybinds
|
||||
# <CTRL+R> search history of shell commands
|
||||
source /usr/share/fzf/key-bindings.zsh
|
||||
if [ $OS_RELEASE = "debian" ]; then
|
||||
source /usr/share/doc/fzf/examples/key-bindings.zsh
|
||||
else
|
||||
source /usr/share/fzf/key-bindings.zsh
|
||||
fi
|
||||
|
||||
# Alias config to manage dotfiles with git
|
||||
alias config="git --git-dir=\$HOME/.dotfiles/ --work-tree=\$HOME"
|
||||
@ -49,7 +53,7 @@ fzf_fast_file_edit() {
|
||||
config_files="$(config ls-tree -r "$current_branch" --name-only "$HOME")"
|
||||
|
||||
# Select file
|
||||
selected_file=$(printf "%s\n%s" "$scripts" "$config_files" | fzf --info=inline --prompt='Select a file: ' --preview='bat --paging=never --style=plain --color=always {}')
|
||||
selected_file=$(printf "%s\n%s" "$scripts" "$config_files" | fzf --info=inline --prompt='Select a file: ' --preview="$bat_cmd --paging=never --style=plain --color=always {}")
|
||||
|
||||
|
||||
if [ -n "$selected_file" ]; then
|
||||
@ -63,14 +67,15 @@ alias python="python3"
|
||||
alias pip="pip3"
|
||||
|
||||
# Alias to bat instead of cat
|
||||
alias cat="bat --paging=never --style=header,grid"
|
||||
[ $OS_RELEASE = "debian" ] && bat_cmd="batcat" || bat_cmd="bat"
|
||||
alias cat="$bat_cmd --paging=never --style=header,grid"
|
||||
|
||||
# Alias to exa instead of ls
|
||||
alias ls="exa --color=always --icons --group-directories-first"
|
||||
alias tree="ls --tree"
|
||||
|
||||
# Alias to bat instead of less
|
||||
alias less="bat -p --paging=always"
|
||||
alias less="$bat_cmd -p --paging=always"
|
||||
|
||||
# Alias to nvim instead of vim
|
||||
alias vim="nvim"
|
||||
|
||||
6
.profile
6
.profile
@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
export OS_RELEASE="$(cat /etc/os-release | grep '^ID=' | sed 's|ID=||')"
|
||||
|
||||
### SET PATHS ###
|
||||
|
||||
# XDG Defaults
|
||||
@ -25,9 +27,11 @@ export ZDOTDIR="$HOME"/.config/zsh
|
||||
eval `ssh-agent -s` > /dev/null
|
||||
|
||||
### Default programs ###
|
||||
[ $OS_RELEASE = "debian" ] && bat_cmd="batcat" || bat_cmd="bat"
|
||||
|
||||
export EDITOR="nvim"
|
||||
export READER="zathura"
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man --paging always -p'"
|
||||
export MANPAGER="sh -c \"col -bx | $bat_cmd -l man --paging always -p\""
|
||||
export TERMINAL="alacritty"
|
||||
export BROWSER="firefox"
|
||||
export VIDEO="mpv"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user