Compare commits

...

4 Commits

Author SHA1 Message Date
tosu 00a1ed3412 Add new_key.sh 2024-06-03 22:49:00 +02:00
tosu 2c7c634622 bashrc cleanup 2024-06-03 22:44:54 +02:00
tosu 3630610866 Add hist script 2024-06-03 22:10:07 +02:00
tosu b7c34c23fe Feat!: bash history improvements 2024-05-31 20:54:36 +02:00
9 changed files with 226 additions and 209 deletions

217
.bashrc
View File

@ -1,65 +1,54 @@
#! /usr/bin/bash - #! /usr/bin/bash -
# This file ought to be sourced, above line for syntax highlighting purposes. # This file ought to be sourced, above line for syntax highlighting purposes.
# Exit when noninteractive. Checking for empty PS1 doesn't work in dash.
[ "${-#*i}" = "$-" ] && return
######################## BASH RESET ############################# ######################## BASH RESET #############################
IFS=" IFS="
" "
POSIXLY_CORRECT='1' POSIXLY_CORRECT='1'
COMMANDS_="builtin unalias unset read printf command exit type . tr fc compgen" declare -a __COMMANDS=(builtin unalias unset read printf command exit type tr fc compgen wc sed grep xargs sudo shopt kill ps head awk clear curl wget source check mv mkdir rm rmdir while do done cc gcc clang basename clone42 git alias export pwd docker shift until for in bash sh dash ash ksh zsh top shellcheck watch cmatrix alacritty tmux zellij ssh which date df du case esac crontab ping base64 apt paru pacman yum dnf aptitude yay rpm dpkg env awk apropos help info dirname bc dc break continue unzip zip tar untar gzip gunzip xz unxz base32 cal chattr cfdisk fdisk passwd chroot cmp cron split dd df dir declare diff dircolors dmesg eval complete exec egrep false true fg bg free fold find file gawk groupadd less more cat head tail chmod chown history trap sleep yes useradd adduser addgroup usermod groupdel userdel xxd groups users who w last hash hostname htop ip ifconfig install ifdown ifup jobs killall pkill pgrep klist link ln unlink let local logout logname lsblk lsof pidof lspci lsusb lscpu make mktemp mount umount nc ncat nmap nft iptables ufw nl nslookup open whereis whatis write wall agetty amixer pulsemixer ar cmake bzip2 ccrypt chvt column chsh ex od pushd popd pv pvs lvs vgs rsync screen sed seq wait ftp sftp shift shuf sort uniq su strace sync tee test time trap tr tty ulimit umask unix2dos dos2unix uptime paco francinette cd ls disown whoami reboot systemctl shutdown poweroff set x touch stat cp scp man locate xset kbdrate return cut batcat id ed vi vim nvim nano skill norminette bat echo if then fi else function PROMPT_COMMAND PS0 PS1 PS2 PS3 PS4 tabs xmodmap lesspipe CDPATH dotconf)
COMMANDS_="${COMMANDS_-} wc sed grep xargs sudo shopt kill ps head awk clear" declare -a __ALL_COMMANDS=("${__COMMANDS[@]}" . : g++ firewall-cmd apt-get xdg-open) # commands that are not alnum
COMMANDS_="${COMMANDS_-} curl wget source check mv mkdir rm rmdir while do done"
COMMANDS_="${COMMANDS_-} cc gcc g++ clang basename clone42 git alias export pwd"
COMMANDS_="${COMMANDS_-} docker shift until for in bash sh dash ash ksh zsh top"
COMMANDS_="${COMMANDS_-} shellcheck watch cmatrix alacritty tmux zellij ssh"
COMMANDS_="${COMMANDS_-} which date df du case esac crontab ping base64 apt"
COMMANDS_="${COMMANDS_-} paru pacman yum dnf aptitude apt-get yay rpm dpkg env"
COMMANDS_="${COMMANDS_-} awk apropos help info dirname bc dc break continue"
COMMANDS_="${COMMANDS_-} unzip zip tar untar gzip gunzip xz unxz base32 cal"
COMMANDS_="${COMMANDS_-} chattr cfdisk fdisk passwd chroot cmp cron split dd"
COMMANDS_="${COMMANDS_-} df dir declare diff dircolors dmesg eval exec egrep"
COMMANDS_="${COMMANDS_-} false true : fg bg free fold find file gawk groupadd"
COMMANDS_="${COMMANDS_-} less more cat head tail chmod chown history sleep yes"
COMMANDS_="${COMMANDS_-} useradd adduser addgroup usermod groupdel userdel xxd"
COMMANDS_="${COMMANDS_-} groups users who w last hash hostname htop ip ifconfig"
COMMANDS_="${COMMANDS_-} install ifdown ifup jobs killall pkill pgrep klist"
COMMANDS_="${COMMANDS_-} link ln unlink let local logout logname lsblk lsof"
COMMANDS_="${COMMANDS_-} pidof lspci lsusb lscpu make mktemp mount umount nc"
COMMANDS_="${COMMANDS_-} ncat nmap nft iptables ufw firewall-cmd nl nslookup"
COMMANDS_="${COMMANDS_-} open xdg-open whereis whatis write wall agetty amixer"
COMMANDS_="${COMMANDS_-} pulsemixer ar cmake bzip2 ccrypt chvt column chsh ex"
COMMANDS_="${COMMANDS_-} od pushd popd pv pvs lvs vgs rsync screen sed seq wait"
COMMANDS_="${COMMANDS_-} ftp sftp shift shuf sort uniq su strace sync tee test"
COMMANDS_="${COMMANDS_-} time trap tr tty ulimit umask unix2dos dos2unix uptime"
COMMANDS_="${COMMANDS_-} paco francinette cd ls disown whoami reboot systemctl"
COMMANDS_="${COMMANDS_-} shutdown poweroff set x touch stat cp scp man locate"
COMMANDS_="${COMMANDS_-} xset kbdrate return cut batcat id ed vi vim nvim nano"
COMMANDS_="${COMMANDS_-} skill norminette bat echo if then fi else function"
COMMANDS_="${COMMANDS_-} PROMPT_COMMAND PS0 PS1 PS2 PS3 PS4"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
2>/dev/null \unset -f -- ${COMMANDS_-} || true 2>/dev/null \unset -f -- "${__ALL_COMMANDS[@]}" || true
# shellcheck disable=SC2086 # shellcheck disable=SC2086
2>/dev/null \unalias -- ${COMMANDS_-} || true 2>/dev/null \unalias -- "${__ALL_COMMANDS[@]}" || true
\builtin -- hash -r builtin hash -r
2>/dev/null \unset -- POSIXLY_CORRECT COMMANDS_ unset -v POSIXLY_CORRECT
######################## BASH RESET END ############################# ######################## BASH RESET END #############################
[ -z "${PS1-}" ] && return ####################### BASH SHELL OPTIONS #################################
set -o emacs
tabs -4
shopt -s histappend
shopt -s checkwinsize
shopt -s extglob shopt -s extglob
shopt -u histverify shopt -s checkwinsize
shopt -s autocd shopt -s autocd
######## HISTORY SHELL OPTIONS #########
shopt -s histappend
shopt -s histreedit
shopt -u histverify
shopt -s lithist
shopt -s cmdhist
###################### BETTER HISTORY ######################
# declare -r BASH_SESSION_NAME="${__COMMANDS[$(( RANDOM % ${#__COMMANDS[@]}))]}_${__COMMANDS[$(( RANDOM % ${#__COMMANDS[@]}))]}_${__COMMANDS[$(( RANDOM % ${#__COMMANDS[@]}))]}"
declare -r BASH_SESSION_NAME="${$}"
HISTSIZE='-1' HISTSIZE='-1'
HISTFILESIZE='-1' HISTFILESIZE='-1'
HISTFILE="${HOME}"/.bash_history REAL_HISTFILE="${HOME}/.better_bash_history/.bash_history_$(printf '%(%Y-%m-%d)T')_daily"
history -c; history -r "${REAL_HISTFILE}"
HISTFILE="${HOME}/.better_bash_history/.bash_history_$(printf '%(%Y-%m-%d-%H-%M-%S)T')_${BASH_SESSION_NAME}"
write_history () {
[ -f "${HISTFILE}" ] &&
[ -r "${HISTFILE}" ] &&
<"${HISTFILE}" tee -a "${REAL_HISTFILE}" 1>/dev/null &&
rm -f "${HISTFILE}"
}
trap write_history EXIT
HISTTIMEFORMAT=$'\033[m%F %T: ' HISTTIMEFORMAT=$'\033[m%F %T: '
HISTCONTROL='ignoreboth:erasedups' HISTCONTROL='ignoreboth'
# PROMPT_COMMAND="history -n; history -w; history -c; history -r"
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
########################### vim aliases #####################
if 2>/dev/null 1>&2 command -v nvim; then if 2>/dev/null 1>&2 command -v nvim; then
alias v='nvim' alias v='nvim'
alias vi='nvim' alias vi='nvim'
@ -73,33 +62,24 @@ elif 2>/dev/null 1>&2 command -v nvi; then
elif 2>/dev/null 1>&2 command -v vi; then elif 2>/dev/null 1>&2 command -v vi; then
alias v='vi' alias v='vi'
fi fi
############# GENERAL ALIASES #####################
alias tapo_bright='ssh -t pt bash -ic tapo_bright' alias cat='bat'
alias tapo_color_ambience='ssh -t pt bash -ic tapo_color_ambience'
alias tapo_color_ambience2='ssh -t pt bash -ic tapo_color_ambience2'
alias gdb='gdb -q' alias gdb='gdb -q'
alias objdump='objdump --disassembler-color=extended-color -Mintel' alias objdump='objdump --disassembler-color=extended-color -Mintel'
alias v='nvim'
alias vim='nvim'
alias ..='cd ..' alias ..='cd ..'
alias ...='cd ../..' alias ...='cd ../..'
alias ....='cd ../../..' alias ....='cd ../../..'
alias watch='watch -tcn.1 '
alias sudo='sudo ' alias sudo='sudo '
alias s='echo sudo $(fc -nl -2 | head -1 | cut -c3-); eval sudo $(fc -nl -2 | head -1 | cut -c3-)' # cut -c2- for bash posix mode alias s='echo sudo $(fc -nl -2 | head -1 | cut -c3-); eval sudo $(fc -nl -2 | head -1 | cut -c3-)' # cut -c2- for bash posix mode
alias watch='watch '
alias tmux='tmux -2' alias tmux='tmux -2'
alias open='xdg-open' alias open='xdg-open'
alias xcopy='xsel --clipboard --input' alias xcopy='xsel --clipboard --input'
alias xpaste='xsel --clipboard --output' alias xpaste='xsel --clipboard --output'
alias aptclean='sudo apt -y update && sudo apt -y full-upgrade &&
sudo apt -y dist-upgrade && sudo apt -y autoremove &&
sudo apt -y clean'
# shellcheck disable=SC2032
alias pacman='pacman --color=auto' alias pacman='pacman --color=auto'
alias pcker='nvim "${HOME-}"/.config/nvim/lua/*' alias pcker='nvim "${HOME-}"/.config/nvim/lua/*'
alias after='nvim "${HOME-}"/.config/nvim/after/plugin' alias after='nvim "${HOME-}"/.config/nvim/after/plugin'
alias l='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --time-style=long-iso -bharZ1l' alias l='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --time-style=long-iso -bharZ1l'
# alias l='lsd --timesort --color=auto -harZ1l'
alias ll='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --fu -bharZ1l' alias ll='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --fu -bharZ1l'
alias ls='\ls --width="${COLUMNS:-80}" --color=auto -bC' alias ls='\ls --width="${COLUMNS:-80}" --color=auto -bC'
alias ip='ip -color=auto' alias ip='ip -color=auto'
@ -119,27 +99,13 @@ alias colors='bash -c "$(curl --silent --location \
)"' )"'
alias sl='sl -GwFdcal' alias sl='sl -GwFdcal'
alias cmatrix='cmatrix -u3 -Cred' alias cmatrix='cmatrix -u3 -Cred'
alias gca='git add -u && git commit -m "Automatic add"'
alias watch='watch -tcn.1'
alias pacop='clear && 2>/dev/null paco && 2>/dev/null paco --strict'
alias xterm='xterm -bg black -fg white'
alias norm='alacritty -e sh -c '\''watch -cn.5 \
norminette -R CheckForbiddenSourceHeader'\'' & disown'
alias norm2='alacritty -e sh -c '\''watch -cn.5 \
norminette -R CheckForbiddenSourceHeader \| \
xargs -I{} printf \"{} \#\#\# \"'\'' & disown'
alias dotconf='git --git-dir="${HOME-}"/.dotfiles/ --work-tree="${HOME-}"'
alias r='ranger' alias r='ranger'
2>/dev/null dotconf config status.showUntrackedFiles no alias q='docker run --rm -it ghcr.io/natesales/q'
alias make='compiledb make'
alias dotconf='git --git-dir="${HOME-}"/.dotfiles/ --work-tree="${HOME-}"'
# auto_pushd
function cd () {
command cd "${@}" || return 1
pwd="${PWD}"
1>/dev/null command cd - || return 1
1>/dev/null pushd "${pwd}" || return 1
}
#################### CDPATHS #############################
CDPATH="${CDPATH}:${HOME}" CDPATH="${CDPATH}:${HOME}"
CDPATH="${CDPATH}:${HOME}/projects" CDPATH="${CDPATH}:${HOME}/projects"
CDPATH="${CDPATH}:${HOME}/projects/aoc" CDPATH="${CDPATH}:${HOME}/projects/aoc"
@ -148,6 +114,16 @@ CDPATH="${CDPATH}:${HOME}/42ecole"
CDPATH="${CDPATH}:${HOME}/42ecole/42cursus" CDPATH="${CDPATH}:${HOME}/42ecole/42cursus"
CDPATH="${CDPATH}:${HOME}/onnea" CDPATH="${CDPATH}:${HOME}/onnea"
####################### FUNCTIONS ##############################
# auto_pushd
function cd () {
command cd "${@}" || return 1
pwd="${PWD}"
1>/dev/null command cd - || return 1
1>/dev/null pushd "${pwd}" || return 1
}
function paruuu () { function paruuu () {
read -p 'Do system upgrade (Y) or exit (n)' choice read -p 'Do system upgrade (Y) or exit (n)' choice
if [ ! "${choice}" = "y" -a ! "${choice}" = "Y" -a -n "${choice}" ]; then if [ ! "${choice}" = "y" -a ! "${choice}" = "Y" -a -n "${choice}" ]; then
@ -180,7 +156,7 @@ function paruuu () {
&& [ ! "${ssid-}" = "Silmaril 4 (2.4)" ] \ && [ ! "${ssid-}" = "Silmaril 4 (2.4)" ] \
&& [ -n "${ssid-}" ] \ && [ -n "${ssid-}" ] \
&& : ; then && : ; then
read -p "[31mYou're connected to '${ssid-}', update anyway (Y|n)?[m" choice read -p "You're connected to '${ssid-}', update anyway (Y|n)?" choice
if [ ! "${choice}" = "y" -a ! "${choice}" = "Y" -a -n "${choice}" ]; then if [ ! "${choice}" = "y" -a ! "${choice}" = "Y" -a -n "${choice}" ]; then
exit exit
fi fi
@ -229,9 +205,9 @@ function wpa_restart () {
} }
function bat () { function bat () {
2>/dev/null command -v batcat && { batcat "${@}"; return 0; } 2>/dev/null command -v batcat && { $(type -P batcat) "${@}"; return 0; }
2>/dev/null command -v bat && { $(type -P bat) "${@}"; return 0; } 2>/dev/null command -v bat && { $(type -P bat) "${@}"; return 0; }
{ printf '%s\n' "bat not found"; return 1; } $(type -P cat) "${@}"
} }
function take () { function take () {
@ -300,7 +276,9 @@ function clone42 () {
} || { printf '%s\n' "Could not clone repo!"; } } || { printf '%s\n' "Could not clone repo!"; }
} }
# shellcheck disable=SC2016
############################# ENVIRONMENT ##########################
# sslslcheck disable=SC2016
export GIT_SSH_COMMAND='ssh -oIdentitiesOnly=yes -F"${HOME-}"/.ssh/config' export GIT_SSH_COMMAND='ssh -oIdentitiesOnly=yes -F"${HOME-}"/.ssh/config'
if [ ! "${TERM-}" = "linux" ] ; then if [ ! "${TERM-}" = "linux" ] ; then
if [ -f '/usr/share/terminfo/x/xterm-256color' ] ; then if [ -f '/usr/share/terminfo/x/xterm-256color' ] ; then
@ -315,17 +293,19 @@ if [ ! "${TERM-}" = "linux" ] ; then
export TERM='screen' export TERM='screen'
fi fi
fi fi
# # shellcheck disable=SC2155
# export VISUAL="$(2>/dev/null $(type -P nvim))" # shellcheck disable=SC2155
export VISUAL="vi" export VISUAL="$(2>/dev/null type -P nvim)"
# # shellcheck disable=SC2155 # shellcheck disable=SC2155
export EDITOR="vi" export EDITOR="$({ type -P nvim ||
# export EDITOR="$(2>/dev/null $(type -P vim) || type -P vim ||
# 2>/dev/null $(type -P vi) || type -P vi ||
# 2>/dev/null $(type -P nano) || type -P nvi ||
# 2>/dev/null $(type -P ed))" type -P hx ||
type -P nano ||
type -P ex ||
type -P ed; } 2>/dev/null)"
export SUDO_EDITOR="${EDITOR-}" export SUDO_EDITOR="${EDITOR-}"
export GIT_PS1_SHOWDIRTYSTATE='1'
export MANPAGER='nvim +Man!' export MANPAGER='nvim +Man!'
[ -z "${DISPLAY-}" ] && echo 'Warning: DISPLAY is not set' [ -z "${DISPLAY-}" ] && echo 'Warning: DISPLAY is not set'
@ -335,6 +315,7 @@ export MANPAGER='nvim +Man!'
# shellcheck disable=SC2016 # shellcheck disable=SC2016
# PS0='$(clear -x ; printf "${PS1@P}" ; fc -nl -1 | cut -c3- ; printf "\n")' # PS0='$(clear -x ; printf "${PS1@P}" ; fc -nl -1 | cut -c3- ; printf "\n")'
#### BASH PRE-EXEC #####
if [ ! -f "${HOME}"/.bash-preexec.sh ] ; then if [ ! -f "${HOME}"/.bash-preexec.sh ] ; then
curl --silent --location \ curl --silent --location \
"https://raw.githubusercontent.com/rcaloras\ "https://raw.githubusercontent.com/rcaloras\
@ -346,6 +327,7 @@ fi
. "${HOME}"/.bash-preexec.sh . "${HOME}"/.bash-preexec.sh
preexec() { preexec() {
history -a
TIMESTAMP_BEFORE="$(date +%s)" TIMESTAMP_BEFORE="$(date +%s)"
} }
precmd() { precmd() {
@ -368,6 +350,7 @@ precmd() {
fi fi
} }
GIT_PS1_SHOWDIRTYSTATE='1'
GIT_PROMPT="1" GIT_PROMPT="1"
if [ ! -f "${HOME}"/git-prompt.sh ] && [ "${GIT_PROMPT-}" = "1" ] ; then if [ ! -f "${HOME}"/git-prompt.sh ] && [ "${GIT_PROMPT-}" = "1" ] ; then
curl --silent --location \ curl --silent --location \
@ -405,49 +388,13 @@ if [ -f "${HOME}"/git-prompt.sh ] && [ -r "${HOME}"/git-prompt.sh ] && \
else else
PS1="${_PS1_1-}${_PS1_2-}" PS1="${_PS1_1-}${_PS1_2-}"
fi fi
######################### PROMPT STUFF END #######################
# Key Repeat/Delay Rate
2>/dev/null xset r rate 200 60
# Disable bell
2>/dev/null xset -b
# sudo kbdrate --rate=30.0 --delay=250
complete -C pomo pomo
eval "$(keyring --print-completion bash)"
# shellcheck disable=SC1091
if [ -f "${HOME}"/.userbashrc ]; then . "${HOME}"/.userbashrc; fi
# Simplified *Bash* Prompt, e.g. for tty/system/linux console # Simplified *Bash* Prompt, e.g. for tty/system/linux console
# unset PS0; PS1='\033[94m\u\033[37m@\033[32m\h\033[37m@\033[33m$(basename -- "$(tty)") \033[36m\w \033[35m\$\033[m ' # unset PROMPT_COMMAND PS0; PS1='\033[94m\u\033[37m@\033[32m\h\033[37m@\033[33m$(basename -- "$(tty)") \033[36m\w \033[35m\$\033[m '
push_swap_perf () {
url="${1}"
perf_dir="${2}"
[ -z "${url}" ] && { echo "Expected two parameters (url && perf_dir)" ; return ; }
[ -z "${perf_dir}" ] && { echo "Expected two parameters (url && perf_dir)" ; return ; }
rm -rf -- "${perf_dir}" || { echo "Couldn't return" ; return ; }
git clone --quiet --depth 1 "${url}" "${perf_dir}" || { echo "Couldn't clone" ; return ; }
[ -f "./stack_a.txt" ] || { echo "File ./stack_a.txt does not exist!" ; return ; }
stack_a_file="$(readlink -f -- "./stack_a.txt")"
2>/dev/null 1>/dev/null pushd -- "${perf_dir}" || { echo "Couldn't cd into '${perf_dir}'" ; return ; }
makefile_dir="$(find . -name Makefile | awk '{printf "%s|%s\n", $0, length($0)}' | sort -t'|' -k2,2g | head -1 | awk -F'|' '{print $1}' | xargs -r dirname)"
[ -z "${makefile_dir}" ] && { echo "No Makefile found" ; return ; }
2>/dev/null 1>/dev/null pushd -- "${makefile_dir}" || { echo "Couldn't cd into '${makefile_dir}'" ; return ; }
find . -type f -exec sed -i -e 's/-Werror//g' {} \;
find . -type f -exec sed -i -e 's/rewind/rewindx/g' {} \;
2>/dev/null 1>/dev/null make -j$(nproc) -i -k -s || { echo "Couldn't run make" ; return ; }
ops="$(2>/dev/null ./push_swap $(cat -- "${stack_a_file}") | wc -l)"
echo "ops;${ops}"
2>/dev/null 1>/dev/null popd
2>/dev/null 1>/dev/null popd
}
# Add these to your ~/.bash_aliases
############################# AOC ########################
AOC_DIR="${HOME}/projects/aoc" # remember to change this to whatever your AOC directory is AOC_DIR="${HOME}/projects/aoc" # remember to change this to whatever your AOC directory is
alias aos="python3 solution.py < in.txt" alias aos="python3 solution.py < in.txt"
alias aot="printf '\033[34m'; python3 solution.py < test.txt; printf '\033[m'" alias aot="printf '\033[34m'; python3 solution.py < test.txt; printf '\033[m'"
alias aoc="aot; echo; aos" alias aoc="aot; echo; aos"
@ -551,5 +498,17 @@ aocload () {
tmux send-keys "nvim './solution.py'" ENTER tmux send-keys "nvim './solution.py'" ENTER
} }
xmodmap ~/.Xmodmap ###################### GENERAL SETTINGS #######################
alias q='docker run --rm -it ghcr.io/natesales/q' tabs -4
set -o emacs
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# Key Repeat/Delay Rate
2>/dev/null xset r rate 200 60
# sudo kbdrate --rate=30.0 --delay=250
# Disable bell
2>/dev/null xset -b
# shellcheck disable=SC1091
if [ -f "${HOME}"/.userbashrc ]; then . "${HOME}"/.userbashrc; fi

