Updated
This commit is contained in:
parent
919578a973
commit
8ad17b026f
4 changed files with 182 additions and 47 deletions
70
.bashrc
70
.bashrc
|
@ -8,7 +8,8 @@
|
||||||
### EXPORT
|
### EXPORT
|
||||||
export TERM="xterm-256color" # getting proper colors
|
export TERM="xterm-256color" # getting proper colors
|
||||||
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
|
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
|
||||||
export EDITOR="nvim" # $EDITOR use neovim
|
export EDITOR="emacsclient -t -a ''" # $EDITOR use Emacs in terminal
|
||||||
|
export VISUAL="emacsclient -c -a emacs" # $VISUAL use Emacs in GUI mode
|
||||||
|
|
||||||
### SET MANPAGER
|
### SET MANPAGER
|
||||||
### "bat" as manpager
|
### "bat" as manpager
|
||||||
|
@ -58,6 +59,53 @@ shopt -s checkwinsize # checks term size when bash regains control
|
||||||
#ignore upper and lowercase when TAB completion
|
#ignore upper and lowercase when TAB completion
|
||||||
bind "set completion-ignore-case on"
|
bind "set completion-ignore-case on"
|
||||||
|
|
||||||
|
### ARCHIVE EXTRACTION
|
||||||
|
# usage: ex <file>
|
||||||
|
ex ()
|
||||||
|
{
|
||||||
|
if [ -f "$1" ] ; then
|
||||||
|
case $1 in
|
||||||
|
*.tar.bz2) tar xjf $1 ;;
|
||||||
|
*.tar.gz) tar xzf $1 ;;
|
||||||
|
*.bz2) bunzip2 $1 ;;
|
||||||
|
*.rar) unrar x $1 ;;
|
||||||
|
*.gz) gunzip $1 ;;
|
||||||
|
*.tar) tar xf $1 ;;
|
||||||
|
*.tbz2) tar xjf $1 ;;
|
||||||
|
*.tgz) tar xzf $1 ;;
|
||||||
|
*.zip) unzip $1 ;;
|
||||||
|
*.Z) uncompress $1;;
|
||||||
|
*.7z) 7z x $1 ;;
|
||||||
|
*.deb) ar x $1 ;;
|
||||||
|
*.tar.xz) tar xf $1 ;;
|
||||||
|
*.tar.zst) unzstd $1 ;;
|
||||||
|
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "'$1' is not a valid file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# navigation
|
||||||
|
up () {
|
||||||
|
local d=""
|
||||||
|
local limit="$1"
|
||||||
|
|
||||||
|
# Default to limit of 1
|
||||||
|
if [ -z "$limit" ] || [ "$limit" -le 0 ]; then
|
||||||
|
limit=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for ((i=1;i<=limit;i++)); do
|
||||||
|
d="../$d"
|
||||||
|
done
|
||||||
|
|
||||||
|
# perform cd. Show error if cd fails
|
||||||
|
if ! cd "$d"; then
|
||||||
|
echo "Couldn't go up $limit dirs.";
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
### ALIASES
|
### ALIASES
|
||||||
# navigation
|
# navigation
|
||||||
alias ..='cd ..'
|
alias ..='cd ..'
|
||||||
|
@ -69,8 +117,14 @@ alias .5='cd ../../../../..'
|
||||||
# bat as cat
|
# bat as cat
|
||||||
alias cat='bat'
|
alias cat='bat'
|
||||||
|
|
||||||
# neovim as vim
|
# editors
|
||||||
alias vim='nvim'
|
alias vim='nvim'
|
||||||
|
alias em="/usr/bin/emacs -nw"
|
||||||
|
alias emacs="emacsclient -c -a 'emacs'"
|
||||||
|
alias doomsync="~/.emacs.d/bin/doom sync"
|
||||||
|
alias doomdoctor="~/.emacs.d/bin/doom doctor"
|
||||||
|
alias doomupgrade="~/.emacs.d/bin/doom upgrade"
|
||||||
|
alias doompurge="~/.emacs.d/bin/doom purge"
|
||||||
|
|
||||||
# Changing "ls" to "exa"
|
# Changing "ls" to "exa"
|
||||||
alias ls='exa -al --color=always --group-directories-first' # my preferred listing
|
alias ls='exa -al --color=always --group-directories-first' # my preferred listing
|
||||||
|
@ -80,12 +134,12 @@ alias lt='exa -aT --color=always --group-directories-first' # tree listing
|
||||||
alias l.='exa -a | egrep "^\."'
|
alias l.='exa -a | egrep "^\."'
|
||||||
|
|
||||||
# xbps
|
# xbps
|
||||||
alias xb-up='sudo xbps-install -Su' # update the whole system
|
alias xb-up='sudo xbps-install -Su && xcheckrestart' # update the whole system
|
||||||
alias xb-get='sudo xbps-install -S' # install a program
|
alias xb-get='sudo xbps-install -S' # install a program
|
||||||
alias xb-qry='sudo xbps-query' # query details about a program
|
alias xb-qry='sudo xbps-query' # query details about a program
|
||||||
alias xb-rmv='sudo xbps-remove -R' # remove a package with all its dependencies (it may brake something)
|
alias xb-rmv='sudo xbps-remove -R' # remove a package with all its dependencies (it may brake something)
|
||||||
alias xb-rmv-sec='sudo xbps-remove' # remove a package with all its dependencies (secure way)
|
alias xb-rmv-sec='sudo xbps-remove' # remove a package with all its dependencies (secure way)
|
||||||
alias xb-cln='sudo xbps-remove -o && sudo xbps-remove -O' # remove unnecesary packages and clean cache
|
alias xb-cln='sudo xbps-remove -o && sudo xbps-remove -O' # remove unnecesary packages and clean cache
|
||||||
|
|
||||||
# Colorize grep output (good for log files)
|
# Colorize grep output (good for log files)
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
|
|
|
@ -652,8 +652,8 @@ background_opacity: 0.97
|
||||||
# - (macOS) /bin/bash --login
|
# - (macOS) /bin/bash --login
|
||||||
# - (Linux/BSD) user login shell
|
# - (Linux/BSD) user login shell
|
||||||
# - (Windows) powershell
|
# - (Windows) powershell
|
||||||
#shell:
|
shell:
|
||||||
# program: /bin/bash
|
program: /bin/fish
|
||||||
# args:
|
# args:
|
||||||
# - --login
|
# - --login
|
||||||
|
|
||||||
|
|
|
@ -112,12 +112,10 @@ awful.util.terminal = terminal
|
||||||
-- Terminal
|
-- Terminal
|
||||||
local terminal = "alacritty"
|
local terminal = "alacritty"
|
||||||
-- Standard Apps
|
-- Standard Apps
|
||||||
local code = "emacsclient -c -a emacs"
|
local edit = "emacsclient -c -a emacs"
|
||||||
local file = "alacritty -e ./.config/vifm/scripts/vifmrun"
|
local file = "alacritty -e ./.config/vifm/scripts/vifmrun"
|
||||||
local web = "firefox"
|
local web = "firefox"
|
||||||
local chat = "element-desktop"
|
|
||||||
local music = "alacritty -e musikcube"
|
local music = "alacritty -e musikcube"
|
||||||
local notes = "zim"
|
|
||||||
local games = "retroarch"
|
local games = "retroarch"
|
||||||
-- Specific Apps
|
-- Specific Apps
|
||||||
local libreoffice = "libreoffice"
|
local libreoffice = "libreoffice"
|
||||||
|
@ -127,8 +125,9 @@ local krita = "krita"
|
||||||
local audacity = "audacity"
|
local audacity = "audacity"
|
||||||
local obs = "obs"
|
local obs = "obs"
|
||||||
local thunderbird = "thunderbird"
|
local thunderbird = "thunderbird"
|
||||||
local transmission = "transmission-gtk"
|
local qbittorrent = "qbittorrent"
|
||||||
local pavucontrol = "pavucontrol"
|
local pulsemixer = "alacritty -e pulsemixer"
|
||||||
|
local alsamixer = "alacritty -e alsamixer"
|
||||||
-- Key bindings variables
|
-- Key bindings variables
|
||||||
local modkey = "Mod4"
|
local modkey = "Mod4"
|
||||||
local altkey = "Mod1"
|
local altkey = "Mod1"
|
||||||
|
@ -140,15 +139,13 @@ local screenlocker = "betterlockscreen -l"
|
||||||
-- BEGINNING OF TAG NAMES --
|
-- BEGINNING OF TAG NAMES --
|
||||||
awful.util.tagnames =
|
awful.util.tagnames =
|
||||||
{
|
{
|
||||||
" CODE ", -- F1
|
" EDIT ", -- F1
|
||||||
" FILE ", -- F2
|
" FILE ", -- F2
|
||||||
" WEB ", -- F3
|
" WEB ", -- F3
|
||||||
" CHAT ", -- F4
|
" MUSIC ", -- F4
|
||||||
" MUSIC ", -- F5
|
|
||||||
" NOTES ", -- F6
|
|
||||||
" WORK ", -- XX
|
" WORK ", -- XX
|
||||||
" EXTRA ", -- XX
|
" MISC ", -- XX
|
||||||
" GAMES " -- F9
|
" GAMES " -- F7
|
||||||
}
|
}
|
||||||
-- END OF TAG NAMES --
|
-- END OF TAG NAMES --
|
||||||
|
|
||||||
|
@ -293,8 +290,8 @@ globalkeys = my_table.join(
|
||||||
awful.key({ modkey, "Shift" }, "u", function () awful.util.spawn("setxkbmap -layout us") end,
|
awful.key({ modkey, "Shift" }, "u", function () awful.util.spawn("setxkbmap -layout us") end,
|
||||||
{description = "Switch to US keyboard layout", group = "Quick Actions"}),
|
{description = "Switch to US keyboard layout", group = "Quick Actions"}),
|
||||||
-- Apps
|
-- Apps
|
||||||
-- code
|
-- edit
|
||||||
awful.key({ modkey }, "F1", function () awful.spawn(code) end,
|
awful.key({ modkey }, "F1", function () awful.spawn(edit) end,
|
||||||
{description = "Launch text editor", group = "Standard Apps"}),
|
{description = "Launch text editor", group = "Standard Apps"}),
|
||||||
-- file
|
-- file
|
||||||
awful.key({ modkey }, "F2", function () awful.spawn(file) end,
|
awful.key({ modkey }, "F2", function () awful.spawn(file) end,
|
||||||
|
@ -302,17 +299,11 @@ globalkeys = my_table.join(
|
||||||
-- web
|
-- web
|
||||||
awful.key({ modkey }, "F3", function () awful.spawn(web) end,
|
awful.key({ modkey }, "F3", function () awful.spawn(web) end,
|
||||||
{description = "Launch web browser", group = "Standard Apps"}),
|
{description = "Launch web browser", group = "Standard Apps"}),
|
||||||
-- chat
|
|
||||||
awful.key({ modkey }, "F4", function () awful.spawn(chat) end,
|
|
||||||
{description = "Launch chat app", group = "Standard Apps"}),
|
|
||||||
-- music
|
-- music
|
||||||
awful.key({ modkey }, "F5", function () awful.spawn(music) end,
|
awful.key({ modkey }, "F4", function () awful.spawn(music) end,
|
||||||
{description = "Launch music player", group = "Standard Apps"}),
|
{description = "Launch music player", group = "Standard Apps"}),
|
||||||
-- notes
|
|
||||||
awful.key({ modkey }, "F6", function () awful.spawn(notes) end,
|
|
||||||
{description = "Launch note taking app", group = "Standard Apps"}),
|
|
||||||
-- games
|
-- games
|
||||||
awful.key({ modkey }, "F9", function () awful.util.spawn(games) end,
|
awful.key({ modkey }, "F7", function () awful.util.spawn(games) end,
|
||||||
{description = "Launch gaming app", group = "Standard Apps"}),
|
{description = "Launch gaming app", group = "Standard Apps"}),
|
||||||
-- Specific Apps
|
-- Specific Apps
|
||||||
-- libreoffice
|
-- libreoffice
|
||||||
|
@ -333,15 +324,18 @@ globalkeys = my_table.join(
|
||||||
-- obs
|
-- obs
|
||||||
awful.key({ modkey, modkey1 }, "F6", function () awful.spawn(obs) end,
|
awful.key({ modkey, modkey1 }, "F6", function () awful.spawn(obs) end,
|
||||||
{description = "Launch obs", group = "Specific Apps"}),
|
{description = "Launch obs", group = "Specific Apps"}),
|
||||||
-- sylpheed
|
-- thunderbird
|
||||||
awful.key({ modkey, modkey1 }, "F7", function () awful.spawn(thunderbird) end,
|
awful.key({ modkey, modkey1 }, "F7", function () awful.spawn(thunderbird) end,
|
||||||
{description = "Launch sylpheed", group = "Specific Apps"}),
|
{description = "Launch thunderbird", group = "Specific Apps"}),
|
||||||
-- transmission
|
-- transmission
|
||||||
awful.key({ modkey, modkey1 }, "F8", function () awful.spawn(transmission) end,
|
awful.key({ modkey, modkey1 }, "F8", function () awful.spawn(qbittorrent) end,
|
||||||
{description = "Launch transmission", group = "Specific Apps"}),
|
{description = "Launch qbittorrent", group = "Specific Apps"}),
|
||||||
-- pavucontrol
|
-- pulsemixer
|
||||||
awful.key({ modkey, modkey1 }, "F9", function () awful.spawn(pavucontrol) end,
|
awful.key({ modkey, modkey1 }, "F9", function () awful.spawn(pulsemixer) end,
|
||||||
{description = "Launch pavucontrol", group = "Specific Apps"}),
|
{description = "Launch pulsemixer", group = "Specific Apps"}),
|
||||||
|
-- alsamixer
|
||||||
|
awful.key({ modkey, altkey }, "F9", function () awful.spawn(alsamixer) end,
|
||||||
|
{description = "Launch alsamixer", group = "Specific Apps"}),
|
||||||
-- Volume
|
-- Volume
|
||||||
awful.key({}, "XF86AudioRaiseVolume", function() volume_widget:inc(5) end,
|
awful.key({}, "XF86AudioRaiseVolume", function() volume_widget:inc(5) end,
|
||||||
{description = "Increase volume", group = "Quick Actions"}),
|
{description = "Increase volume", group = "Quick Actions"}),
|
||||||
|
@ -590,6 +584,6 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
||||||
-- BEGINNING OF AUTOSTART --
|
-- BEGINNING OF AUTOSTART --
|
||||||
awful.util.spawn_with_shell("sh $HOME/.fehbg &")
|
awful.util.spawn_with_shell("sh $HOME/.fehbg &")
|
||||||
awful.util.spawn_with_shell("lxpolkit &")
|
awful.util.spawn_with_shell("lxpolkit &")
|
||||||
awful.util.spawn_with_shell("picom --config ~/.config/picom.conf &")
|
awful.util.spawn_with_shell("picom --config ~/.config/picom/picom.conf &")
|
||||||
awful.util.spawn_with_shell("/usr/bin/emacs --daemon &")
|
awful.util.spawn_with_shell("/usr/bin/emacs --daemon &")
|
||||||
-- END OF AUTOSTART --
|
-- END OF AUTOSTART --
|
||||||
|
|
|
@ -11,7 +11,8 @@ end
|
||||||
|
|
||||||
### EXPORT
|
### EXPORT
|
||||||
set -U fish_greeting ""
|
set -U fish_greeting ""
|
||||||
set EDITOR "nvim" # $EDITOR use neovim
|
set EDITOR "emacsclient -t -a ''" # $EDITOR use Emacs in terminal
|
||||||
|
set VISUAL "emacsclient -c -a emacs" # $VISUAL use Emacs in GUI mode
|
||||||
|
|
||||||
### ADDING TO THE PATH
|
### ADDING TO THE PATH
|
||||||
# First line removes the path; second line sets it. Without the first line,
|
# First line removes the path; second line sets it. Without the first line,
|
||||||
|
@ -35,6 +36,86 @@ set fish_color_command brcyan
|
||||||
set fish_color_error '#ff6c6b'
|
set fish_color_error '#ff6c6b'
|
||||||
set fish_color_param brcyan
|
set fish_color_param brcyan
|
||||||
|
|
||||||
|
### FUNCTIONS
|
||||||
|
# Functions needed for !! and !$
|
||||||
|
function __history_previous_command
|
||||||
|
switch (commandline -t)
|
||||||
|
case "!"
|
||||||
|
commandline -t $history[1]; commandline -f repaint
|
||||||
|
case "*"
|
||||||
|
commandline -i !
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __history_previous_command_arguments
|
||||||
|
switch (commandline -t)
|
||||||
|
case "!"
|
||||||
|
commandline -t ""
|
||||||
|
commandline -f history-token-search-backward
|
||||||
|
case "*"
|
||||||
|
commandline -i '$'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# The bindings for !! and !$
|
||||||
|
if [ $fish_key_bindings = "fish_vi_key_bindings" ];
|
||||||
|
bind -Minsert ! __history_previous_command
|
||||||
|
bind -Minsert '$' __history_previous_command_arguments
|
||||||
|
else
|
||||||
|
bind ! __history_previous_command
|
||||||
|
bind '$' __history_previous_command_arguments
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for creating a backup file
|
||||||
|
# ex: backup file.txt
|
||||||
|
# result: copies file as file.txt.bak
|
||||||
|
function backup --argument filename
|
||||||
|
cp $filename $filename.bak
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for copying files and directories, even recursively.
|
||||||
|
# ex: copy DIRNAME LOCATIONS
|
||||||
|
# result: copies the directory and all of its contents.
|
||||||
|
function copy
|
||||||
|
set count (count $argv | tr -d \n)
|
||||||
|
if test "$count" = 2; and test -d "$argv[1]"
|
||||||
|
set from (echo $argv[1] | trim-right /)
|
||||||
|
set to (echo $argv[2])
|
||||||
|
command cp -r $from $to
|
||||||
|
else
|
||||||
|
command cp $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for printing a column (splits input on whitespace)
|
||||||
|
# ex: echo 1 2 3 | coln 3
|
||||||
|
# output: 3
|
||||||
|
function coln
|
||||||
|
while read -l input
|
||||||
|
echo $input | awk '{print $'$argv[1]'}'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for printing a row
|
||||||
|
# ex: seq 3 | rown 3
|
||||||
|
# output: 3
|
||||||
|
function rown --argument index
|
||||||
|
sed -n "$index p"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for ignoring the first 'n' lines
|
||||||
|
# ex: seq 10 | skip 5
|
||||||
|
# results: prints everything but the first 5 lines
|
||||||
|
function skip --argument n
|
||||||
|
tail +(math 1 + $n)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for taking the first 'n' lines
|
||||||
|
# ex: seq 10 | take 5
|
||||||
|
# results: prints only the first 5 lines
|
||||||
|
function take --argument number
|
||||||
|
head -$number
|
||||||
|
end
|
||||||
|
|
||||||
### ALIASES
|
### ALIASES
|
||||||
# navigation
|
# navigation
|
||||||
alias ..='cd ..'
|
alias ..='cd ..'
|
||||||
|
@ -46,8 +127,14 @@ alias .5='cd ../../../../..'
|
||||||
# bat as cat
|
# bat as cat
|
||||||
alias cat='bat'
|
alias cat='bat'
|
||||||
|
|
||||||
# neovim as vim
|
# editors
|
||||||
alias vim='nvim'
|
alias vim='nvim'
|
||||||
|
alias em="/usr/bin/emacs -nw"
|
||||||
|
alias emacs="emacsclient -c -a 'emacs'"
|
||||||
|
alias doomsync="~/.emacs.d/bin/doom sync"
|
||||||
|
alias doomdoctor="~/.emacs.d/bin/doom doctor"
|
||||||
|
alias doomupgrade="~/.emacs.d/bin/doom upgrade"
|
||||||
|
alias doompurge="~/.emacs.d/bin/doom purge"
|
||||||
|
|
||||||
# Changing "ls" to "exa"
|
# Changing "ls" to "exa"
|
||||||
alias ls='exa -al --color=always --group-directories-first' # my preferred listing
|
alias ls='exa -al --color=always --group-directories-first' # my preferred listing
|
||||||
|
@ -57,12 +144,12 @@ alias lt='exa -aT --color=always --group-directories-first' # tree listing
|
||||||
alias l.='exa -a | egrep "^\."'
|
alias l.='exa -a | egrep "^\."'
|
||||||
|
|
||||||
# xbps
|
# xbps
|
||||||
alias xb-up='sudo xbps-install -Su' # update the whole system
|
alias xb-up='sudo xbps-install -Su && xcheckrestart' # update the whole system
|
||||||
alias xb-get='sudo xbps-install -S' # install a program
|
alias xb-get='sudo xbps-install -S' # install a program
|
||||||
alias xb-qry='sudo xbps-query' # query details about a program
|
alias xb-qry='sudo xbps-query' # query details about a program
|
||||||
alias xb-rmv='sudo xbps-remove -R' # remove a package with all its dependencies (it may brake something)
|
alias xb-rmv='sudo xbps-remove -R' # remove a package with all its dependencies (it may brake something)
|
||||||
alias xb-rmv-sec='sudo xbps-remove' # remove a package with all its dependencies (secure way)
|
alias xb-rmv-sec='sudo xbps-remove' # remove a package with all its dependencies (secure way)
|
||||||
alias xb-cln='sudo xbps-remove -o && sudo xbps-remove -O' # remove unnecesary packages and clean cache
|
alias xb-cln='sudo xbps-remove -o && sudo xbps-remove -O' # remove unnecesary packages and clean cache
|
||||||
|
|
||||||
# Colorize grep output (good for log files)
|
# Colorize grep output (good for log files)
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
|
|
Loading…
Reference in a new issue