Compare commits

...

32 Commits

Author SHA1 Message Date
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
Ismo Vuorinen
34a0d7d8c4 brew: Brewfile update 2023-01-17 10:02:09 +02:00
Ismo Vuorinen
65bf470c5b dfm: brew autoupdate now removes first, then adds 2023-01-17 10:01:40 +02:00
Ismo Vuorinen
965c47efef zshrc: secret exports, alias and functions files 2023-01-17 10:00:49 +02:00
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
Ismo Vuorinen
4cf956aa17 Lots of tweaks and changes, yolo 2023-01-04 22:02:29 +02:00
Ismo Vuorinen
f9142a4780 Lots of tweaks and changes, yolo 2023-01-04 21:27:24 +02:00
Ismo Vuorinen
bb921189e2 nvim: Remove compiled packer state from repository 2023-01-04 15:47:33 +02:00
a4eb0b0186 nvim: Plugins, formatting, comments, n-maps 2023-01-04 12:11:45 +02:00
1222b8fdb3 brew: update Brewfile 2023-01-02 09:24:50 +02:00
cced3a5310 nvim: return to palenight, added orgmode, reformat 2023-01-02 09:24:34 +02:00
Ismo Vuorinen
6c680a0fa9 dfm: tweaks 2022-12-29 10:39:05 +02:00
Ismo Vuorinen
6746fb5381 nvim: orgmode, ts ensure_installed 2022-12-29 10:38:52 +02:00
7b2831ec94 nvim: Docs, simplification, new plugins 2022-12-29 08:46:06 +02:00
a605d46294 nvim plugins and configs 2022-12-29 04:24:48 +02:00
Ismo Vuorinen
5e98f61942 Moved custom plugins to their own file 2022-12-27 16:21:39 +02:00
Ismo Vuorinen
e2583f4d91 Fix Sparragus/zsh-auto-nvm-use 2022-12-27 16:20:56 +02:00
80b2e542bf Changed theme 2022-12-25 01:44:53 +02:00
9c3ba8f2e8 Changed ssh config host order, added zdots alias 2022-12-24 00:22:34 +02:00
632424ecf9 Update nvim plugins 2022-12-23 21:52:09 +02:00
Ismo Vuorinen
8c8436254e Change $EDITOR to nvim 2022-12-23 21:45:53 +02:00
Ismo Vuorinen
fe6f070beb -m Tweaks 2022-12-23 13:30:52 +02:00
Ismo Vuorinen
2a5b2400d7 Add tmux config, fix ssh config, updated nvim pkg 2022-12-22 13:59:00 +02:00
e109cca22a nvim config, updated install-dotfiles.sh 2022-12-21 02:04:09 +02:00
1d948f6915 First edits with nvim
Set up with https://github.com/nvim-lua/kickstart.nvim
2022-12-21 00:58:24 +02:00
24 changed files with 1316 additions and 179 deletions

View File

@@ -3,27 +3,10 @@ root = true
[*]
charset = utf-8
end_of_line = lf
# indent_size = 4
indent_size = 2
indent_style = space
insert_final_newline = true
# max_line_length = 160
# tab_width = 4
trim_trailing_whitespace = true
[{*.yaml,*.yml}]
indent_size = 2
[*.sh]
indent_size = 2
tab_width = 2
shell_variant = bash # like -ln=posix
binary_next_line = true # like -bn
switch_case_indent = true # like -ci
space_redirects = true # like -sr
keep_padding = false # like -kp
function_next_line = true # like -fn
never_split = false # like -ns
[local/bin/antigen.zsh]
ignore = true

View File

