more refinement
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
lazy-lock.json
|
lazy-lock.json
|
||||||
|
.gitconfig.local
|
||||||
|
|||||||
36
README.md
36
README.md
@@ -24,6 +24,42 @@
|
|||||||
- shellcheck
|
- shellcheck
|
||||||
- bash-language-server
|
- bash-language-server
|
||||||
- terraform
|
- terraform
|
||||||
|
- terraform-ls
|
||||||
- tflint
|
- tflint
|
||||||
- ruff
|
- ruff
|
||||||
- cbonsai
|
- cbonsai
|
||||||
|
|
||||||
|
# Git Configuration
|
||||||
|
|
||||||
|
This directory contains Git configuration files that can be safely shared in a
|
||||||
|
public repository.
|
||||||
|
|
||||||
|
## Setup Instructions
|
||||||
|
|
||||||
|
1. Create a symbolic link for the main Git config:
|
||||||
|
|
||||||
|
```
|
||||||
|
ln -sf ~/dotfiles/git/.gitconfig ~/.gitconfig
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Create your personal Git configuration:
|
||||||
|
|
||||||
|
```
|
||||||
|
cp ~/dotfiles/git/.gitconfig.local.example ~/.gitconfig.local
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Edit `~/.gitconfig.local` with your personal information:
|
||||||
|
```
|
||||||
|
[user]
|
||||||
|
name = Your Name
|
||||||
|
email = your.email@example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
## Structure
|
||||||
|
|
||||||
|
- `.gitconfig`: Main configuration file with shareable settings
|
||||||
|
- `.gitconfig.local.example`: Template for personal/private Git settings
|
||||||
|
- `~/.gitconfig.local`: (Not tracked) Your personal Git configuration
|
||||||
|
|
||||||
|
This approach keeps your personal information out of the public repository while
|
||||||
|
still allowing you to manage and version your Git configuration.
|
||||||
|
|||||||
BIN
git/._.gitconfig
Normal file
BIN
git/._.gitconfig
Normal file
Binary file not shown.
18
git/.gitconfig
Normal file
18
git/.gitconfig
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[include]
|
||||||
|
path = ~/.gitconfig.local
|
||||||
|
|
||||||
|
[alias]
|
||||||
|
st = status
|
||||||
|
logg = log --graph --decorate --oneline --all
|
||||||
|
cm = commit
|
||||||
|
df = diff
|
||||||
|
dfs = diff --staged
|
||||||
|
|
||||||
|
[core]
|
||||||
|
editor = nvim
|
||||||
|
|
||||||
|
[pull]
|
||||||
|
rebase = true
|
||||||
|
|
||||||
|
[init]
|
||||||
|
templateDir = ~/.git-template
|
||||||
BIN
nvim/.config/nvim/lsp/._terraform.lua
Normal file
BIN
nvim/.config/nvim/lsp/._terraform.lua
Normal file
Binary file not shown.
6
nvim/.config/nvim/lsp/terraform.lua
Normal file
6
nvim/.config/nvim/lsp/terraform.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
return {
|
||||||
|
cmd = { "terraform-ls", "serve" },
|
||||||
|
root_markers = { ".terraform.lock", "backend.tf" },
|
||||||
|
filetypes = { "terraform", "tf" },
|
||||||
|
settings = {},
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ vim.opt.backup = false -- creates a backup file
|
|||||||
-- if a file is being edited by another program (or was written to file while editing with another program), it is not
|
-- if a file is being edited by another program (or was written to file while editing with another program), it is not
|
||||||
-- allowed to be edited
|
-- allowed to be edited
|
||||||
vim.opt.writebackup = false
|
vim.opt.writebackup = false
|
||||||
vim.opt.completeopt = "menuone,noselect" -- Set completeopt to have a better completion experience
|
vim.o.completeopt = "menuone,noinsert,popup,fuzzy"
|
||||||
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups
|
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups
|
||||||
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
|
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
|
||||||
vim.opt.wrap = false -- display lines as one long line
|
vim.opt.wrap = false -- display lines as one long line
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
vim.lsp.enable("luals")
|
vim.lsp.enable("luals")
|
||||||
vim.lsp.enable("rust")
|
vim.lsp.enable("rust")
|
||||||
vim.lsp.enable("bashls")
|
vim.lsp.enable("bashls")
|
||||||
|
vim.lsp.enable("terraform")
|
||||||
|
|
||||||
vim.lsp.config("*", {
|
vim.lsp.config("*", {
|
||||||
capabilities = {
|
capabilities = {
|
||||||
@@ -30,88 +31,116 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
})
|
})
|
||||||
-- ]]
|
-- ]]
|
||||||
|
|
||||||
---[[AUTOCOMPLETION SETUP
|
-- [[INLAY HINTS
|
||||||
vim.o.completeopt = "menuone,noinsert,popup,fuzzy"
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||||
client.server_capabilities.completionProvider.triggerCharacters = vim.split("qwertyuiopasdfghjklzxcvbnm. ", "")
|
|
||||||
vim.api.nvim_create_autocmd({ "TextChangedI" }, {
|
|
||||||
buffer = args.buf,
|
|
||||||
callback = function()
|
|
||||||
vim.lsp.completion.get()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
-- if client:supports_method("textDocument/implementation") then
|
|
||||||
-- Create a keymap for vim.lsp.buf.implementation ...
|
|
||||||
-- end
|
|
||||||
if client.server_capabilities.inlayHintProvider then
|
if client.server_capabilities.inlayHintProvider then
|
||||||
vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
|
vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
|
||||||
end
|
end
|
||||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
|
||||||
---
|
|
||||||
---[[Code required to add documentation popup for an item
|
|
||||||
local _, cancel_prev = nil, function() end
|
|
||||||
vim.api.nvim_create_autocmd("CompleteChanged", {
|
|
||||||
buffer = args.buf,
|
|
||||||
callback = function()
|
|
||||||
if client:supports_method("textDocument/implementation") then
|
|
||||||
cancel_prev()
|
|
||||||
local info = vim.fn.complete_info({ "selected" })
|
|
||||||
local completionItem =
|
|
||||||
vim.tbl_get(vim.v.completed_item, "user_data", "nvim", "lsp", "completion_item")
|
|
||||||
if nil == completionItem then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
_, cancel_prev = vim.lsp.buf_request(
|
|
||||||
args.buf,
|
|
||||||
vim.lsp.protocol.Methods.completionItem_resolve,
|
|
||||||
completionItem,
|
|
||||||
function(err, item, ctx)
|
|
||||||
if not item then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local docs = (item.documentation or {}).value
|
|
||||||
local win = vim.api.nvim__complete_set(info["selected"], { info = docs })
|
|
||||||
if win.winid and vim.api.nvim_win_is_valid(win.winid) then
|
|
||||||
vim.treesitter.start(win.bufnr, "markdown")
|
|
||||||
vim.wo[win.winid].conceallevel = 3
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
---]]
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
-- ]]
|
||||||
|
|
||||||
-- Expanding multiline snippets
|
--
|
||||||
vim.api.nvim_create_augroup("user-snippet-expand", {})
|
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
vim.api.nvim_create_autocmd("CompleteDone", {
|
-- callback = function(args)
|
||||||
group = "user-snippet-expand",
|
-- local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||||
desc = "Expand LSP snippet",
|
-- client.server_capabilities.completionProvider.triggerCharacters = vim.split("qwertyuiopasdfghjklzxcvbnm. ", "")
|
||||||
pattern = "*",
|
-- vim.api.nvim_create_autocmd({ "TextChangedI" }, {
|
||||||
callback = function(opts)
|
-- buffer = args.buf,
|
||||||
local comp = vim.v.completed_item
|
-- callback = function()
|
||||||
local item = vim.tbl_get(comp, "user_data", "nvim", "lsp", "completion_item")
|
-- vim.lsp.completion.get()
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- -- if client:supports_method("textDocument/implementation") then
|
||||||
|
-- -- Create a keymap for vim.lsp.buf.implementation ...
|
||||||
|
-- -- end
|
||||||
|
-- if client.server_capabilities.inlayHintProvider then
|
||||||
|
-- vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
|
||||||
|
-- end
|
||||||
|
|
||||||
-- check that we were given a snippet
|
---[[AUTOCOMPLETION SETUP
|
||||||
if not item or not item.insertTextFormat or item.insertTextFormat == 1 then
|
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
return
|
-- callback = function(args)
|
||||||
end
|
-- local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||||
|
-- client.server_capabilities.completionProvider.triggerCharacters = vim.split("qwertyuiopasdfghjklzxcvbnm. ", "")
|
||||||
-- remove the inserted text
|
-- vim.api.nvim_create_autocmd({ "TextChangedI" }, {
|
||||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
-- buffer = args.buf,
|
||||||
local line = vim.api.nvim_get_current_line()
|
-- callback = function()
|
||||||
local lnum = cursor[1] - 1
|
-- vim.lsp.completion.get()
|
||||||
local start_char = cursor[2] - #comp.word
|
-- end,
|
||||||
vim.api.nvim_buf_set_text(opts.buf, lnum, start_char, lnum, #line, { "" })
|
-- })
|
||||||
|
-- -- if client:supports_method("textDocument/implementation") then
|
||||||
-- insert snippet
|
-- -- Create a keymap for vim.lsp.buf.implementation ...
|
||||||
local snip_text = vim.tbl_get(item, "textEdit", "newText") or item.insertText
|
-- -- end
|
||||||
assert(snip_text, "Language server indicated it had a snippet, but no snippet text could be found!")
|
-- if client.server_capabilities.inlayHintProvider then
|
||||||
require("luasnip").lsp_expand(snip_text)
|
-- vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
|
||||||
end,
|
-- end
|
||||||
})
|
-- vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||||
---AUTOCOMPLETION SETUP END]]
|
-- ---
|
||||||
|
-- ---[[Code required to add documentation popup for an item
|
||||||
|
-- local _, cancel_prev = nil, function() end
|
||||||
|
-- vim.api.nvim_create_autocmd("CompleteChanged", {
|
||||||
|
-- buffer = args.buf,
|
||||||
|
-- callback = function()
|
||||||
|
-- if client:supports_method("textDocument/implementation") then
|
||||||
|
-- cancel_prev()
|
||||||
|
-- local info = vim.fn.complete_info({ "selected" })
|
||||||
|
-- local completionItem =
|
||||||
|
-- vim.tbl_get(vim.v.completed_item, "user_data", "nvim", "lsp", "completion_item")
|
||||||
|
-- if nil == completionItem then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
-- _, cancel_prev = vim.lsp.buf_request(
|
||||||
|
-- args.buf,
|
||||||
|
-- vim.lsp.protocol.Methods.completionItem_resolve,
|
||||||
|
-- completionItem,
|
||||||
|
-- function(err, item, ctx)
|
||||||
|
-- if not item then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
-- local docs = (item.documentation or {}).value
|
||||||
|
-- local win = vim.api.nvim__complete_set(info["selected"], { info = docs })
|
||||||
|
-- if win.winid and vim.api.nvim_win_is_valid(win.winid) then
|
||||||
|
-- vim.treesitter.start(win.bufnr, "markdown")
|
||||||
|
-- vim.wo[win.winid].conceallevel = 3
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- )
|
||||||
|
-- end
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- ---]]
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- -- Expanding multiline snippets
|
||||||
|
-- vim.api.nvim_create_augroup("user-snippet-expand", {})
|
||||||
|
-- vim.api.nvim_create_autocmd("CompleteDone", {
|
||||||
|
-- group = "user-snippet-expand",
|
||||||
|
-- desc = "Expand LSP snippet",
|
||||||
|
-- pattern = "*",
|
||||||
|
-- callback = function(opts)
|
||||||
|
-- local comp = vim.v.completed_item
|
||||||
|
-- local item = vim.tbl_get(comp, "user_data", "nvim", "lsp", "completion_item")
|
||||||
|
--
|
||||||
|
-- -- check that we were given a snippet
|
||||||
|
-- if not item or not item.insertTextFormat or item.insertTextFormat == 1 then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- -- remove the inserted text
|
||||||
|
-- local cursor = vim.api.nvim_win_get_cursor(0)
|
||||||
|
-- local line = vim.api.nvim_get_current_line()
|
||||||
|
-- local lnum = cursor[1] - 1
|
||||||
|
-- local start_char = cursor[2] - #comp.word
|
||||||
|
-- vim.api.nvim_buf_set_text(opts.buf, lnum, start_char, lnum, #line, { "" })
|
||||||
|
--
|
||||||
|
-- -- insert snippet
|
||||||
|
-- local snip_text = vim.tbl_get(item, "textEdit", "newText") or item.insertText
|
||||||
|
-- assert(snip_text, "Language server indicated it had a snippet, but no snippet text could be found!")
|
||||||
|
-- require("luasnip").lsp_expand(snip_text)
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- ---AUTOCOMPLETION SETUP END]]
|
||||||
|
|||||||
BIN
nvim/.config/nvim/lua/plugins/._completion.lua
Normal file
BIN
nvim/.config/nvim/lua/plugins/._completion.lua
Normal file
Binary file not shown.
105
nvim/.config/nvim/lua/plugins/completion.lua
Normal file
105
nvim/.config/nvim/lua/plugins/completion.lua
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
version = "v2.*",
|
||||||
|
dependencies = {
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
},
|
||||||
|
-- install jsregexp (optional!).
|
||||||
|
build = "make install_jsregexp",
|
||||||
|
config = function()
|
||||||
|
local ls = require("luasnip")
|
||||||
|
local s = ls.snippet
|
||||||
|
local t = ls.text_node
|
||||||
|
local i = ls.insert_node
|
||||||
|
|
||||||
|
ls.add_snippets("lua", {
|
||||||
|
s("hello", {
|
||||||
|
t('print("hello world!")'),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"saghen/blink.cmp",
|
||||||
|
-- use a release tag to download pre-built binaries
|
||||||
|
version = "1.*",
|
||||||
|
dependencies = {
|
||||||
|
"moyiz/blink-emoji.nvim",
|
||||||
|
},
|
||||||
|
---@module 'blink.cmp'
|
||||||
|
---@type blink.cmp.Config
|
||||||
|
opts = {
|
||||||
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- 'enter' for enter to accept
|
||||||
|
-- 'none' for no mappings
|
||||||
|
--
|
||||||
|
-- All presets have the following mappings:
|
||||||
|
-- C-space: Open menu or open docs if already open
|
||||||
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
--
|
||||||
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
|
keymap = { preset = "default" },
|
||||||
|
|
||||||
|
appearance = {
|
||||||
|
nerd_font_variant = "mono",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Only show the documentation popup when manually triggered
|
||||||
|
completion = { documentation = { auto_show = true } },
|
||||||
|
cmdline = {
|
||||||
|
keymap = {
|
||||||
|
-- recommended, as the default keymap will only show and select the next item
|
||||||
|
["<Tab>"] = { "show", "accept" },
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
menu = { auto_show = true },
|
||||||
|
ghost_text = { enabled = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
snippets = { preset = "luasnip" },
|
||||||
|
-- Default list of enabled providers defined so that you can extend it
|
||||||
|
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
|
sources = {
|
||||||
|
default = { "lsp", "path", "snippets", "buffer", "emoji" },
|
||||||
|
providers = {
|
||||||
|
cmdline = {
|
||||||
|
min_keyword_length = function(ctx)
|
||||||
|
-- when typing a command, only show when the keyword is 3 characters or longer
|
||||||
|
if ctx.mode == "cmdline" and string.find(ctx.line, " ") == nil then
|
||||||
|
return 3
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
emoji = {
|
||||||
|
module = "blink-emoji",
|
||||||
|
name = "Emoji",
|
||||||
|
score_offset = 15, -- Tune by preference
|
||||||
|
opts = { insert = true }, -- Insert emoji (default) or complete its name
|
||||||
|
should_show_items = function()
|
||||||
|
return vim.tbl_contains(
|
||||||
|
-- Enable emoji completion only for git commits and markdown.
|
||||||
|
-- By default, enabled for all file-types.
|
||||||
|
{ "gitcommit", "markdown" },
|
||||||
|
vim.o.filetype
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||||
|
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||||
|
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||||
|
--
|
||||||
|
-- See the fuzzy documentation for more information
|
||||||
|
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||||
|
},
|
||||||
|
opts_extend = { "sources.default" },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
"L3MON4D3/LuaSnip",
|
|
||||||
dependencies = {
|
|
||||||
"rafamadriz/friendly-snippets",
|
|
||||||
},
|
|
||||||
-- install jsregexp (optional!).
|
|
||||||
build = "make install_jsregexp",
|
|
||||||
config = function()
|
|
||||||
local ls = require("luasnip")
|
|
||||||
local s = ls.snippet
|
|
||||||
local t = ls.text_node
|
|
||||||
local i = ls.insert_node
|
|
||||||
|
|
||||||
ls.add_snippets("lua", {
|
|
||||||
s("hello", {
|
|
||||||
t('print("hello world!")'),
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -43,11 +43,22 @@ return {
|
|||||||
"node_modules",
|
"node_modules",
|
||||||
"target",
|
"target",
|
||||||
".terraform",
|
".terraform",
|
||||||
".git",
|
|
||||||
".venv",
|
".venv",
|
||||||
"Cargo.toml",
|
".git",
|
||||||
|
-- Ignore git submodules
|
||||||
|
"^./.git/",
|
||||||
|
"^./*/.git/",
|
||||||
|
".gitmodules",
|
||||||
|
".gitignore",
|
||||||
|
".*/%.git/.*", -- Ignore any .git directories in subdirectories
|
||||||
},
|
},
|
||||||
hidden = true,
|
hidden = true,
|
||||||
|
-- Ignore git submodules
|
||||||
|
follow = true,
|
||||||
|
},
|
||||||
|
git_files = {
|
||||||
|
recurse_submodules = false,
|
||||||
|
show_untracked = true,
|
||||||
},
|
},
|
||||||
buffers = {
|
buffers = {
|
||||||
initial_mode = "normal",
|
initial_mode = "normal",
|
||||||
|
|||||||
BIN
scripts/hcf/._package_repo_changes
Executable file
BIN
scripts/hcf/._package_repo_changes
Executable file
Binary file not shown.
61
scripts/hcf/package_repo_changes
Executable file
61
scripts/hcf/package_repo_changes
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Script to package all git changes and untracked files into a single archive
|
||||||
|
#
|
||||||
|
# ./package_repo_changes [ARCHIVE_NAME]
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
local exit_code=$?
|
||||||
|
echo "Cleaning up temporary files..."
|
||||||
|
[[ -d "${TEMP_DIR:-}" ]] && rm -rf "$TEMP_DIR"
|
||||||
|
exit $exit_code
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
# Get the repository root directory
|
||||||
|
REPO_DIR=$(git rev-parse --show-toplevel)
|
||||||
|
cd "$REPO_DIR"
|
||||||
|
|
||||||
|
TEMP_DIR=$(mktemp -d)
|
||||||
|
echo "Creating temporary directory: $TEMP_DIR"
|
||||||
|
|
||||||
|
# Check if there are any changes to package
|
||||||
|
if git diff --quiet && [[ -z "$(git ls-files --others --exclude-standard)" ]]; then
|
||||||
|
echo "No changes detected in the repository. Nothing to package."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Generating patch file for tracked changes..."
|
||||||
|
git diff >"$TEMP_DIR/changes.patch"
|
||||||
|
|
||||||
|
# Include staged changes as well
|
||||||
|
if ! git diff --staged --quiet; then
|
||||||
|
echo "Including staged changes..."
|
||||||
|
git diff --staged >>"$TEMP_DIR/changes.patch"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Packaging untracked files..."
|
||||||
|
git ls-files --others --exclude-standard >"$TEMP_DIR/untracked_files.txt"
|
||||||
|
|
||||||
|
if [[ -s "$TEMP_DIR/untracked_files.txt" ]]; then
|
||||||
|
tar -czf "$TEMP_DIR/untracked.tar.gz" -T "$TEMP_DIR/untracked_files.txt"
|
||||||
|
echo "Untracked files packaged successfully."
|
||||||
|
else
|
||||||
|
echo "No untracked files found."
|
||||||
|
touch "$TEMP_DIR/untracked.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Allow custom archive name with default fallback
|
||||||
|
ARCHIVE_NAME=${1:-"changes_$(date +%Y%m%d_%H%M%S).tar.gz"}
|
||||||
|
echo "Creating final archive: $ARCHIVE_NAME"
|
||||||
|
tar -czf "$ARCHIVE_NAME" -C "$TEMP_DIR" changes.patch untracked.tar.gz
|
||||||
|
|
||||||
|
echo "Archive created successfully at: $REPO_DIR/$ARCHIVE_NAME"
|
||||||
|
echo ""
|
||||||
|
echo "To apply these changes elsewhere:"
|
||||||
|
echo "1. Extract the archive: tar -xzf $ARCHIVE_NAME"
|
||||||
|
echo "2. Apply the patch: git apply changes.patch"
|
||||||
|
echo "3. Extract untracked files: tar -xzf untracked.tar.gz"
|
||||||
@@ -4,18 +4,16 @@
|
|||||||
tty=$1
|
tty=$1
|
||||||
|
|
||||||
# Construct process tree.
|
# Construct process tree.
|
||||||
children=();
|
children=()
|
||||||
pids=($(ps -o pid= -t $tty))
|
pids=($(ps -o pid= -t $tty))
|
||||||
|
|
||||||
while read -r pid ppid
|
while read -r pid ppid; do
|
||||||
do
|
[[ -n $pid && $pid -ne $ppid ]] && children[ppid]+=" $pid"
|
||||||
[[ -n pid && pid -ne ppid ]] && children[ppid]+=" $pid"
|
|
||||||
done <<<"$(ps -Ao pid=,ppid=)"
|
done <<<"$(ps -Ao pid=,ppid=)"
|
||||||
|
|
||||||
# Get all descendant pids of processes in $tty with BFS
|
# Get all descendant pids of processes in $tty with BFS
|
||||||
idx=0
|
idx=0
|
||||||
while (( ${#pids[@]} > idx ))
|
while ((${#pids[@]} > idx)); do
|
||||||
do
|
|
||||||
pid=${pids[idx++]}
|
pid=${pids[idx++]}
|
||||||
pids+=(${children[pid]-})
|
pids+=(${children[pid]-})
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -31,6 +31,15 @@ bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
|
|||||||
|
|
||||||
setw -g mode-keys vi
|
setw -g mode-keys vi
|
||||||
|
|
||||||
|
set -g set-clipboard on
|
||||||
|
set -g focus-events on
|
||||||
|
|
||||||
|
# Increase scrollback buffer size
|
||||||
|
set -g history-limit 50000
|
||||||
|
|
||||||
|
# Improve terminal scrolling
|
||||||
|
set -ga terminal-overrides ',*:smcup@:rmcup@'
|
||||||
|
|
||||||
set-option -g default-shell $SHELL
|
set-option -g default-shell $SHELL
|
||||||
set -g default-command "$SHELL -i"
|
set -g default-command "$SHELL -i"
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export MANPAGER='nvim +Man!'
|
|||||||
export SSH_ENV="$HOME/.ssh/agent-environment"
|
export SSH_ENV="$HOME/.ssh/agent-environment"
|
||||||
|
|
||||||
export PATH=~/.local/bin:$PATH
|
export PATH=~/.local/bin:$PATH
|
||||||
|
export PATH=$DOTFILES/scripts/hcf/:$PATH
|
||||||
|
|
||||||
case "$(uname -s)" in
|
case "$(uname -s)" in
|
||||||
Linux*) {
|
Linux*) {
|
||||||
|
|||||||
Reference in New Issue
Block a user