Compare commits
3 Commits
bffcdd8460
...
7d43d9abd3
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d43d9abd3 | |||
| 38f64e9fab | |||
| ba2b1aa855 |
@@ -19,6 +19,7 @@
|
||||
- prettier-plugin-go-template
|
||||
- rust-analyzer
|
||||
- shfmt
|
||||
- shellcheck
|
||||
- bash-language-server
|
||||
- terraform
|
||||
- tflint
|
||||
|
||||
5
nvim/.config/nvim/lsp/bashls.lua
Normal file
5
nvim/.config/nvim/lsp/bashls.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
cmd = { "bash-language-server" },
|
||||
filetypes = { "sh", "bash", "zsh" },
|
||||
settings = {},
|
||||
}
|
||||
@@ -9,12 +9,9 @@ vim.lsp.config("*", {
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("rust", {
|
||||
filetypes = { "rust" },
|
||||
})
|
||||
|
||||
vim.lsp.enable("luals")
|
||||
vim.lsp.enable("rust")
|
||||
vim.lsp.enable("bashls")
|
||||
|
||||
-- [[FOLDING SETUP
|
||||
-- Prefer LSP folding if client supports it
|
||||
|
||||
@@ -10,6 +10,7 @@ return {
|
||||
configs.setup({
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
--"zsh",
|
||||
"c",
|
||||
"cmake",
|
||||
"dockerfile",
|
||||
@@ -95,6 +96,8 @@ return {
|
||||
terraform = { "terraform_fmt" },
|
||||
-- brew install shfmt
|
||||
bash = { "shfmt" },
|
||||
zsh = { "shfmt" },
|
||||
sh = { "shfmt" },
|
||||
-- brew install ruff
|
||||
python = { "ruff" },
|
||||
},
|
||||
@@ -103,7 +106,7 @@ return {
|
||||
prepend_args = { "--prose-wrap", "always" },
|
||||
},
|
||||
shfmt = {
|
||||
prepend_args = { "-i", "4" },
|
||||
prepend_args = { "-i", "4", "-ci" },
|
||||
},
|
||||
ruff = {
|
||||
prepend_args = { "--extend-select", "I" },
|
||||
|
||||
@@ -7,7 +7,8 @@ return {
|
||||
lint.linters_by_ft = {
|
||||
-- brew install luacheck
|
||||
lua = { "luacheck" },
|
||||
bash = { "bash" },
|
||||
bash = { "shellcheck" },
|
||||
sh = { "shellcheck" },
|
||||
-- brew install tflint
|
||||
terraform = { "tflint" },
|
||||
}
|
||||
|
||||
100
zsh/.zsh_aliases
100
zsh/.zsh_aliases
@@ -13,18 +13,96 @@ alias egrep='egrep --color=auto'
|
||||
alias d='dirs -v'
|
||||
for index ({1..9}) alias "c$index"="cd +${index}"; unset index
|
||||
|
||||
alias tf="aws-vault exec feedzai-main -d 8h -- terraform"
|
||||
alias tfi="aws-vault exec feedzai-main -d 8h -- terraform init"
|
||||
alias tfp="aws-vault exec feedzai-main -d 8h -- terraform plan -lock=false"
|
||||
alias tfa="aws-vault exec feedzai-main -d 8h -- terraform apply"
|
||||
alias tfu="aws-vault exec feedzai-main -d 8h -- terraform get -update"
|
||||
_get_aws_config_path() {
|
||||
local config_path="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
|
||||
echo "$config_path"
|
||||
}
|
||||
|
||||
alias tg="aws-vault exec feedzai-main -d 8h -- terragrunt"
|
||||
alias tgi="aws-vault exec feedzai-main -d 8h -- terragrunt init"
|
||||
alias tgp="aws-vault exec feedzai-main -d 8h -- terragrunt plan -lock=false"
|
||||
alias tga="aws-vault exec feedzai-main -d 8h -- terragrunt apply"
|
||||
alias tgu="aws-vault exec feedzai-main -d 8h -- terragrunt get -update"
|
||||
alias tgg="aws-vault exec feedzai-main -d 8h -- terragrunt graph-dependencies"
|
||||
# This label will be set in a comment in the ~/.aws/config file right before
|
||||
# the definition of the profile we want to use as the default.
|
||||
# The format will be `#[<label>]`
|
||||
# Example, using "admin" as the default profile:
|
||||
#
|
||||
# > [default]
|
||||
# > region = eu-south-2
|
||||
# >
|
||||
# > #[aws-vault-default] ---> Marking the profile with the label
|
||||
# > [profile admin]
|
||||
# > source_profile=default
|
||||
# > region = eu-south-2
|
||||
# > role_arn=arn:aws:iam::<account id>:role/MyAdminRole
|
||||
# >
|
||||
# > [profile readonly]
|
||||
# > source_profile=default
|
||||
# > region = eu-south-2
|
||||
# > role_arn=arn:aws:iam::<account id>:role/MyReadOnlyRole
|
||||
#
|
||||
DEFAULT_AWS_PROFILE_LABEL="aws-vault-default"
|
||||
|
||||
_get_default_aws_profile() {
|
||||
local profile="default"
|
||||
|
||||
if grep -q "^#\[$DEFAULT_AWS_PROFILE_LABEL\]" "$(_get_aws_config_path)"; then
|
||||
profile="$(grep -A3 "^#\[$DEFAULT_AWS_PROFILE_LABEL\]" "$(_get_aws_config_path)" |
|
||||
grep '^\[profile' |
|
||||
sed -E 's/\[profile (.+)\]/\1/')"
|
||||
fi
|
||||
|
||||
echo $profile
|
||||
}
|
||||
|
||||
_terra_cmd() {
|
||||
local aws_vault_profile="$(_get_default_aws_profile)"
|
||||
local cmd_args=()
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Error: Missing required first argument"
|
||||
echo "Usage: tf [terraform|terragrunt] [additional args]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$1" != "terraform" && "$1" != "terragrunt" ]]; then
|
||||
echo "Error: First argument must be either 'terraform' or 'terragrunt'"
|
||||
echo "Usage: my_function [terraform|terragrunt] [additional args]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# If we get here, the first argument is valid
|
||||
local -r cmd="$1"
|
||||
shift
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-p|--profile)
|
||||
if [[ $# -gt 1 ]]; then
|
||||
aws_vault_profile="$2"
|
||||
shift 2
|
||||
else
|
||||
echo "Error: -p|--profile requires a profile name"
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
cmd_args+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
aws-vault exec "$aws_vault_profile" -d 8h -- "$cmd" ${cmd_args[@]}
|
||||
}
|
||||
|
||||
alias tf="_terra_cmd terraform"
|
||||
alias tfi="tf init"
|
||||
alias tfp="tf plan -lock=false"
|
||||
alias tfa="tf apply"
|
||||
alias tfu="tf get -update"
|
||||
alias tg="_terra_cmd terragrunt"
|
||||
alias tgi="tg grunt init"
|
||||
alias tgp="tg grunt plan -lock=false"
|
||||
alias tga="tg grunt apply"
|
||||
alias tgu="tg grunt get -update"
|
||||
alias tgg="tg grunt graph-dependencies"
|
||||
|
||||
alias idot='dot -Tsvg -Goverlap=scale -Grankdir=RL -Gbgcolor="#282a36" -Ncolor="#f8f8f2" -Ecolor="#f8f8f2" -Nfontcolor="#f8f8f2" -Gfontname="PragmataPro Mono Liga Regular" -Gfontsize=13 -Nfontname="PragmataPro" -Nfontsize=13 -Nshape=box -Earrowhead=normal'
|
||||
|
||||
|
||||
10
zsh/.zshenv
10
zsh/.zshenv
@@ -20,14 +20,14 @@ export SSH_ENV="$HOME/.ssh/agent-environment"
|
||||
export PATH=~/.local/bin:$PATH
|
||||
|
||||
case "$(uname -s)" in
|
||||
Linux* ) {
|
||||
Linux*) {
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
};;
|
||||
Darwin* ) {
|
||||
} ;;
|
||||
Darwin*) {
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"
|
||||
};;
|
||||
* ) ;;
|
||||
} ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
65
zsh/.zshrc
65
zsh/.zshrc
@@ -1,72 +1,49 @@
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
||||
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
||||
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
|
||||
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
|
||||
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
||||
setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
|
||||
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
|
||||
setopt SHARE_HISTORY # Share history between all sessions.
|
||||
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
||||
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
||||
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
|
||||
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
|
||||
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
||||
setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
|
||||
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
|
||||
setopt SHARE_HISTORY # Share history between all sessions.
|
||||
|
||||
bindkey '^R' history-incremental-search-backward
|
||||
bindkey '^A' beginning-of-line
|
||||
bindkey '^E' end-of-line
|
||||
bindkey '^K' kill-line
|
||||
|
||||
setopt AUTO_PUSHD # Push the current directory visited on the stack.
|
||||
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
||||
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
||||
setopt AUTO_PUSHD # Push the current directory visited on the stack.
|
||||
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
||||
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
||||
|
||||
# install zsh-syntax-highlighting
|
||||
case "$(uname -s)" in
|
||||
Linux* ) {
|
||||
Linux*) {
|
||||
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
};;
|
||||
Darwin* ) {
|
||||
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
};;
|
||||
* ) ;;
|
||||
} ;;
|
||||
Darwin*) {
|
||||
source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
} ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
|
||||
source $DOTFILES/zsh/completion.zsh
|
||||
fpath=($DOTFILES/zsh/zsh-completions/src $fpath)
|
||||
source "$DOTFILES/zsh/completion.zsh"
|
||||
fpath=("$DOTFILES/zsh/zsh-completions/src" "$fpath")
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
function start_ssh_agent {
|
||||
echo "Initialising new SSH agent..."
|
||||
/usr/bin/ssh-agent | sed 's/^echo/#echo/' >"${SSH_ENV}"
|
||||
echo succeeded
|
||||
chmod 600 "${SSH_ENV}"
|
||||
. "${SSH_ENV}" >/dev/null
|
||||
/usr/bin/ssh-add
|
||||
}
|
||||
|
||||
# Source SSH settings, if applicable
|
||||
|
||||
#if [ -f "${SSH_ENV}" ]; then
|
||||
# SSH_AGENT_PID="$(echo $(($(cat /proc/sys/kernel/pid_max) + 1)))"
|
||||
# . "${SSH_ENV}" > /dev/null
|
||||
# ps -ef | grep ${SSH_AGENT_PID} | grep 'ssh-agent$' > /dev/null || {
|
||||
# start_ssh_agent;
|
||||
# }
|
||||
#else
|
||||
# start_ssh_agent;
|
||||
#fi
|
||||
|
||||
if [ -f ~/.zsh_aliases ]; then
|
||||
. ~/.zsh_aliases
|
||||
fi
|
||||
|
||||
function set_win_title(){
|
||||
function set_win_title() {
|
||||
echo -ne "\033]0; $(basename "$PWD") \007"
|
||||
}
|
||||
starship_precmd_user_func="set_win_title"
|
||||
|
||||
export starship_precmd_user_func="set_win_title"
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user