Compare commits

...

3 Commits

Author SHA1 Message Date
410f5ac2b5 nvim: wakatime/vim-wakatime 2023-01-16 22:58:22 +02:00
Ismo Vuorinen
b6a18688c4 Fix shfmt command and formatted files 2023-01-12 16:49:49 +02:00
9f1ba5034f nvim: Added harpoon 2023-01-09 04:04:09 +02:00
10 changed files with 141 additions and 121 deletions

View File

@@ -66,12 +66,12 @@ require('packer').startup(function(use)
-- Fuzzy Finder (files, lsp, etc) -- Fuzzy Finder (files, lsp, etc)
use { 'nvim-telescope/telescope.nvim', use { 'nvim-telescope/telescope.nvim',
branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
-- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available -- Only load if `make` is available
use { 'nvim-telescope/telescope-fzf-native.nvim', use { 'nvim-telescope/telescope-fzf-native.nvim',
run = 'make', cond = vim.fn.executable 'make' == 1 } run = 'make', cond = vim.fn.executable 'make' == 1 }
-- Add custom plugins to packer from -- Add custom plugins to packer from
-- ~/.config/nvim/lua/custom/plugins.lua -- ~/.config/nvim/lua/custom/plugins.lua
@@ -392,6 +392,9 @@ ks('n', '<leader>sw', tl.grep_string, { desc = '[S]earch current [W]ord' })
ks('n', '<leader>sg', tl.live_grep, { desc = '[S]earch by [G]rep' }) ks('n', '<leader>sg', tl.live_grep, { desc = '[S]earch by [G]rep' })
ks('n', '<leader>sd', tl.diagnostics, { desc = '[S]earch [D]iagnostics' }) ks('n', '<leader>sd', tl.diagnostics, { desc = '[S]earch [D]iagnostics' })
-- Add harpoon to telescope
require("telescope").load_extension('harpoon')
-- [[ Configure Treesitter ]] -- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter` -- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {

View File

@@ -59,6 +59,13 @@ return function(use)
} }
} }
-- harpoon, by ThePrimeagen
-- https://github.com/ThePrimeagen/harpoon
use {
"ThePrimeagen/harpoon",
requires = { { "nvim-lua/plenary.nvim" } }
}
-- An asynchronous linter plugin for Neovim complementary to -- An asynchronous linter plugin for Neovim complementary to
-- the built-in Language Server Protocol support. -- the built-in Language Server Protocol support.
-- https://github.com/mfussenegger/nvim-lint -- https://github.com/mfussenegger/nvim-lint
@@ -197,4 +204,7 @@ return function(use)
requires = { "jose-elias-alvarez/null-ls.nvim" } requires = { "jose-elias-alvarez/null-ls.nvim" }
} }
-- WakaTime Support
use { "wakatime/vim-wakatime" }
end end

View File

@@ -48,13 +48,13 @@ function section_install
;; ;;
*) *)
menu_section "$USAGE_PREFIX" "all | antigen | brew | macos | ext_go | ext_gh | settler" menu_section "$USAGE_PREFIX" "all | antigen | brew | macos | ext_go | ext_gh | 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"
menu_item "ext_gh" "Install GitHub CLI Extensions" menu_item "ext_gh" "Install GitHub CLI Extensions"
menu_item "ext_go" "Install Go Packages" menu_item "ext_go" "Install Go Packages"
menu_item "macos" "Setup nice macOS defaults" menu_item "macos" "Setup nice macOS defaults"
menu_item "settler" "Runs the WIP settler.sh" menu_item "settler" "Runs the WIP settler.sh"
;; ;;
esac esac
} }
@@ -115,24 +115,13 @@ function section_dotfiles
;; ;;
shfmt) shfmt)
# Format shell scripts according to following rules. # Format shell scripts according to following rules.
shfmt \ shfmt -fn -l -w -i 2 -ci -sr -bn "$DOTFILES"
--find \
--list \
--write \
--diff \
--simplify \
--indent 2 \
--binary-next-line \
--case-indent \
--space-redirects \
--func-next-line \
"$DOTFILES"
;; ;;
*) *)
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, installs host specific overrides automatically"
menu_item "shfmt" "Run shfmt to all dotfiles" menu_item "shfmt" "Run shfmt to all dotfiles"
;; ;;
esac esac
} }

View File

@@ -20,9 +20,10 @@
# #
# Simple function to show usage information, and exit. # Simple function to show usage information, and exit.
# #
usage() { usage()
echo "Usage: $0 [-d] [-p 443] domain1.org domain2.com .. domainN" {
exit 0 echo "Usage: $0 [-d] [-p 443] domain1.org domain2.com .. domainN"
exit 0
} }
# #
@@ -35,19 +36,19 @@ port=443
# Parse the argument(s) - i.e. look for "-d" / "-p 443". # Parse the argument(s) - i.e. look for "-d" / "-p 443".
# #
while getopts "h?dp:" opt; do while getopts "h?dp:" opt; do
case $opt in case $opt in
h) h)
usage usage
;; ;;
\?) \?)
usage usage
;; ;;
d) d)
days=1 days=1
;; ;;
p) p)
port=$OPTARG port=$OPTARG
;; ;;
esac esac
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
@@ -56,7 +57,7 @@ shift $((OPTIND - 1))
# Ensure we have some arguments # Ensure we have some arguments
# #
if [ "$#" = "0" ]; then if [ "$#" = "0" ]; then
usage usage
fi fi
# #
@@ -64,70 +65,70 @@ fi
# #
for name in "$@"; do for name in "$@"; do
# #
# Make a temporary file # Make a temporary file
# #
# Test if we have BSD or GNU version of mktemp # Test if we have BSD or GNU version of mktemp
if ( strings "$(which mktemp)" | grep -q GNU); then if (strings "$(which mktemp)" | grep -q GNU); then
# We have the GNU version # We have the GNU version
tmp=$(mktemp) tmp=$(mktemp)
else else
# We have the BSD version # We have the BSD version
tmp=$(mktemp -t tmp) tmp=$(mktemp -t tmp)
fi fi
# #
# Download the certificate # Download the certificate
# #
if ( ! echo "" | openssl s_client -connect $name:$port > $tmp 2> /dev/null); then if (! echo "" | openssl s_client -connect $name:$port > $tmp 2> /dev/null); then
echo "Failed to get cert from https://$name:$port/" echo "Failed to get cert from https://$name:$port/"
exit 3 exit 3
fi fi
# #
# Get the expiry date # Get the expiry date
# #
date=$(openssl x509 -in "$tmp" -noout -enddate | awk -F= '{print $2}') date=$(openssl x509 -in "$tmp" -noout -enddate | awk -F= '{print $2}')
# #
# Remove the temporary file # Remove the temporary file
# #
rm -f "$tmp" rm -f "$tmp"
# #
# Convert the expiry date + todays date to seconds-past epoch # Convert the expiry date + todays date to seconds-past epoch
# #
# Check if we have the BSD or the GNU version of date # Check if we have the BSD or the GNU version of date
if (strings "$(which date)" | grep -q GNU); then if (strings "$(which date)" | grep -q GNU); then
# We have GNU this is easy # We have GNU this is easy
then=$(date --date "$date" +%s) then=$(date --date "$date" +%s)
else else
# We have BSD now it is getting complicated # We have BSD now it is getting complicated
year=$(echo "$date" | awk '{print $4}') year=$(echo "$date" | awk '{print $4}')
month=$(echo "$date" | awk '{print $1}') month=$(echo "$date" | awk '{print $1}')
day=$(echo "$date" | awk '{print $2}') day=$(echo "$date" | awk '{print $2}')
hour=$(echo "$date" | awk '{print $3}' | awk -F: '{print $1}') hour=$(echo "$date" | awk '{print $3}' | awk -F: '{print $1}')
minute=$(echo "$date" | awk '{print $3}' | awk -F: '{print $2}') minute=$(echo "$date" | awk '{print $3}' | awk -F: '{print $2}')
second=$(echo "$date" | awk '{print $3}' | awk -F: '{print $3}') second=$(echo "$date" | awk '{print $3}' | awk -F: '{print $3}')
then=$(date -v${year}y -v${month} -v${day}d -v${hour}H -v${minute}M -v${second}S -u +%s) then=$(date -v${year}y -v${month} -v${day}d -v${hour}H -v${minute}M -v${second}S -u +%s)
fi fi
now=$(date +%s) now=$(date +%s)
# #
# Day diff # Day diff
# #
diff=$(("$then" - "$now")) diff=$(("$then" - "$now"))
diff=$($diff / 86400) diff=$($diff / 86400)
# #
# All done # All done
# #
if [ "$days" = "1" ]; then if [ "$days" = "1" ]; then
echo "${name}: ${diff}" echo "${name}: ${diff}"
else else
echo "$name" echo "$name"
echo " Expires: ${date}" echo " Expires: ${date}"
echo " Days: ${diff}" echo " Days: ${diff}"
fi fi
done done

View File

@@ -11,5 +11,5 @@
# If the status code was zero then repeat. # If the status code was zero then repeat.
# #
while [ $? -eq 0 ]; do while [ $? -eq 0 ]; do
"$@" "$@"
done done

View File

@@ -26,5 +26,5 @@
# If the status code was not zero then repeat. # If the status code was not zero then repeat.
# #
while [ $? -ne 0 ]; do while [ $? -ne 0 ]; do
"$@" "$@"
done done

View File

@@ -14,8 +14,8 @@
# Ensure we received the correct number of arguments. # Ensure we received the correct number of arguments.
# #
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "Usage: $0 HOST COMMAND..." echo "Usage: $0 HOST COMMAND..."
exit 1 exit 1
fi fi
HOST=$1 HOST=$1
@@ -24,7 +24,7 @@ echo "Waiting for $HOST to get down..."
true true
while [ $? -ne 1 ]; do while [ $? -ne 1 ]; do
ping -c 1 -W 1 $HOST > /dev/null ping -c 1 -W 1 $HOST > /dev/null
done done
shift shift

View File

@@ -18,8 +18,8 @@
# Ensure we received the correct number of arguments. # Ensure we received the correct number of arguments.
# #
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "Usage: $0 HOST COMMAND..." echo "Usage: $0 HOST COMMAND..."
exit 1 exit 1
fi fi
if [ $1 = "ssh" ]; then if [ $1 = "ssh" ]; then
@@ -32,8 +32,8 @@ echo "Waiting for $HOST to come online..."
ping -c 1 -W 1 $HOST > /dev/null ping -c 1 -W 1 $HOST > /dev/null
while [ $? -ne 0 ]; do while [ $? -ne 0 ]; do
sleep 1 sleep 1
ping -c 1 -W 1 $HOST > /dev/null ping -c 1 -W 1 $HOST > /dev/null
done done
# By the time we reach here the ping-command has completed successfully # By the time we reach here the ping-command has completed successfully

View File

@@ -75,7 +75,6 @@ handle_file_ln "$HOME/.dotfiles/config/functions" "$HOME/.config/functions"
handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml" handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml"
handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config" handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config"
handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore" handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore"
handle_file_ln "$HOME/.dotfiles/config/nvim/after/plugin/defaults.lua" "$HOME/.config/nvim/after/plugin/defaults.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/init.lua" "$HOME/.config/nvim/init.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/init.lua" "$HOME/.config/nvim/init.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/custom/plugins.lua" "$HOME/.config/nvim/lua/custom/plugins.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/lua/custom/plugins.lua" "$HOME/.config/nvim/lua/custom/plugins.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/plugin/packer_compiled.lua" "$HOME/.config/nvim/plugin/packer_compiled.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/plugin/packer_compiled.lua" "$HOME/.config/nvim/plugin/packer_compiled.lua"

View File

@@ -12,77 +12,95 @@ CLR_BLUE='\033[1;34m'
CLR_RESET="\033[0m" CLR_RESET="\033[0m"
# -- Helpers -- # # -- Helpers -- #
function __log_marker() { function __log_marker()
{
echo -e "${CLR_BLUE}${CLR_RESET}" echo -e "${CLR_BLUE}${CLR_RESET}"
} }
function __log_marker_ok() { function __log_marker_ok()
{
echo -e "${CLR_GREEN}${CLR_RESET}" echo -e "${CLR_GREEN}${CLR_RESET}"
} }
function __log_marker_ok_blue() { function __log_marker_ok_blue()
{
echo -e "${CLR_BLUE}${CLR_RESET}" echo -e "${CLR_BLUE}${CLR_RESET}"
} }
function __log_marker_warn() { function __log_marker_warn()
{
echo -e "${CLR_YELLOW}${CLR_RESET}" echo -e "${CLR_YELLOW}${CLR_RESET}"
} }
function __log_marker_err() { function __log_marker_err()
{
echo -e "${CLR_RED}${CLR_RESET}" echo -e "${CLR_RED}${CLR_RESET}"
} }
function __log_indent() { function __log_indent()
{
echo " " echo " "
} }
# -- Log -- # # -- Log -- #
function msg() { function msg()
{
echo -e "$(__log_marker) $1" echo -e "$(__log_marker) $1"
} }
function msg_done() { function msg_done()
{
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_prompt() { function msg_prompt()
{
echo -e "$(__log_marker) $1" echo -e "$(__log_marker) $1"
} }
function msg_prompt_done() { function msg_prompt_done()
{
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_nested() { function msg_nested()
{
echo -e "$(__log_indent)$(__log_marker) $1" echo -e "$(__log_indent)$(__log_marker) $1"
} }
function msg_nested_done() { function msg_nested_done()
{
echo -e "$(__log_indent)$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_indent)$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_run() { function msg_run()
{
echo -e "${CLR_GREEN}$1${CLR_RESET} $2" echo -e "${CLR_GREEN}$1${CLR_RESET} $2"
} }
function msg_ok() { function msg_ok()
{
echo -e "$(__log_marker_ok) $1" echo -e "$(__log_marker_ok) $1"
} }
function msg_warn() { function msg_warn()
{
echo -e "$(__log_marker_warn) $1" echo -e "$(__log_marker_warn) $1"
} }
function msg_err() { function msg_err()
{
echo -e "$(__log_marker_err) $1" echo -e "$(__log_marker_err) $1"
} }
# -- Menu builder -- # # -- Menu builder -- #
function menu_section() { function menu_section()
{
LINE=$(printf '%-18s [ %-15s ]\n' "$1" "$2") LINE=$(printf '%-18s [ %-15s ]\n' "$1" "$2")
echo -e " $(__log_marker) $LINE" echo -e " $(__log_marker) $LINE"
} }
function menu_item() { 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"
} }