Compare commits

...

8 Commits

Author SHA1 Message Date
d4e02bbb89 zsh: Added brew sbin to path 2023-02-06 23:20:41 +02:00
32dbec6476 nvim: Plugins cleanup 2023-02-06 22:32:27 +02:00
Ismo Vuorinen
980fc9aa7d zsh: Installed starship
https://starship.rs/
2023-01-31 15:38:41 +02:00
Ismo Vuorinen
a2c3de1b3b brew: Installed quitter 2023-01-31 15:38:19 +02:00
Ismo Vuorinen
16d455a262 2023-01-30 2023-01-30 12:16:20 +02:00
Ismo Vuorinen
9ba66c7734 dfm: dotfiles update 2023-01-19 16:33:36 +02:00
Ismo Vuorinen
86824d8c45 bin: git-dirty - list dirty git repositories 2023-01-19 16:32:07 +02:00
38d853aa8a rcrc: Skip *-secret files from rc linking 2023-01-19 16:29:22 +02:00
11 changed files with 125 additions and 82 deletions

View File

@@ -148,6 +148,8 @@ brew "ruby"
brew "shellcheck" brew "shellcheck"
# Autoformat shell script source code # Autoformat shell script source code
brew "shfmt" brew "shfmt"
# Cross-shell prompt for astronauts
brew "starship"
# Version control system designed to be a better CVS # Version control system designed to be a better CVS
brew "subversion" brew "subversion"
# Send macOS User Notifications from the command-line # Send macOS User Notifications from the command-line
@@ -250,6 +252,8 @@ cask "qlstephen"
cask "quicklook-json" cask "quicklook-json"
# QuickLook generator for Adobe Swatch Exchange files # QuickLook generator for Adobe Swatch Exchange files
cask "quicklookase" cask "quicklookase"
# Automatically hides or quits apps after periods of inactivity
cask "quitter"
# Move and resize windows using keyboard shortcuts or snap areas # Move and resize windows using keyboard shortcuts or snap areas
cask "rectangle" cask "rectangle"
# MySQL/MariaDB database management # MySQL/MariaDB database management

View File

