mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 08:41:43 +05:30
# Tmux Config
- Added Catppuccin theme - Added kitty terminal config # Sync and Rectify Vim & NVIM - Undo files are incompatible between VIM & NVIM - saved those files separately - Keybinding for saving and quitting moved to VIM config - VIM & NVIM swapfiles removed - More VIM options set to enhance usability - Synced system vim config and keybindings with ideavimrc # Shell Script File Changes - Reverted to using `#!/bin/sh` as bash is slow and not POSIX compliant. - Reformatted
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -77,13 +77,8 @@ dist-ssr
|
||||
*.min.js
|
||||
|
||||
# Log files
|
||||
logs
|
||||
..logs/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Other Files to ignore
|
||||
**app_stat_v2.db
|
||||
|
||||
@@ -21,4 +21,3 @@ Example: bash ./bootstrap.sh -q --create-links
|
||||
I have multiple Linux installations on my machine. Linking it from one place (this repository) keeps things tidy. Also, changes to dotfiles automatically get applied to all the distros.
|
||||
|
||||
<!-- TODO: Move as many dotfiles inside ~/.config as possible -->
|
||||
|
||||
|
||||
62
bootstrap.sh
62
bootstrap.sh
@@ -1,19 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
if [ -n "$1" ]; then
|
||||
echo ""
|
||||
echo -e "${CRED}$1${CEND}\n"
|
||||
fi
|
||||
if [ -n "$1" ]; then
|
||||
echo ""
|
||||
echo -e "${CRED}$1${CEND}\n"
|
||||
fi
|
||||
|
||||
echo "Applies all settings stored in the script's directory to your home directory"
|
||||
echo ""
|
||||
echo "Usage: $0 [-q|--quiet] [-l|--create-links]"
|
||||
echo " -q, --quiet No screen outputs"
|
||||
echo " -l, --create-links Creates soft-links to files in the current directory instead of copying them"
|
||||
echo "Applies all settings stored in the script's directory to your home directory"
|
||||
echo ""
|
||||
echo "Usage: $0 [-q|--quiet] [-l|--create-links]"
|
||||
echo " -q, --quiet No screen outputs"
|
||||
echo " -l, --create-links Creates soft-links to files in the current directory instead of copying them"
|
||||
|
||||
echo ""
|
||||
echo "Example: $0 -q --create-links"
|
||||
echo ""
|
||||
echo "Example: $0 -q --create-links"
|
||||
}
|
||||
|
||||
##################################
|
||||
@@ -25,26 +25,26 @@ QUIET="n"
|
||||
CREATE_LINKS="n"
|
||||
|
||||
while [[ "${#}" -gt 0 ]]; do
|
||||
case $1 in
|
||||
-q | --quiet)
|
||||
QUIET="y"
|
||||
shift
|
||||
;;
|
||||
-l | --create-links)
|
||||
CREATE_LINKS="y"
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
echo
|
||||
usage
|
||||
echo
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage "Unknown parameter passed: $1" "h"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case $1 in
|
||||
-q | --quiet)
|
||||
QUIET="y"
|
||||
shift
|
||||
;;
|
||||
-l | --create-links)
|
||||
CREATE_LINKS="y"
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
echo
|
||||
usage
|
||||
echo
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage "Unknown parameter passed: $1" "h"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
main() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
# Generic
|
||||
alias sb="source ~/.bashrc"
|
||||
@@ -16,6 +16,7 @@ alias usersearch="awk -F: '{print \"UserName: \" \$1 \", UserID: \" \$3 \", Home
|
||||
alias untar='tar -zxvf '
|
||||
alias v=nvim
|
||||
alias n=nvim
|
||||
alias vim=nvim
|
||||
|
||||
url_encode(){
|
||||
python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.stdin.read()))" <<< "$1"
|
||||
@@ -58,7 +59,7 @@ alias p1="ping1"
|
||||
alias pubip="curl https://ipinfo.io/ip; echo"
|
||||
alias speedtest="speedtest-cli --secure" # needs speedtest-cli installed
|
||||
geoip () {
|
||||
curl -s https://ipinfo.io | sed '/readme/d;/loc/d;/postal/d;s/org/ISP/' | tr -d {},\" | awk -F ':' 'NF {printf ("%10s: %.25s \n", $1, $2)}'
|
||||
curl -s https://ipinfo.io | sed '/readme/d;/loc/d;/postal/d;s/org/ISP/' | tr -d {},\" | awk -F ':' 'NF {printf ("%10s: %.25s \n", $1, $2)}'
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +67,7 @@ geoip () {
|
||||
# To use this - Ensure all git server SSH are in ~/.ssh
|
||||
alias git_signin='(for i in ~/.ssh/{*github*,*gitea*}; do ssh-add -k $i; done; ) && (echo; echo Identities added successfully)'
|
||||
git_push_all_changes(){
|
||||
git add . && git commit -am "${1}" && git push
|
||||
git add . && git commit -am "${1}" && git push
|
||||
}
|
||||
|
||||
|
||||
|
||||
134
common/.bashrc
134
common/.bashrc
@@ -5,7 +5,7 @@
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
*) return ;;
|
||||
esac
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
@@ -29,7 +29,7 @@ fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
xterm-color|*-256color) color_prompt=yes ;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
@@ -39,12 +39,12 @@ esac
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -56,11 +56,11 @@ unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
@@ -95,11 +95,11 @@ fi
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
@@ -121,7 +121,7 @@ shopt -s nullglob
|
||||
shopt -s autocd
|
||||
|
||||
function timer_start {
|
||||
timer=${timer:-$SECONDS}
|
||||
timer=${timer:-$SECONDS}
|
||||
}
|
||||
|
||||
trap 'timer_start' DEBUG
|
||||
@@ -129,62 +129,62 @@ trap 'timer_start' DEBUG
|
||||
PROMPT_COMMAND=jazz_my_prompt
|
||||
|
||||
jazz_my_prompt() {
|
||||
# Capture exit code of last command
|
||||
# Below MUST be the 1st line of the function
|
||||
local ex=$?
|
||||
# Capture exit code of last command
|
||||
# Below MUST be the 1st line of the function
|
||||
local ex=$?
|
||||
|
||||
# Capture the last command's execution time
|
||||
timer_show=$(($SECONDS - $timer))
|
||||
unset timer
|
||||
# Capture the last command's execution time
|
||||
timer_show=$(($SECONDS - $timer))
|
||||
unset timer
|
||||
|
||||
#----------------------------------------------------------------------------#
|
||||
# Bash text colour specification: \e[<COLOUR>;<STYLE>m
|
||||
# Colours: 31=red, 32=green, 33=yellow, 34=blue, 35=purple, 36=cyan, 37=white
|
||||
# Styles: 0=normal, 1=bold, 2=dimmed, 4=underlined, 7=highlighted
|
||||
#----------------------------------------------------------------------------#
|
||||
#----------------------------------------------------------------------------#
|
||||
# Bash text colour specification: \e[<COLOUR>;<STYLE>m
|
||||
# Colours: 31=red, 32=green, 33=yellow, 34=blue, 35=purple, 36=cyan, 37=white
|
||||
# Styles: 0=normal, 1=bold, 2=dimmed, 4=underlined, 7=highlighted
|
||||
#----------------------------------------------------------------------------#
|
||||
|
||||
local reset="\[\e[0m\]"
|
||||
local normal=';0m'
|
||||
local bold=';1m'
|
||||
local boldyellow="\[\e[32${bold}\]"
|
||||
local boldwhite="\[\e[37${bold}\]"
|
||||
local normalwhite="\[\e[37${normal}\]"
|
||||
local yellow_highlight="\[\e[31;7m\]"
|
||||
local reset="\[\e[0m\]"
|
||||
local normal=';0m'
|
||||
local bold=';1m'
|
||||
local boldyellow="\[\e[32${bold}\]"
|
||||
local boldwhite="\[\e[37${bold}\]"
|
||||
local normalwhite="\[\e[37${normal}\]"
|
||||
local yellow_highlight="\[\e[31;7m\]"
|
||||
|
||||
# Add color preference BEFORE the item
|
||||
local hostname="${normalwhite}\h"
|
||||
local username="${boldwhite}\u"
|
||||
local jobs="${boldwhite}jobs:\j"
|
||||
local history_cnt="${normalwhite}!\!"
|
||||
local timestamp="${normalwhite}\D{%H:%M:%S(%z) %d%b}"
|
||||
local session_cmd_cnt="${normalwhite}#\#"
|
||||
local pwd="${boldwhite}\w"
|
||||
local isroot="${boldwhite}\$"
|
||||
# Add color preference BEFORE the item
|
||||
local hostname="${normalwhite}\h"
|
||||
local username="${boldwhite}\u"
|
||||
local jobs="${boldwhite}jobs:\j"
|
||||
local history_cnt="${normalwhite}!\!"
|
||||
local timestamp="${normalwhite}\D{%H:%M:%S(%z) %d%b}"
|
||||
local session_cmd_cnt="${normalwhite}#\#"
|
||||
local pwd="${boldwhite}\w"
|
||||
local isroot="${boldwhite}\$"
|
||||
|
||||
# Set prompt content
|
||||
# If exit code of last command is non-zero, prepend this code to the prompt
|
||||
local exit_code=''
|
||||
if [[ "$ex" -eq 0 ]]
|
||||
then
|
||||
exit_code="${boldwhite}✓"
|
||||
else
|
||||
exit_code="${yellow_highlight}✗ $ex\a${reset}"
|
||||
fi
|
||||
# Set prompt content
|
||||
# If exit code of last command is non-zero, prepend this code to the prompt
|
||||
local exit_code=''
|
||||
if [[ "$ex" -eq 0 ]]
|
||||
then
|
||||
exit_code="${boldwhite}✓"
|
||||
else
|
||||
exit_code="${yellow_highlight}✗ $ex\a${reset}"
|
||||
fi
|
||||
|
||||
# Style each group separately
|
||||
local groupstart="${boldyellow}["
|
||||
local groupend="${boldyellow}]"
|
||||
group1="${groupstart}${username}@${hostname}${groupend}"
|
||||
group2="${groupstart}${jobs}${groupend}"
|
||||
group3="${groupstart}${history_cnt}${groupend}"
|
||||
group4="${groupstart}${session_cmd_cnt}${groupend}"
|
||||
group5="${groupstart}${timestamp}${groupend}"
|
||||
group6="${groupstart}${exit_code}${groupend}"
|
||||
group8="${groupstart}${pwd}${groupend}"
|
||||
group9="${groupstart}${normalwhite}${timer_show}s${groupend}"
|
||||
# Style each group separately
|
||||
local groupstart="${boldyellow}["
|
||||
local groupend="${boldyellow}]"
|
||||
group1="${groupstart}${username}@${hostname}${groupend}"
|
||||
group2="${groupstart}${jobs}${groupend}"
|
||||
group3="${groupstart}${history_cnt}${groupend}"
|
||||
group4="${groupstart}${session_cmd_cnt}${groupend}"
|
||||
group5="${groupstart}${timestamp}${groupend}"
|
||||
group6="${groupstart}${exit_code}${groupend}"
|
||||
group8="${groupstart}${pwd}${groupend}"
|
||||
group9="${groupstart}${normalwhite}${timer_show}s${groupend}"
|
||||
|
||||
# Position each group where you would like them
|
||||
PS1="\n${group1}-${group2}-${group3}-${group4}-${group5}\n${group6}-${group9}-${group8}\n${isroot}${reset} "
|
||||
# Position each group where you would like them
|
||||
PS1="\n${group1}-${group2}-${group3}-${group4}-${group5}\n${group6}-${group9}-${group8}\n${isroot}${reset} "
|
||||
}
|
||||
|
||||
# Setup path and export variables
|
||||
|
||||
2583
common/.config/kitty/kitty.conf
Normal file
2583
common/.config/kitty/kitty.conf
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,3 @@
|
||||
-- Nvim Specific Configs that don't apply to VIM
|
||||
vim.opt.undodir = vim.fn.stdpath("config") .. "/undo"
|
||||
vim.opt.backupdir = vim.fn.stdpath("config") .. "/backup/"
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
-- <Ctrl-Alt-s> -> to save all files
|
||||
vim.keymap.set({ "n", "i", "v" }, "<C-M-s>", "<cmd>wa<CR>", {})
|
||||
-- <Ctrl-q> -> Save all files and quit Nvim
|
||||
vim.keymap.set({ "n", "i", "v" }, "<C-q>", "<cmd>wqa<CR>", {})
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
""""""""""""""""""""""""""""""""""""""
|
||||
"
|
||||
" Source common configs from VIM
|
||||
" Source common keymaps & configs from VIM
|
||||
"
|
||||
""""""""""""""""""""""""""""""""""""""
|
||||
let $VIMDIR="$HOME/.vim"
|
||||
let $NVIMDIR="$HOME/.config/nvim"
|
||||
|
||||
" Load VIM Configurations
|
||||
source $VIMDIR/configs.vim
|
||||
@@ -14,4 +13,3 @@ source $VIMDIR/key_maps.vim
|
||||
|
||||
" Save session files to $HOME/.vim/session directory
|
||||
let g:session_dir="$VIMDIR/session"
|
||||
|
||||
|
||||
@@ -79,6 +79,9 @@ set -g @resurrect-capture-pane-contents "on"
|
||||
set -g @resurrect-strategy-nvim "session"
|
||||
set -g @resurrect-dir "$HOME/.config/tmux/resurrect"
|
||||
|
||||
# Don't exit tmux when closing a session
|
||||
set -g detach-on-destroy off
|
||||
|
||||
#========================================================
|
||||
# APPEARANCE
|
||||
#========================================================
|
||||
@@ -89,7 +92,8 @@ set -g renumber-windows on
|
||||
set-window-option -g pane-base-index 1
|
||||
|
||||
# Improve colors
|
||||
set -g default-terminal "xterm-256color"
|
||||
set -g default-terminal "${TERM}"
|
||||
set-option -g default-terminal "xterm-256color"
|
||||
set-option -sa terminal-overrides ",xterm*:Tc"
|
||||
|
||||
# Status at top
|
||||
@@ -101,23 +105,38 @@ set -g status-position top
|
||||
run "~/.config/tmux/plugins/tpm/tpm" # Init Tmux Plugin Manager
|
||||
|
||||
# TODO: Get into Tmux copy stuff when required
|
||||
# set -g @plugin 'tmux-plugins/tmux-yank'
|
||||
# set -g @plugin "tmux-plugins/tmux-copycat"
|
||||
|
||||
set -g @plugin "christoomey/vim-tmux-navigator" # sync pane nav with Vim window nav
|
||||
set -g @plugin "tmux-plugins/tmux-resurrect" # Persist sessions
|
||||
set -g @plugin "tmux-plugins/tmux-continuum" # Auto save sessions every 15mins
|
||||
set -g @plugin 'tmux-plugins/tmux-yank'
|
||||
set -g @plugin "tmux-plugins/tmux-copycat"
|
||||
set -g @plugin "fabioluciano/tmux-tokyo-night"
|
||||
set -g @plugin "catppuccin/tmux"
|
||||
|
||||
#========================================================
|
||||
# PLUGINS Configurations
|
||||
#========================================================
|
||||
|
||||
# Color schemes
|
||||
set -g @theme_variation "night"
|
||||
set -g @theme_disable_plugins 1
|
||||
set -g status-right ""
|
||||
set -g @catppuccin_flavour "mocha"
|
||||
|
||||
set -g @catppuccin_window_left_separator ""
|
||||
set -g @catppuccin_window_right_separator " "
|
||||
set -g @catppuccin_window_middle_separator " █"
|
||||
set -g @catppuccin_status_left_separator " "
|
||||
set -g @catppuccin_status_right_separator " "
|
||||
set -g @catppuccin_status_right_separator_inverse "no"
|
||||
|
||||
set -g @catppuccin_status_fill "icon"
|
||||
set -g @catppuccin_window_current_text "#W"
|
||||
set -g @catppuccin_window_current_fill "number"
|
||||
set -g @catppuccin_window_default_text "#W"
|
||||
set -g @catppuccin_window_default_fill "number"
|
||||
set -g @catppuccin_window_status_enable "yes"
|
||||
set -g @catppuccin_window_status_icon_enable "yes"
|
||||
set -g @catppuccin_window_number_position "right"
|
||||
set -g @catppuccin_status_connect_separator "no"
|
||||
set -g @catppuccin_directory_text "#{pane_current_path}"
|
||||
set -g @catppuccin_status_modules_right "session directory"
|
||||
|
||||
set -g @plugin "tmux-plugins/tpm"
|
||||
|
||||
@@ -6,7 +6,7 @@ return {
|
||||
font = wezterm.font_with_fallback({
|
||||
-- "JetBrains Mono",
|
||||
"JetBrainsMono Nerd Font",
|
||||
{ family = "Symbols Nerd Font Mono", scale = 0.75 }
|
||||
{ family = "Symbols Nerd Font Mono", scale = 0.75 },
|
||||
}),
|
||||
window_decorations = "RESIZE",
|
||||
enable_tab_bar = true,
|
||||
@@ -36,7 +36,7 @@ return {
|
||||
event = { Up = { streak = 1, button = "Left" } },
|
||||
mods = "CTRL",
|
||||
action = wezterm.action.OpenLinkAtMouseCursor,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
force_reverse_video_cursor = true,
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
"source ~/.vimrc
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
source ~/.vim/configs.vim
|
||||
source ~/.vim/key_maps.vim
|
||||
|
||||
" Set Tabs to 4 characters
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
@@ -19,13 +22,8 @@ set incsearch " show search results while typing
|
||||
set wrapscan " searches wrap around the end of the file
|
||||
|
||||
" Common settings
|
||||
set number " Show current line number
|
||||
set relativenumber " Show relative line numbers
|
||||
set gdefault " substitute all occurrences in line
|
||||
set history=10000 " command line history
|
||||
set scrolloff=5 sidescrolloff=10 " Keep some line before and after the cursor visible
|
||||
set clipboard^=unnamed,unnamedplus,ideaput " Copy to and from system clipboard
|
||||
set nrfomats+=alpha,bin,octal,hex " Useful for auto incrementing
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Enabled plugins
|
||||
@@ -41,31 +39,16 @@ Plug 'tpope/vim-repeat' " Repeat for Surround
|
||||
" Plug 'terryma/vim-multiple-cursors' " mc (selects), mx (skips), mp (previous)
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" To see a list of all available :actions -> :actionlist
|
||||
" Or select "IdeaVim: Track Action Ids" -> Copy the action id required
|
||||
" Keymaps
|
||||
let mapleader = " "
|
||||
|
||||
" Don't use Ex mode, use Q for formatting
|
||||
map Q gq
|
||||
|
||||
" Map <leader>d to start debug
|
||||
"map <leader>d <Action>(Debug)
|
||||
" Map \b to toggle breakpoint
|
||||
"map \b <Action>(ToggleLineBreakpoint)
|
||||
|
||||
" Center the cursor when doing 1/2 page down and page up
|
||||
nnoremap <C-d> <C-d>zz
|
||||
nnoremap <C-u> <C-u>zz
|
||||
|
||||
" Multiple Cursors
|
||||
map mc <A-n>
|
||||
map mx <A-x>
|
||||
map mp <A-p>
|
||||
|
||||
" Clear search highlighting
|
||||
nnoremap <leader>/ :nohls<return><esc>
|
||||
|
||||
" Find/Open file
|
||||
nmap <leader>of :action GotoFile<CR>
|
||||
nmap <leader>or :action RecentFiles<CR>
|
||||
|
||||
3126
common/.p10k.zsh
3126
common/.p10k.zsh
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -25,6 +25,3 @@ fi
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
# Remap caps lock to escape
|
||||
setxkbmap -option caps:escape
|
||||
@@ -4,25 +4,28 @@ set omnifunc=syntaxcomplete#Complete
|
||||
set complete+=kspell
|
||||
set complete-=i
|
||||
set completeopt="menuone,noselect"
|
||||
set wildmenu " List and cycle through autocomplete on <Tab>
|
||||
set wildignorecase " Case insensitive path completion
|
||||
|
||||
" Make sure tabs are 4 character wide
|
||||
set shiftwidth=4 tabstop=4 softtabstop=4 expandtab smarttab
|
||||
set autoindent smartindent breakindent
|
||||
|
||||
syntax on " syntax highlighting.
|
||||
syntax on " Syntax highlighting.
|
||||
syntax enable
|
||||
set cursorline " Hightlight cursor line
|
||||
set showmatch " Highlight matching braces
|
||||
set ls=2 " Show a status line
|
||||
set wrap " Wrap text
|
||||
set wildmenu " Makes the ex command mode autocomplete paths with Tab
|
||||
set number " Show line numbers
|
||||
set cursorline " Hightlight cursor line
|
||||
set showmatch " Highlight matching braces
|
||||
set noshowmode " Donot write "--INSERT--" etc.
|
||||
set showcmd " Write out commands on status line
|
||||
set ls=2 " Show a status line
|
||||
set wrap " Wrap text
|
||||
set number " Show line numbers
|
||||
set ruler
|
||||
set relativenumber " Relative line numbers
|
||||
set shortmess+=I " Disable the default Vim startup message.
|
||||
set relativenumber " Relative line numbers
|
||||
set shortmess+=I " Disable the default Vim startup message.
|
||||
set noerrorbells visualbell t_vb= " Disable audible bell because it's annoying.
|
||||
set mouse+=a " Enable mouse support
|
||||
set encoding=utf-8 " Encoding
|
||||
set mouse+=a " Enable mouse support
|
||||
set encoding=utf-8 " Encoding
|
||||
set autoread
|
||||
set nrformats-=octal
|
||||
set formatoptions+=j
|
||||
@@ -39,11 +42,10 @@ set signcolumn=yes
|
||||
set scrolloff=5
|
||||
set isfname+={,},@-@
|
||||
set updatetime=50
|
||||
|
||||
" Enable undofile and save them in ~/.vim/undo
|
||||
set undofile " Enable undofiles
|
||||
set undodir=$HOME/.vim/undo// " Save in each project's root
|
||||
set directory^=$HOME/.vim/swap// " All swap files at the one place please
|
||||
set noswapfile
|
||||
set undofile
|
||||
set undolevels=10000
|
||||
set undoreload=100000
|
||||
|
||||
" Vim, by default, won't let you jump to a different file without saving the
|
||||
" current one. With the below, unsaved files are just hidden.
|
||||
@@ -56,8 +58,8 @@ set incsearch hlsearch ignorecase smartcase
|
||||
hi Comment guifg=#5C6370 ctermfg=50 cterm=italic
|
||||
|
||||
" Highlight and remove trailing blank spaces on save
|
||||
match ExtraWhitespace /\s\+$/
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
match ExtraWhitespace /\s\+$/
|
||||
autocmd BufWritePre * %s/\s\+$//e
|
||||
|
||||
" Vim is based on Vi. Setting `nocompatible` switches from the default
|
||||
@@ -87,3 +89,6 @@ if !has('gui_running')
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
" NERDTree Plugin configurations
|
||||
let g:NERDTreeShowHidden = 1
|
||||
let g:NERDTreeWinSize = 25
|
||||
|
||||
@@ -58,9 +58,10 @@ map <leader>j <Plug>(easymotion-s)
|
||||
" Map nerdtree to <Leader>e
|
||||
" Changes the pwd and opens the VCS root
|
||||
nnoremap <leader>e :tcd %:h<CR> :NERDTreeToggleVCS<CR>
|
||||
let g:NERDTreeShowHidden = 1
|
||||
let g:NERDTreeWinSize = 25
|
||||
|
||||
" <ctrl-q> to save everything and quit Neovim
|
||||
nnoremap <C-q> :wqa<CR>
|
||||
vnoremap <C-q> :wqa<CR>
|
||||
nnoremap <C-s> :wa<CR>
|
||||
vnoremap <C-s> :wa<CR>
|
||||
|
||||
|
||||
@@ -30,3 +30,6 @@ colorscheme deep-space
|
||||
" Auto reload .vimrc
|
||||
autocmd! bufwritepost $VIMRC source %
|
||||
|
||||
" Save inside vim config directory
|
||||
set undodir=$VIMDIR/undo//
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Initialization code that may require console input (password prompts, [y/n]
|
||||
# confirmations, etc.) must go above this block; everything else may go below.
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
|
||||
# If you come from bash you might have to change your $PATH.
|
||||
@@ -51,17 +51,17 @@ HIST_STAMPS="dd.mm.yyyy"
|
||||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
||||
# source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
plugins=(
|
||||
git
|
||||
docker
|
||||
history
|
||||
per-directory-history
|
||||
perms
|
||||
sudo
|
||||
systemd
|
||||
zsh-syntax-highlighting
|
||||
zsh-autosuggestions
|
||||
vi-mode
|
||||
# exercism
|
||||
git
|
||||
docker
|
||||
history
|
||||
per-directory-history
|
||||
perms
|
||||
sudo
|
||||
systemd
|
||||
zsh-syntax-highlighting
|
||||
zsh-autosuggestions
|
||||
vi-mode
|
||||
# exercism
|
||||
)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
# Directories and Directory listings
|
||||
dir_size(){
|
||||
local dir
|
||||
if [[ -z "$1" ]]; then
|
||||
dir="${PWD}"
|
||||
else
|
||||
dir="$1"
|
||||
fi
|
||||
local dir
|
||||
if [[ -z "$1" ]]; then
|
||||
dir="${PWD}"
|
||||
else
|
||||
dir="$1"
|
||||
fi
|
||||
|
||||
du -ah "${dir}" --max-depth=1 | sort -hr
|
||||
du -ah "${dir}" --max-depth=1 | sort -hr
|
||||
}
|
||||
|
||||
|
||||
@@ -42,38 +42,38 @@ alias fpmreset73="sudo systemctl restart php7.3-fpm"
|
||||
alias fpmreset74="sudo systemctl restart php7.4-fpm"
|
||||
|
||||
f2b_banned_ips() {
|
||||
local provided_jail=$1
|
||||
local provided_jail=$1
|
||||
|
||||
if [[ -n "${provided_jail// /}" ]]; then
|
||||
for ip in $(sudo fail2ban-client status "${provided_jail}" | tail -1 | sed 's/[^:]*://;s/\s*//')
|
||||
do
|
||||
printf "%17s\n" "$ip"
|
||||
done
|
||||
else
|
||||
local total_ips_banned=0
|
||||
for JAIL in $(sudo fail2ban-client status | tail -1 | sed 's/[^:]*://;s/\s*//;s/,//g')
|
||||
do
|
||||
local banned_ip_count
|
||||
banned_ip_count=$(sudo fail2ban-client status "${JAIL}" | grep -oP 'Currently banned:\s*\K\d+')
|
||||
if [[ -n "${provided_jail// /}" ]]; then
|
||||
for ip in $(sudo fail2ban-client status "${provided_jail}" | tail -1 | sed 's/[^:]*://;s/\s*//')
|
||||
do
|
||||
printf "%17s\n" "$ip"
|
||||
done
|
||||
else
|
||||
local total_ips_banned=0
|
||||
for JAIL in $(sudo fail2ban-client status | tail -1 | sed 's/[^:]*://;s/\s*//;s/,//g')
|
||||
do
|
||||
local banned_ip_count
|
||||
banned_ip_count=$(sudo fail2ban-client status "${JAIL}" | grep -oP 'Currently banned:\s*\K\d+')
|
||||
|
||||
if [[ "${banned_ip_count}" -gt 0 ]]; then
|
||||
echo "${JAIL}: ${banned_ip_count}"
|
||||
if [[ "${banned_ip_count}" -gt 0 ]]; then
|
||||
echo "${JAIL}: ${banned_ip_count}"
|
||||
|
||||
for ip in $(sudo fail2ban-client status "${JAIL}" | tail -1 | sed 's/[^:]*://;s/\s*//')
|
||||
do
|
||||
printf "%17s\n" "[$ip]"
|
||||
done
|
||||
for ip in $(sudo fail2ban-client status "${JAIL}" | tail -1 | sed 's/[^:]*://;s/\s*//')
|
||||
do
|
||||
printf "%17s\n" "[$ip]"
|
||||
done
|
||||
|
||||
total_ips_banned=$(( total_ips_banned + banned_ip_count ))
|
||||
total_ips_banned=$(( total_ips_banned + banned_ip_count ))
|
||||
|
||||
echo
|
||||
else
|
||||
echo -e "${JAIL}:\n -None-\n"
|
||||
fi
|
||||
done
|
||||
echo
|
||||
else
|
||||
echo -e "${JAIL}:\n -None-\n"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Total IPs banned across all jails - ${total_ips_banned}"
|
||||
fi
|
||||
echo "Total IPs banned across all jails - ${total_ips_banned}"
|
||||
fi
|
||||
}
|
||||
|
||||
f2b_unban_ip() {
|
||||
@@ -90,7 +90,7 @@ f2b_unban_ip() {
|
||||
for JAIL in $(sudo fail2ban-client status | tail -1 | sed 's/[^:]*://;s/\s*//;s/,//g')
|
||||
do
|
||||
local banned_ip_count
|
||||
banned_ip_count=$(sudo fail2ban-client status "${JAIL}" | grep -oP 'Currently banned:\s*\K\d+')
|
||||
banned_ip_count=$(sudo fail2ban-client status "${JAIL}" | grep -oP 'Currently banned:\s*\K\d+')
|
||||
if [[ "$banned_ip_count" -gt 0 ]] && [[ $(sudo fail2ban-client status "${JAIL}") == *"${ip_to_unban}"* ]]; then
|
||||
local found_ip="true"
|
||||
echo "Unbanning from ${JAIL}:"
|
||||
@@ -99,21 +99,21 @@ f2b_unban_ip() {
|
||||
done
|
||||
|
||||
if [[ -z "${found_ip// /}" ]]; then
|
||||
echo "${ip_to_unban} was not found in any banned lists."
|
||||
echo "No action taken."
|
||||
echo "${ip_to_unban} was not found in any banned lists."
|
||||
echo "No action taken."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
f2b_ban_an_ip(){
|
||||
local ip_to_ban=$1
|
||||
local ban_jail=$2
|
||||
local ip_to_ban=$1
|
||||
local ban_jail=$2
|
||||
|
||||
if [[ ( -z "${ip_to_ban// /}" ) || ( -z "${ban_jail// /}" ) ]]; then
|
||||
echo "Please provide an IP and a Jail (in that order)"
|
||||
echo -e "eg -\n\t f2b_ban_an_ip 1.1.1.1 sshd"
|
||||
return 1
|
||||
fi
|
||||
if [[ ( -z "${ip_to_ban// /}" ) || ( -z "${ban_jail// /}" ) ]]; then
|
||||
echo "Please provide an IP and a Jail (in that order)"
|
||||
echo -e "eg -\n\t f2b_ban_an_ip 1.1.1.1 sshd"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sudo fail2ban-client set "${ban_jail}" banip "${ip_to_ban}" > /dev/null && echo "Ban successful"
|
||||
}
|
||||
sudo fail2ban-client set "${ban_jail}" banip "${ip_to_ban}" > /dev/null && echo "Ban successful"
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
# Directories and Directory listings
|
||||
dir_size(){
|
||||
local dir
|
||||
if [[ -z "$1" ]]; then
|
||||
dir="${PWD}"
|
||||
else
|
||||
dir="$1"
|
||||
fi
|
||||
local dir
|
||||
if [[ -z "$1" ]]; then
|
||||
dir="${PWD}"
|
||||
else
|
||||
dir="$1"
|
||||
fi
|
||||
|
||||
du -ah "${dir}" -d 1 | sort -hr
|
||||
du -ah "${dir}" -d 1 | sort -hr
|
||||
}
|
||||
|
||||
|
||||
# Update & Upgrades
|
||||
alias up="brew upgrade --cask && brew upgrade --formula && rustup update && npm update -g"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user