@@ -14,8 +14,6 @@ tap "mongodb/brew"
tap "shivammathur/extensions"
tap "shivammathur/php"
tap "teamookla/speedtest"
# Interpreted, interactive, object-oriented programming language
brew "python@3.10"
# Automate deployment, configuration, and upgrading
brew "ansible"
# Zstandard is a real-time compression algorithm
@@ -36,6 +34,8 @@ brew "glib"
brew "pkg-config"
# Open source suite of directory software
brew "openldap"
# Get a file from an HTTP, HTTPS or FTP server
brew "curl"
# Libraries to talk to Microsoft SQL Server and Sybase databases
brew "freetds"
# C/C++ and Java libraries for Unicode and globalization
@@ -48,6 +48,8 @@ brew "php"
brew "composer"
# GNU File, Shell, and Text utilities
brew "coreutils"
# Get, unpack, build, and install modules from CPAN
brew "cpanminus"
# Diff that understands syntax
brew "difftastic"
# Tool for exploring each layer in a docker image
@@ -58,6 +60,8 @@ brew "dog"
brew "eg-examples"
# CLI for templating and/or deploying FaaS functions
brew "faas-cli"
# Simple, fast and user-friendly alternative to find
brew "fd"
# Monitor a directory for changes and run a shell command
brew "fswatch"
# GitHub command-line tool
@@ -114,6 +118,10 @@ brew "m-cli"
brew "mas"
# Terminal-based visual file manager
brew "midnight-commander"
# Ambitious Vim-fork focused on extensibility and agility
brew "neovim"
# No Nonsense Neovim Client in Rust
brew "neovide"
# Port scanning utility for large networks
brew "nmap"
# Manage multiple Node.js versions
@@ -122,6 +130,12 @@ brew "nvm"
brew "openjdk"
# Generate clients, server & docs from an OpenAPI spec (v2, v3)
brew "openapi-generator"
# Swiss-army knife of markup format conversion
brew "pandoc"
# Highly capable, feature-rich programming language
brew "perl"
# Interpreted, interactive, object-oriented programming language
brew "python@3.10"
# Interpreted, interactive, object-oriented programming language
brew "python@3.8"
# RC file (dotfile) management
@@ -134,6 +148,8 @@ brew "ruby"
brew "shellcheck"
# Autoformat shell script source code
brew "shfmt"
# Cross-shell prompt for astronauts
brew "starship"
# Version control system designed to be a better CVS
brew "subversion"
# Send macOS User Notifications from the command-line
@@ -236,6 +252,8 @@ cask "qlstephen"
cask "quicklook-json"
# QuickLook generator for Adobe Swatch Exchange files
cask "quicklookase"
# Automatically hides or quits apps after periods of inactivity
cask "quitter"
# Move and resize windows using keyboard shortcuts or snap areas
cask "rectangle"
# MySQL/MariaDB database management
@@ -254,8 +272,12 @@ cask "syntax-highlight"
cask "visual-studio-code"
# Multimedia player
cask "vlc"
# Spell-checking service for Finnish
cask "voikkospellservice"
# Rust-based terminal
cask "warp"
# View output from scripts in the menu bar
cask "xbar"
mas "1Password for Safari", id: 1569813296
mas "Flow", id: 1423210932
mas "GarageBand", id: 682658836
@@ -263,4 +285,5 @@ mas "iMovie", id: 408981434
mas "Keynote", id: 409183694
mas "Numbers", id: 409203825
mas "Pages", id: 409201541
mas "pullBar", id: 1601913905
mas "Tailscale", id: 1475387142

View File

@@ -58,19 +58,20 @@ alias zapds='find . -name ".DS_Store" -print -delete'
alias t='tail -f' # tail with follow flag on
alias dn='du -chd1' # directory usage, return only the total
alias code_scanner='docker run \
--env SOURCE_CODE="$PWD" \
--volume "$PWD":/code \
alias code_scanner="docker run \
--env SOURCE_CODE='${PWD}' \
--volume '${PWD}':/code \
--volume /var/run/docker.sock:/var/run/docker.sock \
registry.gitlab.com/gitlab-org/ci-cd/codequality:${CODEQUALITY_VERSION:-latest} \
/code'
/code"
alias composerUp='composer global update'
alias npmUp='npm -g up'
alias zedit='code ~/.zshrc ~/.alias'
alias zedit='$EDITOR ~/.dotfiles'
if [[ -f "$HOME/.aliases.local" ]]; then
# shellcheck disable=SC1091
source "$HOME/.aliases.local"
fi

View File

@@ -0,0 +1,6 @@
[General]
ApplicationUpdateChannel=release
CheckApplicatonUpdates=true
FirmwareUpdateChannel=release
LastFolderUrl=/Users/ivuorinen
ShowHiddenFiles=false

View File

@@ -4,6 +4,7 @@
*.cache
*~
*-secret
__secret
__ignored
__test_*.php

732
config/nvim/init.lua Normal file
View File

