Update gitconfig and bashrc to use VS Code by default

Good luck installing and using VS Code on GUI-less Linux boxes, or
probably inside Code Server stuff.

Signed-off-by: Andrei Jiroh Eugenio Halili <andreijiroh@madebythepins.tk>
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-08-05 22:17:37 +08:00
parent a2a738e40a
commit 82f243fd8a
Signed by: ajhalili2006
GPG Key ID: A30EBE40AD856D88
3 changed files with 38 additions and 11 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/bash
# shellcheck disable=SC1090,SC1091,SC2088
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
@ -128,11 +129,13 @@ export PATH="$HOME/.deta/bin:$PATH"
# scripts in ~/.local/bin and ~/.dotfiles/bin
# also $HOME/.cargo/bin
export DOTFILES_HOME="$HOME/.dotfiles" DOTFILES_STUFF_BIN="$DOTFILES_HOME/bin" GOLANG_PATH=/usr/local/go/bin
export DOTFILES_HOME="$HOME/.dotfiles"
export DOTFILES_STUFF_BIN="$DOTFILES_HOME/bin" GOLANG_PATH=/usr/local/go/bin
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$GOLANG_PATH:$DOTFILES_STUFF_BIN:$PATH"
# use nano instead of vi
# for git, there's the option of firing up VS Code, if you prefered.
export VISUAL="code --wait"
export EDITOR=nano
# autocompletion for GitHub CLI
@ -155,3 +158,6 @@ export PATH=/home/gildedguy/go/bin:$PATH GOPATH=/home/gildedguy/go
# Use native builds when doing 'docker build' instead of 'docker buildx build'
export DOCKER_BUILDKIT=1
# Generated for envman. Do not edit.
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"

View File

@ -1,4 +1,5 @@
#!/usr/bin/bash
#!/bin/bash
# shellcheck disable=SC2199,SC2068,SC1091,SC2086,SC2145
# custom function management here
# changes to the worthwhile-functions filepath requires
@ -7,6 +8,7 @@
disable-funcs () {
echo "info: Unimplemented yet. Tell Andrei to add it to his todo."
}
edit-funcs-bashrc() {
$(echo $EDITOR || command -v nano>>/dev/null && echo nano || echo vi) ~/.dotfiles/bashrc/worthwhile-functions
}
@ -17,26 +19,33 @@ list-debs-size () {
edit-script-file () {
# if you use other editor, please set $EDITOR.
$(echo $EDITOR || command -v nano>>/dev/null && echo nano || echo vi) $(command -v $1)
$(echo $EDITOR || command -v code>>/dev/null && echo code || command -v nano>>/dev/null && echo nano || echo vi) "$(command -v $1)"
}
# reloading stuff
refresh-funcs() {
$DOTFILES_STUFF_BIN/reload-funcs-bashrc
"$DOTFILES_STUFF_BIN/reload-funcs-bashrc"
}
refresh-aliases() {
source $HOME/.dotfiles/bashrc/aliases
source "$HOME/.dotfiles/bashrc/aliases"
}
# https://commentedcode.org/blog/2020/09/21/changing-default-branch-of-git-init/
function git() {
command git "$@"
if [[ $? -eq 0 && "$1" == "init" && "$@" != *"--help"* ]]; then
echo "Setting HEAD to branch main"
git symbolic-ref HEAD refs/heads/main
fi
# check command for some automation KEK
if [[ "$1" == "init" && "$@" != *"--help"* ]]; then
if ! command git init; then
echo "Setting HEAD to branch main"
command git symbolic-ref HEAD refs/heads/main
fi
elif [[ "$1" == "commit" && "$@" != *"--help"* && ( "$@" != *"--signoff"* && "$@" != *"-s"* ) ]]; then
[ $DEBUG != "" ] && echo "args: $@ --signoff" && sleep 3
command git "$@" --signoff
else
command git "$@"
fi
}
list-nodejs-scripts() {
cat package.json | jq .scripts || echo "No package.json found in current directory."
[[ -f "package.json" ]] && jq .scripts < package.json || echo "No package.json found in current directory."
}

View File

@ -1,9 +1,21 @@
[credential "https://github.com"]
helper = !gh auth git-credential
[user]
email = andreijiroh@madebythepins.tk
name = Andrei Jiroh Eugenio Halili
signingkey = A30EBE40AD856D88
editor = code --wait
[merge]
tool = vscode
[mergetool "vscode"]
cmd = code --wait $MERGED
[diff]
tool = vscode
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTE
[commit]
gpgsign = true