feat: updates

This commit is contained in:
Chen Asraf
2023-05-02 10:30:41 +03:00
parent 22c0ca60be
commit 0a09cb7297
4 changed files with 63 additions and 25 deletions

View File

@@ -35,6 +35,11 @@ vim.keymap.set("x", "<leader>p", [["_dP]], { desc = "Paste over selection, keep
-- next greatest remap ever : asbjornHaland
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]], { desc = "Yank selection to system clipboard" })
vim.keymap.set("n", "<leader>Y", [["+Y]], { desc = "Yank line to system clipboard" })
-- surround with parens
-- vim.keymap.set("v", "(", "(<C-r>\"<Esc>", { desc = "Surround selection with parens" })
-- comment line
vim.keymap.set("n", "<leader>/", ":CommentToggle<CR>", { desc = "Comment line" })
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]], { desc = "Delete selection to void register" })

View File

@@ -54,7 +54,7 @@ alias ip6="curl -6 simpip.com --max-time 2 --proto-default https --silent | prep
alias iplocal="ipconfig getifaddr en0 | prepend 'iplocal: '"
alias ip="iplocal; ip4; ip6"
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
alias pkgupdate="brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update; sudo gem cleanup; sudo softwareupdate -i -a;"
alias pkgupdate="brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo g em update --system; sudo gem update; sudo gem cleanup; sudo softwareupdate -i -a;"
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"
alias gundo="git reset --soft HEAD~1"
alias unq="sudo xattr -rd com.apple.quarantine"
@@ -93,9 +93,14 @@ alias tls="tmux list-sessions"
alias tlw="tmux list-windows"
alias trl="tmux source-file ~/.config/.tmux.conf"
alias trn="tmux rename-session -t"
alias trm="tmux kill-session -t"
alias sync-config="rsync -vtr $DOTFILES/.config/ $HOME/.config/"
# alias tn-simple-scaffold="tn-custom -d $HOME/Dev/simple-scaffold ."
alias tn-df="tn-custom -d $DOTFILES -s dotfiles ."
alias tn-simple-scaffold="tn-prj simple-scaffold"
alias tn-acroasis="tn-custom -d $HOME/Dev/acroasis -s acroasis front server shared landing"
if is_linux; then
alias md5="md5sum"
fi

View File

@@ -1,4 +1,4 @@
#compdef prj prjd
#compdef prj prjd tn-prj
prjpath="$(wd path dv)"
names=($(ls $prjpath))

View File

@@ -317,33 +317,61 @@ tn-general () {
}
tn-custom () {
winname=$1
shift
# Use -d to allow the rest of the function to run
tmux new-session -d -s $winname
# tmux new-window -n $winname
parent="."
for arg in "$@"; do
case "$1" in
-d)
parent="$2"
winname=$(basename $parent)
shift 2
;;
-s)
winname="$2"
shift 2
;;
esac
done
tmux has-session -t $winname 2>/dev/null
if [[ "$?" == "0" ]]; then
tmux attach-session -t $winname
return 0
fi
# set as array from argv
dirs=("$@")
# -d to prevent current window from changing
echo "Creating new session $winname on $parent with dirs: $dirs"
tmux new-session -d -s $winname -n general -c $parent
for dir in ${dirs[@]}; do
dir="$parent/$dir"
tabname=$(basename $dir)
echo "tabname=$tabname"
sleep 0.1
tmux new-window -d -n $tabname -c "$dir"
echo "tmux new-window -d -n $tabname -c $dir"
sleep 0.1
tmux send-keys -t $winname:$tabname "v ." Enter
echo "tmux send-keys -t $winname:$tabname v . Enter"
sleep 0.1
echo "tmux split-pane -d -h -t $winname:$tabname -c $dir"
tmux split-pane -d -h -t $winname:$tabname -c "$dir"
if [[ $tabname == "." ]]; then
tabname="$winname"
fi
# sleep 0.1
# echo new-window -n $tabname -c $dir
tmux new-window -n $tabname -c $dir
# echo
# sleep 0.1
# echo send-keys -t $winname:$tabname v . Enter
tmux send-keys -t $winname:$tabname v Enter
# echo
# sleep 0.1
# echo split-window -h -t $winname:$tabname -c $dir
tmux split-window -h -t $winname:$tabname -c $dir
# echo
done
sleep 1
# -d to detach any other client (which there shouldn't be,
# since you just created the session).
echo "tmux attach-session -d -t $winname"
tmux attach-session -d -t $winname
tmux select-window -t $winname:0
tmux attach -t $winname
}
tn-prj() {
prj="$1"
shift
tn-custom -d "$HOME/Dev/$prj" -s "$prj" . $@
}