Skip to content

Commit

Permalink
General update
Browse files Browse the repository at this point in the history
Most of the work was put into the Vim colorscheme, which is designed
from scratch. It is not yet finished, so #4 is still kept open.

zsh's and git's configs where revisited and have some minor changes.

- close #2
- close #3
  • Loading branch information
Mischback committed Oct 18, 2022
2 parents 066905b + c048725 commit 8e082aa
Show file tree
Hide file tree
Showing 8 changed files with 737 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "vim/vimfiles/bundle/Vundle.vim"]
path = vim/vimfiles/bundle/Vundle.vim
url = https://github.com/gmarik/Vundle.vim.git
url = https://github.com/VundleVim/Vundle.vim.git
51 changes: 36 additions & 15 deletions git/gitconfig
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
[core]
editor = vim
autocrlf = input

[user]
name = Mischback
email = [email protected]
name = Mischback
email = [email protected]

[merge]
ff = false
[core]
editor = vim
excludesFile = ~/.gitignore
autocrlf = input

[color]
ui = true
ui = auto

[color "status"]
added = "green normal bold"
Expand All @@ -24,13 +22,36 @@
remote = "cyan normal dim"

[color "grep"]
linenumber = "green normal dim"
filename = "magenta normal dim"
linenumber = "green normal dim"
match = "red normal bold"

[diff]
mnemonicPrefix = true
renames = true

[fetch]
prune = true

[grep]
break = true
heading = true
lineNumber = true

[merge]
ff = false

[push]
followTags = true

[status]
showUntrackedFiles = all

[alias]
s = status
m = merge
ca = commit -a
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
k = log --oneline --graph --decorate --all
aliases = "!git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g'"
ca = "commit -a"
k = "log --oneline --graph --decorate --all"
l = "log -25 --oneline --graph --decorate --all"
pull = "pull --ff-only"
s = "status"
uncommit = "reset --soft HEAD~1"
111 changes: 111 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/bin/bash

dotfilesDir=$(pwd)
dateStr=$(date +%Y-%m-%d-%H%M)


# Check if the current user is ROOT.
#
# This function is POSIX-compliant, see
# https://stackoverflow.com/a/52586842
function is_user_root {
[ "${EUID:-$(id -u)}" -eq 0 ];
}


# Check the availability of an executable.
#
# @param The executable
#
# This function is POSIX-compliant, see
# https://stackoverflow.com/a/677212
function check_executable {
if ! command -v $1 &> /dev/null 2>&1; then
return 1
fi

return 0
}


# Add a package to the list of missing executables.
#
# @param The executable to be checked.
# @param The package that is required.
function match_executable_with_package {
check_executable $1
if [ $? -eq 1 ]; then
missingExecutables="$missingExecutables $2"
fi
}


# Create a symlink from the user's home directory to the dotfile.
#
# @param The name of the dotfile as required in the user's home.
# @param The name of the dotfile, as provided in this repository.
#
# The function will remove existing symlinks and backup existing files and
# directories before creating the actual symlink.
function link_dotfile {
local dst="${HOME}/$1"
local src="$dotfilesDir/$2"

if [ -h $dst ]; then
#echo "Removing existing symlink!"
rm $dst

# check if $dst already exists and is a regular file
elif [ -f $dst ]; then
echo "Backing up existing file!"
mv $dst{,.$dateStr}

# check if $dst already exists and is a directory
elif [ -d $dst ]; then
echo "Backing up existing dir!"
mv $dst{,.$dateStr}
fi

echo "Creating symlink!"
ln -s $src $dst
}


# Track the missing executables. These may be used to install the required
# packages later.
missingExecutables=""

match_executable_with_package "git" "git"
match_executable_with_package "vim" "vim"
match_executable_with_package "zsh" "zsh"


# if there are missing executables, try to install them
if [ $missingExecutables -ne "" ]; then
if is_user_root; then
apt-get install --no-install-recommends --yes $missingExecutables
else
echo "Missing executables, but you're not 'root', not attempting to install"
echo "Missing: $missingExecutables"
exit 1;
fi
fi

# actually link the dotfiles to the user's home directory
echo "Linking dotfiles to ~/"
link_dotfile ".gitconfig" "git/gitconfig"
link_dotfile ".vim" "vim/vimfiles"
link_dotfile ".vimrc" "vim/vimrc"
link_dotfile ".zshrc" "shells/zshrc"
link_dotfile ".zshrc.local" "shells/zshrc.local"