@@ -0,0 +1,732 @@
-- Install packer
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
is_bootstrap = true
vim.fn.system {
'git', 'clone', '--depth', '1',
'https://github.com/wbthomason/packer.nvim',
install_path
}
vim.cmd [[packadd packer.nvim]]
end
require('packer').startup(function(use)
-- Package manager
use 'wbthomason/packer.nvim'
use { -- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
requires = {
-- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP
'j-hui/fidget.nvim',
},
}
use { -- Autocompletion
'hrsh7th/nvim-cmp',
requires = {
'hrsh7th/cmp-nvim-lsp',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
},
}
use { -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
run = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
end,
}
use { -- Additional text objects via treesitter
'nvim-treesitter/nvim-treesitter-textobjects',
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
use 'drewtempelmeyer/palenight.vim'
-- Fancier statusline
use 'nvim-lualine/lualine.nvim'
-- Add indentation guides even on blank lines.
use 'lukas-reineke/indent-blankline.nvim'
-- "gc" to comment visual regions/lines
use 'numToStr/Comment.nvim'
-- Detect tabstop and shiftwidth automatically.
use 'tpope/vim-sleuth'
-- Fuzzy Finder (files, lsp, etc)
use { 'nvim-telescope/telescope.nvim',
branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available
use { 'nvim-telescope/telescope-fzf-native.nvim',
run = 'make', cond = vim.fn.executable 'make' == 1 }
-- Add custom plugins to packer from
-- ~/.config/nvim/lua/custom/plugins.lua
local has_plugins, plugins = pcall(require, 'custom.plugins')
if has_plugins then
plugins(use)
end
if is_bootstrap then
require('packer').sync()
end
end)
-- When we are bootstrapping a configuration, it doesn't
-- make sense to execute the rest of the init.lua.
--
-- You'll need to restart nvim, and then it will work.
if is_bootstrap then
print '=================================='
print ' Plugins are being installed'
print ' Wait until Packer completes,'
print ' then restart nvim'
print '=================================='
return
end
-- Automatically source and re-compile packer
-- whenever you save this init.lua, or packages.lua
local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
vim.api.nvim_create_autocmd('BufWritePost', {
command = 'source <afile> | PackerCompile',
group = packer_group,
pattern = { vim.fn.expand '$MYVIMRC' },
})
-- Automatically run PackerSync for plugins.lua files.
vim.api.nvim_create_autocmd('BufWritePost', {
command = 'source <afile> | PackerSync | PackerCompile',
group = packer_group,
pattern = { '~/.dotfiles/config/nvim/**/plugins.lua' },
})
-- [[ Setting options ]]
-- See `:help vim.o`
-- Set highlight on search
vim.o.hlsearch = false
-- Make line numbers default, enabled relative line numbers
vim.wo.number = true
vim.opt.relativenumber = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case insensitive searching UNLESS /C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Decrease update time
vim.o.updatetime = 250
vim.wo.signcolumn = 'yes'
-- Set colorscheme
vim.o.termguicolors = true
vim.cmd.colorscheme('palenight')
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- Configure and disable providers.
vim.g.python3_host_prog = '/opt/homebrew/bin/python3'
vim.g.loaded_ruby_provider = 0
-- Setup winbar
-- See :h statusline
vim.o.winbar = '%=%m %f'
-- [[ Basic Keymaps ]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required
-- (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Misc options.
vim.o.incsearch = true
-- Keymap settings, etc.
-- ~/.config/nvim/lua/custom/keymaps.lua
local map = vim.api.nvim_set_keymap
local default_options_table = {
expr = true,
silent = true,
noremap = true,
}
-- normal mode keymap setter
---@param keys string Trigger keys
---@param func string Function or command to run
---@param opts table Optional table of vim.keymap.set options.
---@param desc string Optional description
local nmap = function(keys, func, opts, desc)
if desc then
desc = 'keymaps.nmap: ' .. desc
end
local options = default_options_table
-- If we have options, merge them to the local options table
if opts then
for k, v in pairs(opts) do
options[k] = v
end
end
vim.keymap.set('n', keys, func, options)
end
-- visual mode keymap setter
---@param keys string Trigger keys
---@param func string Function or command to run
---@param opts table Optional table of vim.keymap.set options.
---@param desc string Optional description
local vmap = function(keys, func, opts, desc)
if desc then
desc = 'keymaps.vmap: ' .. desc
end
local options = default_options_table
-- If we have options, merge them to the local options table
if opts then
for k, v in pairs(opts) do
options[k] = v
end
end
vim.keymap.set('v', keys, func, options)
end
-- Format document
nmap("<leader>D", ":Format")
-- Deal with word wrap
nmap('k', "v:count == 0 ? 'gk' : 'k'")
nmap('j', "v:count == 0 ? 'gj' : 'j'")
-- Diagnostic keymaps
nmap('dz', vim.diagnostic.goto_prev)
nmap('dx', vim.diagnostic.goto_next)
nmap('<leader>e', vim.diagnostic.open_float)
nmap('<leader>q', vim.diagnostic.setloclist)
--
-- ThePrimeagen/refactoring.nvim
-- https://github.com/ThePrimeagen/refactoring.nvim
--
-- Remaps for the refactoring operations currently offered by the plugin
local rf = { noremap = true, silent = true, expr = false }
vmap("<leader>re", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], rf)
vmap("<leader>rf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]], rf)
vmap("<leader>rv", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], rf)
vmap("<leader>ri", [[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], rf)
-- Extract block doesn't need visual mode
nmap("<leader>rb", [[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]], rf)
nmap("<leader>rbf", [[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]], rf)
-- Inline variable can also pick up the identifier currently under the cursor without visual mode
nmap("<leader>ri", [[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], rf)
-- prompt for a refactor to apply when the remap is triggered
vmap("<leader>rr", ":lua require('refactoring').select_refactor()<CR>", rf)
--
--
--
-- barbar keymaps
local barbar_opts = { noremap = true, silent = true }
-- Move to previous/next
map('n', '<C-,>', '<Cmd>BufferPrevious<CR>', barbar_opts)
map('n', '<C-.>', '<Cmd>BufferNext<CR>', barbar_opts)
-- Re-order to previous/next
map('n', '<C-<>', '<Cmd>BufferMovePrevious<CR>', barbar_opts)
map('n', '<C->>', '<Cmd>BufferMoveNext<CR>', barbar_opts)
-- Goto buffer in position...
map('n', '<leader>b1', '<Cmd>BufferGoto 1<CR>', barbar_opts)
map('n', '<leader>b2', '<Cmd>BufferGoto 2<CR>', barbar_opts)
map('n', '<leader>b3', '<Cmd>BufferGoto 3<CR>', barbar_opts)
map('n', '<leader>b4', '<Cmd>BufferGoto 4<CR>', barbar_opts)
map('n', '<leader>b5', '<Cmd>BufferGoto 5<CR>', barbar_opts)
map('n', '<leader>b6', '<Cmd>BufferGoto 6<CR>', barbar_opts)
map('n', '<leader>b7', '<Cmd>BufferGoto 7<CR>', barbar_opts)
map('n', '<leader>b8', '<Cmd>BufferGoto 8<CR>', barbar_opts)
map('n', '<leader>b9', '<Cmd>BufferGoto 9<CR>', barbar_opts)
map('n', '<leader>b0', '<Cmd>BufferLast<CR>', barbar_opts)
-- Pin/unpin buffer
map('n', '<A-p>', '<Cmd>BufferPin<CR>', barbar_opts)
-- Close buffer
map('n', '<A-c>', '<Cmd>BufferClose<CR>', barbar_opts)
-- Wipeout buffer
-- :BufferWipeout
-- Close commands
-- :BufferCloseAllButCurrent
-- :BufferCloseAllButPinned
-- :BufferCloseAllButCurrentOrPinned
-- :BufferCloseBuffersLeft
-- :BufferCloseBuffersRight
-- Magic buffer-picking mode
map('n', '<C-p>', '<Cmd>BufferPick<CR>', barbar_opts)
-- Sort automatically by...
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', barbar_opts)
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', barbar_opts)
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', barbar_opts)
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', barbar_opts)
-- Other:
-- :BarbarEnable - enables barbar (enabled by default)
-- :BarbarDisable - very bad command, should never be used
local highlight_group = vim.api.nvim_create_augroup(
'YankHighlight', { clear = true }
)
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})
-- Set lualine as statusline
-- See `:help lualine.txt`
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = '|',
section_separators = '',
},
}
-- Enable Comment.nvim
require('Comment').setup()
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
require('indent_blankline').setup {
-- char = '┊',
show_trailing_blankline_indent = true,
space_char_blankline = " ",
show_current_context = 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 ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
}
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
local ks = vim.keymap.set
local tl = require('telescope.builtin')
-- See `:help telescope.builtin`
ks('n', '<leader>?', tl.oldfiles, { desc = '[?] Find recently opened files' })
ks('n', '<leader><space>', tl.buffers, { desc = '[ ] Find existing buffers' })
ks('n', '<leader>/', function()
-- You can pass additional configuration to telescope to
-- change theme, layout, etc.
tl.current_buffer_fuzzy_find(
require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer]' })
ks('n', '<leader>sf', tl.find_files, { desc = '[S]earch [F]iles' })
ks('n', '<leader>sh', tl.help_tags, { desc = '[S]earch [H]elp' })
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>sd', tl.diagnostics, { desc = '[S]earch [D]iagnostics' })
-- Add harpoon to telescope
require("telescope").load_extension('harpoon')
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want
-- installed for treesitter
ensure_installed = {
'bash',
'c', 'comment', 'cpp',
'diff', 'dockerfile',
'gitattributes', 'gitignore', 'go',
'html', 'http',
'javascript', 'jq', 'jsdoc', 'json',
'lua',
'markdown',
'org',
'php', 'phpdoc', 'python',
'regex', 'rust',
'scss', 'sql',
'typescript',
'vim', 'vue',
'yaml',
'help',
},
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { 'org' },
},
indent = { enable = true, disable = { 'python' } },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<c-backspace>',
},
},
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
-- 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.
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
-- NOTE: Remember that lua is a real programming language,
-- and as such it is possible to define small helper and
-- utility functions so you don't have to repeat yourself
-- many times.
--
-- In this case, we create a function that lets us more
-- easily define mappings specific for LSP related items.
-- It sets the mode, buffer and description for us each time.
local nm = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
local t = require('telescope.builtin')
local vbuf = vim.lsp.buf
nm('<leader>rn', vbuf.rename, '[R]e[n]ame')
nm('<leader>ca', vbuf.code_action, '[C]ode [A]ction')
nm('gd', vbuf.definition, '[G]oto [D]efinition')
nm('gr', t.lsp_references, '[G]oto [R]eferences')
nm('gI', vbuf.implementation, '[G]oto [I]mplementation')
nm('<leader>D', vbuf.type_definition, 'Type [D]efinition')
nm('<leader>ds', t.lsp_document_symbols, '[D]ocument [S]ymbols')
nm('<leader>ws', t.lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nm('K', vbuf.hover, 'Hover Documentation')
nm('<C-k>', vbuf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nm('gD', vbuf.declaration, '[G]oto [D]eclaration')
nm('<leader>wa', vbuf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nm('<leader>wr', vbuf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nm('<leader>wl', function()
print(vim.inspect(vbuf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
if vim.lsp.buf.format then
vim.lsp.buf.format()
elseif vim.lsp.buf.formatting then
vim.lsp.buf.formatting()
end
end, { desc = 'Format current buffer with LSP' })
end
-- Setup mason so it can manage external tooling
require('mason').setup()
require("null-ls").setup()
-- Enable the following language servers.
-- Feel free to add/remove any LSPs that you want here.
-- They will automatically be installed.
-- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
local servers = {
-- a
'angularls',
'ansiblels',
-- b
'bashls',
-- c
'clangd',
'cssls',
-- d
'dockerls',
-- e
'eslint',
'emmet_ls',
-- f
-- g
'gopls',
'graphql',
-- h
'html',
-- i
-- j
'quick_lint_js', -- js
'jsonls',
-- k
-- l
'sumneko_lua', -- lua
-- m
'marksman', -- markdown
-- n
-- o
-- p
'intelephense', 'phpactor', 'psalm',
'pyright',
-- q
-- r
'rust_analyzer',
-- s
'sqlls',
'stylelint_lsp',
-- t
'tailwindcss',
'terraformls',
'tflint',
'tsserver',
-- u
-- v / w
'volar', -- vue
'vuels', -- vue
-- x / y / z
'lemminx', -- xml
'yamlls', -- yaml
}
-- Ensure the servers above are installed
require('mason-lspconfig').setup {
ensure_installed = servers,
}
require("mason-lspconfig").setup_handlers {
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function(server_name)
-- default handler (optional)
require("lspconfig")[server_name].setup {}
end,
}
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
for _, lsp in ipairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
-- Turn on lsp status information
require('fidget').setup()
-- Example custom configuration for lua.
-- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
require('lspconfig').sumneko_lua.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're
-- using (most likely LuaJIT)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file('', true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized
-- but unique identifier
telemetry = { enable = false },
},
},
}
-- nvim-cmp setup
local cmp = require 'cmp'
local luasnip = require 'luasnip'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
vim.api.nvim_create_autocmd("BufWritePost",
{ pattern = "plugins.lua", command = "source <afile> | PackerSync" })
vim.api.nvim_create_autocmd("BufRead",
{ pattern = "*/node_modules/*", command = "lua vim.diagnostic.disable(0)" })
vim.api.nvim_create_autocmd("BufNewFile",
{ pattern = "*/node_modules/*", command = "lua vim.diagnostic.disable(0)" })
-- Enable spell checking for certain file types
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" },
{ pattern = { "*.txt", "*.md", "*.tex" },
command = "setlocal spell" })
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -0,0 +1,210 @@
return function(use)
-- 💥 Create key bindings that stick.
-- WhichKey is a lua plugin that displays a popup with
-- possible keybindings of the command you started typing.
-- https://github.com/folke/which-key.nvim
use({
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end
})
-- 🍨 Soothing pastel theme for (Neo)vim
-- https://github.com/catppuccin/nvim
-- use { "catppuccin/nvim", as = "catppuccin" }
-- vim.cmd.colorscheme('catppuccin-latte')
-- markdown preview plugin for (neo)vim
-- https://github.com/iamcco/markdown-preview.nvim
use({
"iamcco/markdown-preview.nvim",
run = function()
vim.fn["mkdp#util#install"]()
end,
})
-- The neovim tabline plugin.
-- https://github.com/romgrk/barbar.nvim
use 'nvim-tree/nvim-web-devicons'
use { 'romgrk/barbar.nvim', wants = 'nvim-web-devicons' }
--
-- Pretty UI
--
-- Neovim plugin to improve the default vim.ui interfaces
use 'stevearc/dressing.nvim'
-- A fancy, configurable, notification manager for NeoVim
use 'rcarriga/nvim-notify'
-- Non-intrusive notification system for neovim
use 'vigoux/notifier.nvim'
-- ✅ Highlight, list and search todo comments in your projects
use {
'folke/todo-comments.nvim',
requires = 'nvim-lua/plenary.nvim',
config = function()
require('todo-comments').setup {}
end,
}
-- The Refactoring library based off the Refactoring book by Martin Fowler
-- https://github.com/ThePrimeagen/refactoring.nvim
use {
"ThePrimeagen/refactoring.nvim",
requires = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" }
}
}
-- harpoon, by ThePrimeagen
-- https://github.com/ThePrimeagen/harpoon
use {
"ThePrimeagen/harpoon",
requires = { { "nvim-lua/plenary.nvim" } }
}
-- An asynchronous linter plugin for Neovim complementary to
-- the built-in Language Server Protocol support.
-- https://github.com/mfussenegger/nvim-lint
use 'mfussenegger/nvim-lint'
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
-- nvim orgmode, to get me use nvim even more.
use({
"nvim-orgmode/orgmode",
config = function()
require('orgmode').setup_ts_grammar()
end,
})
-- Markdown support
use 'preservim/vim-markdown'
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
-- https://github.com/jghauser/mkdir.nvim
use { 'jghauser/mkdir.nvim' }
-- Neovim plugin for dimming the highlights of unused
-- functions, variables, parameters, and more
-- https://github.com/zbirenbaum/neodim
use {
"zbirenbaum/neodim",
event = "LspAttach",
config = function()
require("neodim").setup({
alpha = 0.75,
blend_color = "#000000",
update_in_insert = {
enable = true,
delay = 100,
},
hide = {
virtual_text = true,
signs = true,
underline = true,
}
})
end
}
-- EditorConfig plugin for Neovim
-- https://github.com/gpanders/editorconfig.nvim
use { 'gpanders/editorconfig.nvim' }
-- Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
-- https://github.com/jose-elias-alvarez/null-ls.nvim
use {
"jose-elias-alvarez/null-ls.nvim",
config = function()
local n = require("null-ls")
local b = n.builtins
require("null-ls").setup({
b.code_actions.eslint,
b.code_actions.shellcheck,
b.code_actions.xo,
b.completion.luasnip,
b.completion.spell,
b.diagnostics.actionlint,
b.diagnostics.alex,
b.diagnostics.ansiblelint,
b.diagnostics.codespell,
b.diagnostics.dotenv_linter,
b.diagnostics.editorconfig_checker,
b.diagnostics.eslint,
b.diagnostics.hadolint,
b.diagnostics.jsonlint,
b.diagnostics.luacheck,
b.diagnostics.markdownlint,
b.diagnostics.php,
b.diagnostics.phpcs,
b.diagnostics.phpstan,
b.diagnostics.psalm,
b.diagnostics.shellcheck,
b.diagnostics.spectral,
b.diagnostics.stylelint,
b.diagnostics.todo_comments,
b.diagnostics.trail_space,
b.diagnostics.xo,
b.diagnostics.yamllint,
b.formatting.blade_formatter,
b.formatting.eslint,
b.formatting.fixjson,
b.formatting.lua_format,
b.formatting.markdownlint,
b.formatting.prettier,
b.formatting.shfmt,
b.formatting.stylelint,
-- b.formatting.stylua,
b.formatting.terraform_fmt,
b.formatting.trim_whitespace,
b.formatting.yamlfmt,
})
end,
requires = { "nvim-lua/plenary.nvim" }
}
-- mason-null-ls bridges mason.nvim with the null-ls plugin
-- - making it easier to use both plugins together.
-- https://github.com/jay-babu/mason-null-ls.nvim
use {
"jayp0521/mason-null-ls.nvim",
config = function()
require("mason-null-ls").setup({
ensure_installed = nil,
automatic_installation = true,
automatic_setup = false,
})
end,
requires = { "jose-elias-alvarez/null-ls.nvim" }
}
-- WakaTime Support
use { "wakatime/vim-wakatime" }
end

1
config/nvim/plugin/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
packer_compiled.lua

53
config/tmux/tmux.conf Normal file
View File

@@ -0,0 +1,53 @@
# ~/.config/tmux/tmux.conf, or .dotfiles/config/tmux/tmux.conf
#
# Contains configuration from the follwing sources:
# - https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html
# -
# unbind default prefix and set it to ctrl-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# make delay shorter
set -sg escape-time 0
#### key bindings ####
# reload config file
bind r source-file ~/.dotfiles/config/tmux/tmux.conf \; display "tmux.conf reloaded!"
# quickly open a new window
bind N new-window
# synchronize all panes in a window
bind y setw synchronize-panes
# pane movement shortcuts (same as vim)
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# enable mouse support for switching panes/windows
#set -g mouse-utf8 on
#set -g mouse on
#### copy mode : vim ####
# set vi mode for copy mode
setw -g mode-keys vi
# copy mode using 'Esc'
unbind [
bind Escape copy-mode
# start selection with 'space' and copy using 'y'
#bind -t vi-copy 'y' copy-selection
# paste using 'p'
unbind p
bind p paste-buffer

View File

@@ -14,7 +14,7 @@
SCRIPT=$(basename "$0")
source "$HOME/.dotfiles/scripts/shared.sh"
source "$DOTFILES/scripts/shared.sh"
function section_install
{
@@ -22,39 +22,39 @@ function section_install
case "$1" in
all)
$0 install antigen && msg_done "New antigen installed"
$0 install macos && msg_done "macOS Defaults set"
$0 install brew && msg_done "Brewfile defined apps has been installed"
$0 install ext_gh && msg_done "Extensions for GitHub CLI have been installed"
$0 install ext_go && msg_done "Go packages have been installed"
$0 install antigen
$0 install macos
$0 install brew
$0 install ext_gh
$0 install ext_go
;;
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 bundle install --file="$BREWFILE" && echo "🎉 Done!"
brew bundle install --file="$BREWFILE" && msg_done "🎉 macOS Defaults set!"
;;
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)
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)
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)
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_item "all" "Installs antigen, macos, brew, ext_gh and ext_go"
menu_item "antigen" "Updates the antigen.zsh file"
menu_item "brew" "Install Brewfile contents"
menu_item "ext_gh" "Install GitHub CLI Extensions"
menu_item "ext_go" "Install Go Packages"
menu_item "macos" "Setup nice macOS defaults"
menu_item "settler" "Runs the WIP settler.sh"
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 "antigen" "Updates the antigen.zsh file"
menu_item "brew" "Install Brewfile contents"
menu_item "ext_gh" "Install GitHub CLI Extensions"
menu_item "ext_go" "Install Go Packages"
menu_item "macos" "Setup nice macOS defaults"
menu_item "settler" "Runs the WIP settler.sh"
;;
esac
}
@@ -70,20 +70,21 @@ function section_brew
case "$1" in
install)
brew bundle install --file="$BREWFILE" && echo "🎉 Done!"
brew bundle install --file="$BREWFILE" && msg_done "🎉 Done!"
;;
update)
brew update && brew outdated && brew upgrade && brew cleanup
echo "🎉 Done!"
msg_done "🎉 Done!"
;;
updatebundle)
# Updates .dotfiles/Brewfile with descriptions
brew bundle dump \
--force \
--file="$BREWFILE" \
--describe && msg_ok "🎉 Done!"
--describe && msg_done "🎉 Done!"
;;
autoupdate)
brew autoupdate delete
brew autoupdate start 43200 --upgrade --cleanup --immediate
;;
*)
@@ -102,38 +103,30 @@ function section_dotfiles
case "$1" in
link)
rcup -B "$HOSTNAME" -f -v && echo "🎉 Done!"
rcup -B "$HOSTNAME" -f -v && msg_done "🎉 dotfiles have been linked!"
;;
update)
# Updates .dotfiles/scripts/install.sh and formats it
rcup -B 0 -g \
| tee "$INSTALL_SCRIPT" 1> /dev/null \
&& 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
echo "🎉 Done!"
$0 dotfiles link
msg_done "🎉 dotfiles updated and linked!"
;;
shfmt)
# Format shell scripts according to following rules.
shfmt \
--find \
--list \
--write \
--diff \
--simplify \
--language-dialect bash \
--indent 2 \
--binary-next-line \
--case-indent \
--space-redirects \
--func-next-line \
"$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_item "link" "Use rcrc to update dotfile links"
menu_item "update" "Updates dotfile links, installs host specific overrides automatically"
menu_item "shfmt" "Run shfmt to all dotfiles"
menu_item "link" "Use rcrc to update dotfile links"
menu_item "update" "Updates dotfile links (scripts/install.sh), formats it and runs it."
menu_item "shfmt" "Run shfmt to all dotfiles"
;;
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"