@@ -48,11 +48,6 @@ require('packer').startup(function(use)
after = 'nvim-treesitter', after = 'nvim-treesitter',
} }
-- Git related plugins
use 'tpope/vim-fugitive'
use 'tpope/vim-rhubarb'
use 'lewis6991/gitsigns.nvim'
-- Theme based off the Material Pale Night -- Theme based off the Material Pale Night
use 'drewtempelmeyer/palenight.vim' use 'drewtempelmeyer/palenight.vim'
-- Fancier statusline -- Fancier statusline
@@ -342,18 +337,6 @@ require('indent_blankline').setup {
show_current_context_start = true, show_current_context_start = true,
} }
-- Gitsigns
-- See `:help gitsigns.txt`
require('gitsigns').setup {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
}
-- [[ Configure Telescope ]] -- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()` -- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup { require('telescope').setup {
@@ -485,16 +468,6 @@ require('nvim-treesitter.configs').setup {
}, },
} }
-- Load custom treesitter grammar for org filetype
require('orgmode').setup_ts_grammar()
require('orgmode').setup({
org_agenda_files = {
vim.fn.expand '~/.local/share/_nvalt/**/*',
vim.fn.expand '~/.dotfiles/local/org/**/*'
},
org_default_notes_file = vim.fn.expand '~/.local/share/_nvalt/refile.org',
})
-- LSP settings. -- LSP settings.
-- This function gets run when an LSP connects to a particular buffer. -- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr) local on_attach = function(_, bufnr)

View File

@@ -76,36 +76,10 @@ return function(use)
end, end,
}) })
-- nvim orgmode, to get me use nvim even more.
use({
"nvim-orgmode/orgmode",
config = function()
require('orgmode').setup_ts_grammar()
end,
})
-- Markdown support -- Markdown support
use 'preservim/vim-markdown' use 'preservim/vim-markdown'
use 'godlygeek/tabular' use 'godlygeek/tabular'
-- obsidian plugin for nvim
-- https://github.com/epwalsh/obsidian.nvim
use({
"epwalsh/obsidian.nvim",
config = function()
require("obsidian").setup({
dir = '~/.local/share/_nvalt',
notes_subdir = "notes",
daily_notes = {
folder = "_daily"
},
completion = {
nvim_cmp = true, -- if using nvim-cmp, otherwise set to false
}
})
end
})
-- Creates missing folders on save -- Creates missing folders on save
-- https://github.com/jghauser/mkdir.nvim -- https://github.com/jghauser/mkdir.nvim
use { 'jghauser/mkdir.nvim' } use { 'jghauser/mkdir.nvim' }

View File

@@ -22,32 +22,32 @@ function section_install
case "$1" in case "$1" in
all) all)
$0 install antigen && msg_done "New antigen installed" $0 install antigen
$0 install macos && msg_done "macOS Defaults set" $0 install macos
$0 install brew && msg_done "Brewfile defined apps has been installed" $0 install brew
$0 install ext_gh && msg_done "Extensions for GitHub CLI have been installed" $0 install ext_gh
$0 install ext_go && msg_done "Go packages have been installed" $0 install ext_go
;; ;;
antigen) antigen)
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 Done!" curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" && msg_done "🎉 New antigen installed!"
;; ;;
brew) brew)
brew bundle install --file="$BREWFILE" && msg_done "🎉 Done!" brew bundle install --file="$BREWFILE" && msg_done "🎉 macOS Defaults set!"
;; ;;
macos) macos)
bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Done!" bash "$DOTFILES/scripts/set-macos-defaults.sh" && msg_done "🎉 Brewfile defined apps has been installed!"
;; ;;
ext_go) ext_go)
bash "$DOTFILES/scripts/install-go-packages.sh" && msg_done "🎉 Done!" bash "$DOTFILES/scripts/install-go-packages.sh" && msg_done "🎉 Go packages have been installed!"
;; ;;
ext_gh) ext_gh)
bash "$DOTFILES/scripts/install-gh-extensions.sh" && msg_done "🎉 Done!" bash "$DOTFILES/scripts/install-gh-extensions.sh" && msg_done "🎉 Extensions for GitHub CLI have been installed!"
;; ;;
settler) settler)
bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Done!" bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Settler has been run!"
;; ;;
*) *)
menu_section "$USAGE_PREFIX" "all | antigen | brew | macos | ext_go | ext_gh | settler" menu_section "$USAGE_PREFIX" "all | antigen | brew | ext_gh | ext_go | macos | settler"
menu_item "all" "Installs antigen, macos, brew, ext_gh and ext_go" menu_item "all" "Installs antigen, macos, brew, ext_gh and ext_go"
menu_item "antigen" "Updates the antigen.zsh file" menu_item "antigen" "Updates the antigen.zsh file"
menu_item "brew" "Install Brewfile contents" menu_item "brew" "Install Brewfile contents"
@@ -103,7 +103,7 @@ function section_dotfiles
case "$1" in case "$1" in
link) link)
rcup -B "$HOSTNAME" -f -v && msg_done "🎉 Done!" rcup -B "$HOSTNAME" -f -v && msg_done "🎉 dotfiles have been linked!"
;; ;;
update) update)
# Updates .dotfiles/scripts/install.sh and formats it # Updates .dotfiles/scripts/install.sh and formats it
@@ -112,16 +112,20 @@ function section_dotfiles
&& sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \ && sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \
&& sed -i '' "s|install.sh|$(basename "$INSTALL_SCRIPT")|g" "$INSTALL_SCRIPT" && sed -i '' "s|install.sh|$(basename "$INSTALL_SCRIPT")|g" "$INSTALL_SCRIPT"
$0 dotfiles shfmt $0 dotfiles shfmt
msg_done "🎉 Done!" $0 dotfiles link
msg_done "🎉 dotfiles updated and linked!"
;; ;;
shfmt) shfmt)
# Format shell scripts according to following rules. # Format shell scripts according to following rules.
shfmt -fn -l -w -i 2 -ci -sr -bn "$DOTFILES" find "$DOTFILES" \
\( -name '*.sh' -or -name '*.zsh' -or -name 'x-*' -or -not '*.pl' \) \
-exec shfmt -fn -l -w -i 2 -ci -sr -bn {} \;
msg_done "🎉 dotfiles have been formatted!"
;; ;;
*) *)
menu_section "$USAGE_PREFIX" "link | update | shfmt" menu_section "$USAGE_PREFIX" "link | update | shfmt"
menu_item "link" "Use rcrc to update dotfile links" menu_item "link" "Use rcrc to update dotfile links"
menu_item "update" "Updates dotfile links, installs host specific overrides automatically" menu_item "update" "Updates dotfile links (scripts/install.sh), formats it and runs it."
menu_item "shfmt" "Run shfmt to all dotfiles" menu_item "shfmt" "Run shfmt to all dotfiles"
;; ;;
esac esac
@@ -173,4 +177,3 @@ case "$1" in
tests) section_tests "$2" ;; tests) section_tests "$2" ;;
*) usage && exit 1 ;; *) usage && exit 1 ;;
esac esac

82
local/bin/git-dirty Executable file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Get git repository status for all subdirectories
# recursively in specified dir.
#
# Check the default dir:
# `git-dirty.sh`
# Check specific dir:
# `git-dirty.sh ~/Projects`
# Override default dir with env:
# `GIT_DIRTY_DIR=$HOME/Projects git-dirty.sh`
#
# If you want to skip directory from checks, just add `.ignore` file next
# to the `.git` folder. ProTip: Add `.ignore` to your global `.gitignore`.
#
# The script automatically skips folders:
# node_modules, vendor
#
# SET Defaults:
# Default dir to check, can be overridden in env (.bashrc, .zshrc, ...)
: "${GIT_DIRTY_DIR:=$HOME/Code}"
# If user has provided folder as a first argument, use it.
if [ "$1" != "" ]; then
GIT_DIRTY_DIR="$1"
fi
# UTF-8 ftw
GITDIRTY="❌ "
GITCLEAN="✅ "
catch()
{
echo "Error $1 occurred on $2"
}
gitdirty()
{
local d="$1"
trap 'catch $? $LINENO' ERR
if [[ -d "$d" ]]; then
if [[ -e "$d/.ignore" ]]; then
echo -e ""
else
# Check that $d is not '--', 'vendor', or 'node_modules'
if [[ "${d:0:2}" == "--" ]] || [[ "$d" == "vendor" ]] || [[ "$d" == "node_modules" ]]; then
echo ""
else
cd "$d" > /dev/null
# If we have `.git` folder, check it.
if [[ -d ".git" ]]; then
ISDIRTY=$(git diff --shortstat 2> /dev/null | tail -n1)
ICON="$GITCLEAN"
[[ $ISDIRTY != "" ]] && ICON="$GITDIRTY"
printf " %s %s\n" "$ICON" "$(pwd)"
else
# If it wasn't git repository, check subdirectories.
gitdirtyrepos -- *
fi
fi
cd .. > /dev/null
fi
fi
}
gitdirtyrepos()
{
for x in "$@"; do
gitdirty "$x"
done
}
set -e
trap 'case $? in
139) echo "segfault occurred";;
11) echo "ssegfault occurred";;
esac' EXIT
gitdirtyrepos "$GIT_DIRTY_DIR"

2
rcrc
View File

@@ -1,2 +1,2 @@
EXCLUDES="*.md *.sh *.lock.json Brewfile scripts" EXCLUDES="*.md *.sh *.lock.json Brewfile scripts *-secret xbar"
HOSTNAME=$(hostname -s) HOSTNAME=$(hostname -s)

View File

@@ -9,7 +9,7 @@
# env VERBOSE=1 sh install-dotfiles.sh # env VERBOSE=1 sh install-dotfiles.sh
# #
# DO NOT EDIT THIS FILE # DO NOT EDIT THIS FILE
# #
# This file is generated by rcm(7) as: # This file is generated by rcm(7) as:
# #
# rcup -B 0 -g # rcup -B 0 -g
@@ -22,14 +22,12 @@
: ${MKDIR:=/bin/mkdir} : ${MKDIR:=/bin/mkdir}
: ${RM:=/bin/rm} : ${RM:=/bin/rm}
: ${DIRNAME:=/usr/bin/dirname} : ${DIRNAME:=/usr/bin/dirname}
verbose() verbose() {
{
if [ "$VERBOSE" -gt 0 ]; then if [ "$VERBOSE" -gt 0 ]; then
echo "$@" echo "$@"
fi fi
} }
handle_file_cp() handle_file_cp() {
{
if [ -e "$2" ]; then if [ -e "$2" ]; then
printf "%s " "overwrite $2? [yN]" printf "%s " "overwrite $2? [yN]"
read overwrite read overwrite
@@ -47,8 +45,7 @@ handle_file_cp()
$MKDIR -p "$($DIRNAME "$2")" $MKDIR -p "$($DIRNAME "$2")"
$CP -R "$1" "$2" $CP -R "$1" "$2"
} }
handle_file_ln() handle_file_ln() {
{
if [ -e "$2" ]; then if [ -e "$2" ]; then
printf "%s " "overwrite $2? [yN]" printf "%s " "overwrite $2? [yN]"
read overwrite read overwrite
@@ -84,10 +81,11 @@ handle_file_ln "$HOME/.dotfiles/git_profiles" "$HOME/.git_profiles"
handle_file_ln "$HOME/.dotfiles/huskyrc" "$HOME/.huskyrc" handle_file_ln "$HOME/.dotfiles/huskyrc" "$HOME/.huskyrc"
handle_file_ln "$HOME/.dotfiles/local/bin/antigen.zsh" "$HOME/.local/bin/antigen.zsh" handle_file_ln "$HOME/.dotfiles/local/bin/antigen.zsh" "$HOME/.local/bin/antigen.zsh"
handle_file_ln "$HOME/.dotfiles/local/bin/dfm" "$HOME/.local/bin/dfm" handle_file_ln "$HOME/.dotfiles/local/bin/dfm" "$HOME/.local/bin/dfm"
handle_file_ln "$HOME/.dotfiles/local/bin/git-dirty" "$HOME/.local/bin/git-dirty"
handle_file_ln "$HOME/.dotfiles/local/bin/x-check-git-attributes" "$HOME/.local/bin/x-check-git-attributes" handle_file_ln "$HOME/.dotfiles/local/bin/x-check-git-attributes" "$HOME/.local/bin/x-check-git-attributes"
handle_file_ln "$HOME/.dotfiles/local/bin/x-dupes" "$HOME/.local/bin/x-dupes" handle_file_ln "$HOME/.dotfiles/local/bin/x-dupes.pl" "$HOME/.local/bin/x-dupes.pl"
handle_file_ln "$HOME/.dotfiles/local/bin/x-foreach" "$HOME/.local/bin/x-foreach" handle_file_ln "$HOME/.dotfiles/local/bin/x-foreach" "$HOME/.local/bin/x-foreach"
handle_file_ln "$HOME/.dotfiles/local/bin/x-multi-ping" "$HOME/.local/bin/x-multi-ping" handle_file_ln "$HOME/.dotfiles/local/bin/x-multi-ping.pl" "$HOME/.local/bin/x-multi-ping.pl"
handle_file_ln "$HOME/.dotfiles/local/bin/x-open-ports" "$HOME/.local/bin/x-open-ports" handle_file_ln "$HOME/.dotfiles/local/bin/x-open-ports" "$HOME/.local/bin/x-open-ports"
handle_file_ln "$HOME/.dotfiles/local/bin/x-ssl-expiry-date" "$HOME/.local/bin/x-ssl-expiry-date" handle_file_ln "$HOME/.dotfiles/local/bin/x-ssl-expiry-date" "$HOME/.local/bin/x-ssl-expiry-date"
handle_file_ln "$HOME/.dotfiles/local/bin/x-until-error" "$HOME/.local/bin/x-until-error" handle_file_ln "$HOME/.dotfiles/local/bin/x-until-error" "$HOME/.local/bin/x-until-error"

View File

@@ -104,3 +104,10 @@ function menu_item()
LINE=$(printf '%-15s %-30s\n' "$1" "$2") LINE=$(printf '%-15s %-30s\n' "$1" "$2")
echo -e "$(__log_indent)$(__log_marker) $LINE" echo -e "$(__log_indent)$(__log_marker) $LINE"
} }
# https://stackoverflow.com/a/85932
function fn_exists()
{
declare -f -F "$1" > /dev/null
return $?
}

6
zshrc
View File

@@ -5,7 +5,7 @@
autoload -U colors zsh/terminfo autoload -U colors zsh/terminfo
colors colors
export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/usr/local/sbin:$PATH" export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/sbin:$PATH"
if [ command -v brew &> /dev/null ]; then if [ command -v brew &> /dev/null ]; then
BREW_BIN=$(brew --prefix)/bin BREW_BIN=$(brew --prefix)/bin
@@ -65,7 +65,7 @@ ssh-add -A 2>/dev/null;
if command -v antigen &> /dev/null; then if command -v antigen &> /dev/null; then
antigen use oh-my-zsh antigen use oh-my-zsh
antigen theme oskarkrawczyk/honukai-iterm-zsh honukai # antigen theme oskarkrawczyk/honukai-iterm-zsh honukai
antigen bundle ssh-agent antigen bundle ssh-agent
antigen bundle colored-man-pages antigen bundle colored-man-pages
@@ -114,5 +114,7 @@ if hash gcloud 2>/dev/null; then
[[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc" [[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
fi fi
eval "$(starship init zsh)"
# Fig post block. Keep at the bottom of this file. # Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh" [[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"