diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml index f461fc2..f3b966c 100644 --- a/.config/alacritty/alacritty.toml +++ b/.config/alacritty/alacritty.toml @@ -1,6 +1,3 @@ -import = [ - "~/.config/alacritty/themes/kanagawa_wave.toml" -] [env] TERM = "xterm-256color" @@ -28,3 +25,8 @@ style = "Regular" action = "SpawnNewInstance" key = "Return" mods = "Control|Shift" + +[general] +import = [ + "~/.config/alacritty/themes/kanagawa_wave.toml" +] diff --git a/.config/nvim/lua/core/autocmd.lua b/.config/nvim/lua/core/autocmd.lua index 8e6348f..ddac426 100644 --- a/.config/nvim/lua/core/autocmd.lua +++ b/.config/nvim/lua/core/autocmd.lua @@ -1,4 +1,30 @@ local aucmd_dict = { + VimEnter = { + { + callback = function() + local function find_project_root() + local current_dir = vim.fn.getcwd() + + while current_dir ~= "/" do + if vim.fn.isdirectory(current_dir .. "/.git") == 1 or vim.fn.filereadable(current_dir .. "/.nvim.lua") then + return current_dir + end + current_dir = vim.fn.fnamemodify(current_dir, ":h") + end + + return vim.fn.getcwd() + end + + local project_root = find_project_root() + local project_specific_conf_file = project_root .. "/.nvim.lua" + + if vim.fn.filereadable(project_specific_conf_file) == 1 then + vim.cmd("source " .. project_specific_conf_file) + print("Sourced project specific config file: " .. project_specific_conf_file) + end + end + } + }, FileType = { { -- Set tabstop to 2 for Dart, Vue, JavaScript, TypeScript, and JSON files diff --git a/.config/nvim/lua/core/commands.lua b/.config/nvim/lua/core/commands.lua index ca153e3..6614fc5 100644 --- a/.config/nvim/lua/core/commands.lua +++ b/.config/nvim/lua/core/commands.lua @@ -24,59 +24,3 @@ vim.api.nvim_create_user_command("ClearBuffers", function() vim.cmd('%bd|e#|bd#') end, {}) - -local function load_env_file() - local env_file_path = vim.fn.getcwd() .. "/.env" -- Construct the path relative to the current working directory - local env_file = io.open(env_file_path, "r") -- Open the .env file - - if not env_file then - print("Could not open .env file") - return - end - - for line in env_file:lines() do - local key, value = line:match("^(%S+)=(%S+)") - if key and value then - vim.env[key] = value - end - end - env_file:close() -end - -local function sync_file_to_sftp() - load_env_file() - - -- Get SFTP credentials from environment variables - local sftp_user = os.getenv("SFTP_USER") - local sftp_host = os.getenv("SFTP_HOST") - local sftp_port = os.getenv("SFTP_PORT") - local sftp_password = os.getenv("SFTP_PASSWORD") - local sftp_theme_directory = os.getenv("SFTP_THEME_DIRECTORY") - - local current_file = vim.fn.expand("%:p") -- Get the full path of the current file - - -- Define your project root path - local project_root = vim.fn.getcwd() -- Current working directory where Neovim was launched - local relative_path = current_file:sub(#project_root + 1) - - -- Construct the full remote path - local remote_path = sftp_theme_directory .. relative_path -- Append the relative path to the remote base path - - -- Command to sync the file using lftp - local lftp_cmd = string.format( - "lftp -u %s,%s sftp://%s:%s -e 'put %s -o %s; bye' > /dev/null 2>&1", - sftp_user, - sftp_password, - sftp_host, - sftp_port, - current_file, - remote_path - ) - - -- Execute the command - os.execute(lftp_cmd) - print("File synced to SFTP server: " .. remote_path) -end - --- Map the function to a command in Neovim -vim.api.nvim_create_user_command("SyncToNeto", sync_file_to_sftp, {}) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index e8fd1e0..a2ca0ef 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -114,11 +114,5 @@ if [ -f "$HOME/.cargo/env" ]; then . "$HOME/.cargo/env" fi -if type "pyenv" > /dev/null; then - export PYENV_ROOT="$HOME/.pyenv" - [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" - eval "$(pyenv init -)" -fi - # Speed debugging # zprof diff --git a/.local/bin/remap-keys b/.local/bin/remap-keys new file mode 100755 index 0000000..d4e6357 --- /dev/null +++ b/.local/bin/remap-keys @@ -0,0 +1,13 @@ +#!/bin/bash + +# Get current state of Caps Lock and Escape key swap +current_state=$(setxkbmap -query | grep options | grep "caps:escape" | wc -l) + +# If the swap is off, turn it on; otherwise, turn it off +if [ $current_state -eq 0 ]; then + echo "Swapping Caps Lock and Escape..." + setxkbmap -option caps:escape +else + echo "Reverting to normal layout..." + setxkbmap -option +fi