# setup Vim
if [ ! -d "$dotfilesDir/vim/vimfiles/bundle/Vundle.vim/autoload" ]; then
echo "Fetching Vundle!"
git submodule update --init
fi

echo "Installing/updating vim plugins!"
vim +PluginInstall! +qall

echo "Successfully completed setup!"
9 changes: 6 additions & 3 deletions shells/zshrc.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
alias gitba='git branch -a'
alias gitf='git fetch --prune'
alias gitk='git k'
alias gits='git status'
alias tree='find . -iname "*.pyc" -delete && find . -type d -iname "__pycache__" -delete && tree -I ".git|.tox"'
alias todo='grep --include=\*.{py,html,js,tex} -rinw . -e "TODO"'
alias gitl='git l'
alias gits='git s'
alias todo='git grep --line-number --column --ignore-case --full-name -e "TODO" -e "FIXME" -I'
alias tree='tree -I ".git|.tox"'
47 changes: 47 additions & 0 deletions vim/vimfiles/autoload/allnightlong.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
" SPDX-FileCopyrightText: 2022 Mischback
" SPDX-License-Identifier: MIT
" SPDX-FileType: SOURCE

" Provide a common and coherent color palette.
"
" This is placed in vim's ``autoload``, as the palette will be used by the
" actual colorscheme and to style other vim plugins (e.g. ``airline``).


" Define the color palette of the colorscheme.
" TODO: Remove unused colors when finalizing the colorscheme!
" TODO: Document all colors as constructed, even if they get removed!
let s:colors = {
\ "dark_grey_base": { "gui": "#1c1c1c", "cterm": "234", "cterm16": "0" },
\ "dark_grey_dark": { "gui": "#080808", "cterm": "232", "cterm16": "0" },
\ "dark_grey_light": { "gui": "#3a3a3a", "cterm": "237", "cterm16": "0" },
\ "medium_grey_base": { "gui": "#767676", "cterm": "243", "cterm16": "8" },
\ "medium_grey_dark": { "gui": "#585858", "cterm": "240", "cterm16": "8" },
\ "medium_grey_light": { "gui": "#949494", "cterm": "246", "cterm16": "8" },
\ "light_grey_base": { "gui": "#b2b2b2", "cterm": "249", "cterm16": "7" },
\ "light_grey_dark": { "gui": "#949494", "cterm": "246", "cterm16": "7" },
\ "light_grey_light": { "gui": "#d0d0d0", "cterm": "252", "cterm16": "15" },
\ "green_base": { "gui": "#87af00", "cterm": "106", "cterm16": "2" },
\ "green_dark": { "gui": "#878700", "cterm": "100", "cterm16": "2" },
\ "green_light": { "gui": "#5fd700", "cterm": "148", "cterm16": "2" },
\ "blue_base": { "gui": "#5fafff", "cterm": "75", "cterm16": "12" },
\ "blue_light": { "gui": "#87d7ff", "cterm": "117", "cterm16": "12" },
\ "purple_base": { "gui": "#af5fd7", "cterm": "134", "cterm16": "5" },
\ "purple_dark": { "gui": "#5f5fd7", "cterm": "62", "cterm16": "5" },
\ "purple_light": { "gui": "#af87d7", "cterm": "140", "cterm16": "5" },
\ "teal_base": { "gui": "#00af87", "cterm": "36", "cterm16": "6" },
\ "teal_dark": { "gui": "#005f00", "cterm": "22", "cterm16": "6" },
\ "teal_light": { "gui": "#5fffaf", "cterm": "85", "cterm16": "6" },
\ "red_base": { "gui": "#af0000", "cterm": "124", "cterm16": "1" },
\ "orange_base": { "gui": "#ff8700", "cterm": "208", "cterm16": "2" },
\ "orange_dark": { "gui": "#ff5f00", "cterm": "202", "cterm16": "2" },
\ "orange_light": { "gui": "#ffaf00", "cterm": "214", "cterm16": "2" },
\ "yellow_base": { "gui": "#ffd700", "cterm": "220", "cterm16": "11" },
\ "yellow_light": { "gui": "#ffff87", "cterm": "228", "cterm16": "11" },
\ "work_pink": { "gui": "#ff00ff", "cterm": "201", "cterm16": "13" },
\}

" Return the color palette
function! allnightlong#GetColors()
return s:colors
endfunction
Loading

0 comments on commit 8e082aa

Please sign in to comment.