nvim no-padding alacritty

This commit is contained in:
nomadics9 2024-11-27 14:30:39 +00:00
parent e52d84e1ea
commit 72dbb80247
2 changed files with 66 additions and 0 deletions

View file

@ -894,3 +894,29 @@ require('lazy').setup({
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
-- Function to update padding in the Alacritty configuration
local function update_padding(line_nr, from, to, file_path)
vim.cmd(string.format("silent !sed -i '%ss/%s/%s/' %s", line_nr, from, to, file_path))
end
-- Function to increase padding (on VimLeavePre)
local function increase_padding()
update_padding('07', '0', '20', '~/.config/alacritty/alacritty.yml')
update_padding('08', '0', '20', '~/.config/alacritty/alacritty.yml')
end
-- Function to decrease padding (on VimEnter)
local function decrease_padding()
update_padding('07', '20', '0', '~/.config/alacritty/alacritty.yml')
update_padding('08', '20', '0', '~/.config/alacritty/alacritty.yml')
end
-- Autocommands to adjust padding on VimEnter and VimLeavePre
vim.cmd [[
augroup ChangeAlacrittyPadding
autocmd!
autocmd VimEnter * lua decrease_padding()
autocmd VimLeavePre * lua increase_padding()
augroup END
]]

40
scripts/timechange Executable file
View file

@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Check if IP argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <NTP_SERVER_IP>"
exit 1
fi
# Set the NTP server IP
NTP_SERVER="$1"
# Stop ntpd service
echo "Stopping ntpd service..."
sudo systemctl stop ntpd
# Sync time using ntpdate
echo "Synchronizing time with $NTP_SERVER..."
sudo ntpdate "$NTP_SERVER"
# Prompt for setting time zone
echo "Please enter the desired time zone (e.g., UTC, Asia/Kuwait):"
read -r TIMEZONE
# Set the time zone
if sudo timedatectl set-timezone "$TIMEZONE"; then
echo "Time zone set to $TIMEZONE."
else
echo "Failed to set time zone to $TIMEZONE. Please ensure the input is correct."
exit 1
fi
# Start ntpd service
echo "Starting ntpd service..."
sudo systemctl start ntpd
# Display the current time settings
echo "Time synchronized successfully with $NTP_SERVER and time zone set to $TIMEZONE."
timedatectl