View File

@ -86,7 +86,7 @@ null_ls.setup({
} }
}) })
-- require("norme").setup({ require("norme").setup({
-- -- Your configuration -- Your configuration
-- cmd = os.getenv('HOME') .. '/.local/bin/norminette' cmd = os.getenv('HOME') .. '/.local/bin/norminette'
-- }) })

View File

@ -1,32 +1,32 @@
--- require 'nvim-treesitter.configs'.setup { require 'nvim-treesitter.configs'.setup {
--- -- A list of parser names, or "all" (the five listed parsers should always be installed) -- A list of parser names, or "all" (the five listed parsers should always be installed)
--- ensure_installed = { "vimdoc", "javascript", "typescript", "python", "bash", "c", "lua", "vim", "vimdoc", "query" }, ensure_installed = { "vimdoc", "javascript", "typescript", "python", "bash", "c", "lua", "vim", "vimdoc", "query" },
---
--- -- Install parsers synchronously (only applied to `ensure_installed`) -- Install parsers synchronously (only applied to `ensure_installed`)
--- sync_install = false, sync_install = false,
---
--- -- Automatically install missing parsers when entering buffer -- Automatically install missing parsers when entering buffer
--- -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
--- auto_install = true, auto_install = true,
---
--- -- List of parsers to ignore installing (for "all") -- List of parsers to ignore installing (for "all")
--- ignore_install = { "help" }, ignore_install = { "help" },
---
--- highlight = { highlight = {
--- enable = true, enable = true,
---
--- -- Setting this to true will run `:h syntax` and tree-sitter at the same time. -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
--- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
--- -- Using this option may slow down your editor, and you may see some duplicate highlights. -- Using this option may slow down your editor, and you may see some duplicate highlights.
--- -- Instead of true it can also be a list of languages -- Instead of true it can also be a list of languages
--- additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
--- }, },
---
--- incremental_selection = { incremental_selection = {
--- enable = true, enable = true,
--- keymaps = { keymaps = {
--- node_incremental = "v", node_incremental = "v",
--- node_decremental = "V", node_decremental = "V",
--- }, },
--- }, },
--- } }

