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 TERM="xterm-256color" # getting proper colors
|
||||
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
|
||||
### "bat" as manpager
|
||||
|
@ -58,6 +59,53 @@ shopt -s checkwinsize # checks term size when bash regains control
|
|||
#ignore upper and lowercase when TAB completion
|
||||
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
|
||||
# navigation
|
||||
alias ..='cd ..'
|
||||
|
@ -69,8 +117,14 @@ alias .5='cd ../../../../..'
|
|||
# bat as cat
|
||||
alias cat='bat'
|
||||
|
||||
# neovim as vim
|
||||
# editors
|
||||
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"
|
||||
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 "^\."'
|
||||
|
||||
# xbps
|
||||
alias xb-up='sudo xbps-install -Su' # update the whole system
|
||||
alias xb-get='sudo xbps-install -S' # install 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-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-up='sudo xbps-install -Su && xcheckrestart' # update the whole system
|
||||
alias xb-get='sudo xbps-install -S' # install 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-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
|
||||
|
||||
# Colorize grep output (good for log files)
|
||||
alias grep='grep --color=auto'
|
||||
|
|
|
@ -652,8 +652,8 @@ background_opacity: 0.97
|
|||
# - (macOS) /bin/bash --login
|
||||
# - (Linux/BSD) user login shell
|
||||
# - (Windows) powershell
|
||||
#shell:
|
||||
# program: /bin/bash
|
||||
shell:
|
||||
program: /bin/fish
|
||||
# args:
|
||||
# - --login
|
||||
|
||||
|
|
|
@ -112,12 +112,10 @@ awful.util.terminal = terminal
|
|||
-- Terminal
|
||||
local terminal = "alacritty"
|
||||
-- Standard Apps
|
||||
local code = "emacsclient -c -a emacs"
|
||||
local edit = "emacsclient -c -a emacs"
|
||||
local file = "alacritty -e ./.config/vifm/scripts/vifmrun"
|
||||
local web = "firefox"
|
||||
local chat = "element-desktop"
|
||||
local music = "alacritty -e musikcube"
|
||||
local notes = "zim"
|
||||
local games = "retroarch"
|
||||
-- Specific Apps
|
||||
local libreoffice = "libreoffice"
|
||||
|
@ -127,8 +125,9 @@ local krita = "krita"
|
|||
local audacity = "audacity"
|
||||
local obs = "obs"
|
||||
local thunderbird = "thunderbird"
|
||||
local transmission = "transmission-gtk"
|
||||
local pavucontrol = "pavucontrol"
|
||||
local qbittorrent = "qbittorrent"
|
||||
local pulsemixer = "alacritty -e pulsemixer"
|
||||
local alsamixer = "alacritty -e alsamixer"
|
||||
-- Key bindings variables
|
||||
local modkey = "Mod4"
|
||||
local altkey = "Mod1"
|
||||
|
@ -140,15 +139,13 @@ local screenlocker = "betterlockscreen -l"
|
|||
-- BEGINNING OF TAG NAMES --
|
||||
awful.util.tagnames =
|
||||
{
|
||||
" CODE ", -- F1
|
||||
" EDIT ", -- F1
|
||||
" FILE ", -- F2
|
||||
" WEB ", -- F3
|
||||
" CHAT ", -- F4
|
||||
" MUSIC ", -- F5
|
||||
" NOTES ", -- F6
|
||||
" MUSIC ", -- F4
|
||||
" WORK ", -- XX
|
||||
" EXTRA ", -- XX
|
||||
" GAMES " -- F9
|
||||
" MISC ", -- XX
|
||||
" GAMES " -- F7
|
||||
}
|
||||
-- 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,
|
||||
{description = "Switch to US keyboard layout", group = "Quick Actions"}),
|
||||
-- Apps
|
||||
-- code
|
||||
awful.key({ modkey }, "F1", function () awful.spawn(code) end,
|
||||
-- edit
|
||||
awful.key({ modkey }, "F1", function () awful.spawn(edit) end,
|
||||
{description = "Launch text editor", group = "Standard Apps"}),
|
||||
-- file
|
||||
awful.key({ modkey }, "F2", function () awful.spawn(file) end,
|
||||
|
@ -302,17 +299,11 @@ globalkeys = my_table.join(
|
|||
-- web
|
||||
awful.key({ modkey }, "F3", function () awful.spawn(web) end,
|
||||
{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
|
||||
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"}),
|
||||
-- notes
|
||||
awful.key({ modkey }, "F6", function () awful.spawn(notes) end,
|
||||
{description = "Launch note taking app", group = "Standard Apps"}),
|
||||
-- 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"}),
|
||||
-- Specific Apps
|
||||
-- libreoffice
|
||||
|
@ -333,15 +324,18 @@ globalkeys = my_table.join(
|
|||
-- obs
|
||||
awful.key({ modkey, modkey1 }, "F6", function () awful.spawn(obs) end,
|
||||
{description = "Launch obs", group = "Specific Apps"}),
|
||||
-- sylpheed
|
||||
-- thunderbird
|
||||
awful.key({ modkey, modkey1 }, "F7", function () awful.spawn(thunderbird) end,
|
||||
{description = "Launch sylpheed", group = "Specific Apps"}),
|
||||
{description = "Launch thunderbird", group = "Specific Apps"}),
|
||||
-- transmission
|
||||
awful.key({ modkey, modkey1 }, "F8", function () awful.spawn(transmission) end,
|
||||
{description = "Launch transmission", group = "Specific Apps"}),
|
||||
-- pavucontrol
|
||||
awful.key({ modkey, modkey1 }, "F9", function () awful.spawn(pavucontrol) end,
|
||||
{description = "Launch pavucontrol", group = "Specific Apps"}),
|
||||
awful.key({ modkey, modkey1 }, "F8", function () awful.spawn(qbittorrent) end,
|
||||
{description = "Launch qbittorrent", group = "Specific Apps"}),
|
||||
-- pulsemixer
|
||||
awful.key({ modkey, modkey1 }, "F9", function () awful.spawn(pulsemixer) end,
|
||||
{description = "Launch pulsemixer", group = "Specific Apps"}),
|
||||
-- alsamixer
|
||||
awful.key({ modkey, altkey }, "F9", function () awful.spawn(alsamixer) end,
|
||||
{description = "Launch alsamixer", group = "Specific Apps"}),
|
||||
-- Volume
|
||||
awful.key({}, "XF86AudioRaiseVolume", function() volume_widget:inc(5) end,
|
||||
{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 --
|
||||
awful.util.spawn_with_shell("sh $HOME/.fehbg &")
|
||||
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 &")
|
||||
-- END OF AUTOSTART --
|
||||
|
|
|
@ -11,7 +11,8 @@ end
|
|||
|
||||
### EXPORT
|
||||
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
|
||||
# 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_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
|
||||
# navigation
|
||||
alias ..='cd ..'
|
||||
|
@ -46,8 +127,14 @@ alias .5='cd ../../../../..'
|
|||
# bat as cat
|
||||
alias cat='bat'
|
||||
|
||||
# neovim as vim
|
||||
# editors
|
||||
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"
|
||||
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 "^\."'
|
||||
|
||||
# xbps
|
||||
alias xb-up='sudo xbps-install -Su' # update the whole system
|
||||
alias xb-get='sudo xbps-install -S' # install 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-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-up='sudo xbps-install -Su && xcheckrestart' # update the whole system
|
||||
alias xb-get='sudo xbps-install -S' # install 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-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
|
||||
|
||||
# Colorize grep output (good for log files)
|
||||
alias grep='grep --color=auto'
|
||||
|
|
Loading…
Reference in a new issue