View File

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

View File

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

View File

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

View File

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

View File

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

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)

View File

@@ -9,7 +9,7 @@
# env VERBOSE=1 sh install-dotfiles.sh
#
# DO NOT EDIT THIS FILE
#
#
# This file is generated by rcm(7) as:
#
# rcup -B 0 -g
@@ -22,14 +22,12 @@
: ${MKDIR:=/bin/mkdir}
: ${RM:=/bin/rm}
: ${DIRNAME:=/usr/bin/dirname}
verbose()
{
verbose() {
if [ "$VERBOSE" -gt 0 ]; then
echo "$@"
fi
}
handle_file_cp()
{
handle_file_cp() {
if [ -e "$2" ]; then
printf "%s " "overwrite $2? [yN]"
read overwrite
@@ -47,8 +45,7 @@ handle_file_cp()
$MKDIR -p "$($DIRNAME "$2")"
$CP -R "$1" "$2"
}
handle_file_ln()
{
handle_file_ln() {
if [ -e "$2" ]; then
printf "%s " "overwrite $2? [yN]"
read overwrite
@@ -70,19 +67,25 @@ handle_file_ln "$HOME/.dotfiles/bash_profile" "$HOME/.bash_profile"
handle_file_ln "$HOME/.dotfiles/bashrc" "$HOME/.bashrc"
handle_file_ln "$HOME/.dotfiles/config/alias" "$HOME/.config/alias"
handle_file_ln "$HOME/.dotfiles/config/exports" "$HOME/.config/exports"
handle_file_ln "$HOME/.dotfiles/config/flipperdevices.com/qFlipper.ini" "$HOME/.config/flipperdevices.com/qFlipper.ini"
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/git/config" "$HOME/.config/git/config"
handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore"
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/plugin/packer_compiled.lua" "$HOME/.config/nvim/plugin/packer_compiled.lua"
handle_file_ln "$HOME/.dotfiles/config/tmux/tmux.conf" "$HOME/.config/tmux/tmux.conf"
handle_file_ln "$HOME/.dotfiles/config/wtf/config.yml" "$HOME/.config/wtf/config.yml"
handle_file_ln "$HOME/.dotfiles/git_profiles" "$HOME/.git_profiles"
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/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-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-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-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"

View File

@@ -12,77 +12,102 @@ CLR_BLUE='\033[1;34m'
CLR_RESET="\033[0m"
# -- Helpers -- #
function __log_marker() {
function __log_marker()
{
echo -e "${CLR_BLUE}${CLR_RESET}"
}
function __log_marker_ok() {
function __log_marker_ok()
{
echo -e "${CLR_GREEN}${CLR_RESET}"
}
function __log_marker_ok_blue() {
function __log_marker_ok_blue()
{
echo -e "${CLR_BLUE}${CLR_RESET}"
}
function __log_marker_warn() {
function __log_marker_warn()
{
echo -e "${CLR_YELLOW}${CLR_RESET}"
}
function __log_marker_err() {
function __log_marker_err()
{
echo -e "${CLR_RED}${CLR_RESET}"
}
function __log_indent() {
function __log_indent()
{
echo " "
}
# -- Log -- #
function msg() {
function msg()
{
echo -e "$(__log_marker) $1"
}
function msg_done() {
function msg_done()
{
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
}
function msg_prompt() {
function msg_prompt()
{
echo -e "$(__log_marker) $1"
}
function msg_prompt_done() {
function msg_prompt_done()
{
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
}
function msg_nested() {
function msg_nested()
{
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)"
}
function msg_run() {
function msg_run()
{
echo -e "${CLR_GREEN}$1${CLR_RESET} $2"
}
function msg_ok() {
function msg_ok()
{
echo -e "$(__log_marker_ok) $1"
}
function msg_warn() {
function msg_warn()
{
echo -e "$(__log_marker_warn) $1"
}
function msg_err() {
function msg_err()
{
echo -e "$(__log_marker_err) $1"
}
# -- Menu builder -- #
function menu_section() {
function menu_section()
{
LINE=$(printf '%-18s [ %-15s ]\n' "$1" "$2")
echo -e " $(__log_marker) $LINE"
}
function menu_item() {
function menu_item()
{
LINE=$(printf '%-15s %-30s\n' "$1" "$2")
echo -e "$(__log_indent)$(__log_marker) $LINE"
}
# https://stackoverflow.com/a/85932
function fn_exists()
{
declare -f -F "$1" > /dev/null
return $?
}

View File

@@ -1,2 +1,16 @@
Host github.com
User git
HostName github.com
IdentityFile ~/.ssh/id_rsa
Host bitbucket.com
Hostname bitbucket.com
IdentityFile ~/.ssh/id_rsa
Host gitlab.com
Hostname gitlab.com
IdentityFile ~/.ssh/id_rsa
Host *
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"

3
vuerc
View File

@@ -20,4 +20,5 @@
"cssPreprocessor": "dart-sass"
}
}
}
}

16
zshrc
View File

@@ -5,7 +5,7 @@
autoload -U colors zsh/terminfo
colors
export PATH="/opt/homebrew/bin:/usr/local/sbin:$PATH"
export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/usr/local/sbin:$PATH"
if [ command -v brew &> /dev/null ]; then
BREW_BIN=$(brew --prefix)/bin
@@ -27,6 +27,10 @@ if command -v go &> /dev/null; then
fi
fi
if command -v nvim &> /dev/null; then
export EDITOR="nvim"
fi
LOCAL_BIN="$HOME/.local/bin"
COMPOSER_DIR="$HOME/.composer/vendor/bin"
export PATH="$LOCAL_BIN:$COMPOSER_DIR:$PATH"
@@ -44,7 +48,9 @@ function x-load-configs()
# Load the shell dotfiles, and then some:
for file in ~/.dotfiles/config/{exports,alias,functions}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file"
[ -r "$file-secret" ] && [ -f "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
[ -r "$file-$HOSTNAME-secret" ] && [ -f "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
done
}
x-load-configs
@@ -59,7 +65,7 @@ ssh-add -A 2>/dev/null;
if command -v antigen &> /dev/null; then
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 colored-man-pages
@@ -68,13 +74,13 @@ if command -v antigen &> /dev/null; then
antigen bundle zsh-users/zsh-completions
antigen bundle MichaelAquilina/zsh-you-should-use
antigen bundle unixorn/autoupdate-antigen.zshplugin
antigen bundle Sparragus/zsh-auto-nvm-use
# antigen bundle git-auto-fetch
hash php 2>/dev/null && antigen bundle php
hash nvm 2>/dev/null && antigen bundle nvm
hash docker 2>/dev/null && antigen bundle docker
hash nvm 2>/dev/null && antigen bundle Sparragus/zsh-auto-nvm-use
hash ruby 2>/dev/null && antigen bundle ruby
hash python 2>/dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
hash jq 2>/dev/null && antigen bundle reegnz/jq-zsh-plugin
hash docker-compose 2>/dev/null && antigen bundle sroze/docker-compose-zsh-plugin
@@ -108,5 +114,7 @@ if hash gcloud 2>/dev/null; then
[[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
fi
eval "$(starship init zsh)"
# 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"