View File

@ -7,48 +7,48 @@ return require('packer').startup(function(use)
-- Packer can manage itself -- Packer can manage itself
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
use { use {
'nvim-telescope/telescope.nvim', tag = '0.1.2', 'nvim-telescope/telescope.nvim', tag = '0.1.2',
-- or , branch = '0.1.x', -- or , branch = '0.1.x',
requires = { { 'nvim-lua/plenary.nvim' } } requires = { { 'nvim-lua/plenary.nvim' } }
}
use({ 'rose-pine/neovim', as = 'rose-pine' })
use({ 'ellisonleao/gruvbox.nvim', as = 'gruvbox' })
use({ 'patstockwell/vim-monokai-tasty', as = 'monokai' })
use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
use('nvim-treesitter/playground')
use('ThePrimeagen/harpoon')
use('mbbill/undotree')
use('tpope/vim-fugitive')
use('vim-airline/vim-airline')
use('vim-airline/vim-airline-themes')
use('cacharle/c_formatter_42.vim')
-- use('m4xshen/autoclose.nvim')
use('takac/vim-hardtime')
use({
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
requires = {
-- LSP Support
{ 'neovim/nvim-lspconfig' }, -- Required
{ -- Optional
'williamboman/mason.nvim',
run = function()
pcall(vim.api.nvim_command, 'MasonUpdate')
end,
},
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
-- Autocompletion
{ 'hrsh7th/nvim-cmp' }, -- Required
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
{ 'L3MON4D3/LuaSnip' }, -- Required
} }
})
use({ use({ 'rose-pine/neovim', as = 'rose-pine' })
'vinicius507/norme.nvim', use({ 'ellisonleao/gruvbox.nvim', as = 'gruvbox' })
requires = { 'jose-elias-alvarez/null-ls.nvim' } use({ 'patstockwell/vim-monokai-tasty', as = 'monokai' })
})
use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
use('nvim-treesitter/playground')
use('ThePrimeagen/harpoon')
use('mbbill/undotree')
use('tpope/vim-fugitive')
use('vim-airline/vim-airline')
use('vim-airline/vim-airline-themes')
use('cacharle/c_formatter_42.vim')
-- use('m4xshen/autoclose.nvim')
use('takac/vim-hardtime')
use({
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
requires = {
-- LSP Support
{ 'neovim/nvim-lspconfig' }, -- Required
{ -- Optional
'williamboman/mason.nvim',
run = function()
pcall(vim.api.nvim_command, 'MasonUpdate')
end,
},
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
-- Autocompletion
{ 'hrsh7th/nvim-cmp' }, -- Required
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
{ 'L3MON4D3/LuaSnip' }, -- Required
}
})
use({
'vinicius507/norme.nvim',
requires = { 'jose-elias-alvarez/null-ls.nvim' }
})
end) end)

View File

@ -19,6 +19,8 @@ function log () {
bluetoothctl power on \ bluetoothctl power on \
&& bluetoothctl connect "${DEVICE_MAC}" && bluetoothctl connect "${DEVICE_MAC}"
pactl set-default-sink "${DEVICE_SINK}" || true
bluetoothctl connect "${DEVICE_MAC}" || bluetoothctl connect "${DEVICE_MAC}" ||
{ sleep 3; bluetoothctl connect "${DEVICE_MAC}"; } { sleep 3; bluetoothctl connect "${DEVICE_MAC}"; }

19
.local/bin/hist Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
command -v squote_escape >/dev/null 2>&1 || { echo "${0} depends on squote_escape"; exit 1; }
if [ -t 0 ] && [ -n "${1}" ]; then
query='find "${HOME}"/.better_bash_history/ -type f -exec cat {} \+'
while [ -n "${1}" ]; do
[ "${1}" = "-" ] && {
invert_flag="-v"; shift;
[ -n "${1}" ] || { echo "${0}: syntax error: expected pattern after minus"; exit 2; }
} || invert_flag=""
query="${query} | grep ${invert_flag} -F -- $(squote_escape "${1}")"
shift
done
eval "${query} | uniq | nl"
else
echo "${0} is not a filter"
fi

27
.local/bin/new_key.sh Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
usage () {
printf 'USAGE:\n\t%s DOMAIN NAME USER\n' "${0}"
}
domain="${1-}" # ex. nosu
name="${2-}" # ex. bastion
user="${3-}" # ex. root
[ -z "${domain-}" ] && { echo "Missing domain (1st argument)"; usage; exit 1; }
[ -z "${name-}" ] && { echo "Missing name (2st argument)"; usage; exit 2; }
[ -z "${user-}" ] && { echo "Missing user (3st argument)"; usage; exit 3; }
conn="${domain-}_${name-}_${user-}"
if [ -f ~/.ssh/"${domain-}"/"${conn-}" ]; then
echo "File already created, exiting."
exit 1
fi
echo "COPY THIS PASSWORD, IT WILL ONLY BE SHOWN ONCE"
pw="$(keepassxc-cli diceware --words 6 | tr ' ' '_')_A.1"
mkdir -p ~/.ssh/"${domain-}"/
ssh-keygen -q -t ed25519 -a 5 -N "${pw-}" -f ~/.ssh/"${domain-}"/"${conn-}" -C "tosuman@archtosu->${user-}@${conn-}"
echo "${pw-}"
echo -e "\033[32mSUCCESS\033[m"

10
.local/bin/squote_escape Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
if [ -t 0 ] && [ -n "${1}" ]; then
while [ -n "${1}" ]; do
printf '%s\n' "${1}" | sed "s/'/'"'"'"'"'"'"'/g; s/^/'/; s/$/'/"
shift
done
else
sed "s/'/'"'"'"'"'"'"'/g; s/^/'/; s/$/'/"
fi

View File

@ -57,4 +57,4 @@ bind-key -T prefix C-u popup -E '~/.local/bin/tmux_urls.py'
set-option -g set-titles on set-option -g set-titles on
run-shell ~/repos/tmux-copycat/copycat.tmux # run-shell ~/repos/tmux-copycat/copycat.tmux