mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-27 22:41:02 +00:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d4e02bbb89 | |||
| 32dbec6476 | |||
|
|
980fc9aa7d | ||
|
|
a2c3de1b3b | ||
|
|
16d455a262 | ||
|
|
9ba66c7734 | ||
|
|
86824d8c45 | ||
| 38d853aa8a | |||
|
|
34a0d7d8c4 | ||
|
|
65bf470c5b | ||
|
|
965c47efef | ||
| 410f5ac2b5 | |||
|
|
b6a18688c4 | ||
| 9f1ba5034f | |||
|
|
4cf956aa17 | ||
|
|
f9142a4780 | ||
|
|
bb921189e2 | ||
| a4eb0b0186 | |||
| 1222b8fdb3 | |||
| cced3a5310 | |||
|
|
6c680a0fa9 | ||
|
|
6746fb5381 | ||
| 7b2831ec94 | |||
| a605d46294 | |||
|
|
5e98f61942 | ||
|
|
e2583f4d91 |
@@ -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
|
||||
|
||||
23
Brewfile
23
Brewfile
@@ -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
|
||||
@@ -118,6 +120,8 @@ brew "mas"
|
||||
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
|
||||
@@ -126,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
|
||||
@@ -138,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
|
||||
@@ -240,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
|
||||
@@ -258,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
|
||||
@@ -267,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
|
||||
|
||||
11
config/alias
11
config/alias
@@ -58,18 +58,17 @@ 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='$EDITOR ~/.zshrc ~/.alias'
|
||||
alias zdots='$EDITOR ~/.dotfiles'
|
||||
alias zedit='$EDITOR ~/.dotfiles'
|
||||
|
||||
if [[ -f "$HOME/.aliases.local" ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*.cache
|
||||
*~
|
||||
|
||||
*-secret
|
||||
__secret
|
||||
__ignored
|
||||
__test_*.php
|
||||
|
||||
@@ -3,7 +3,11 @@ local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nv
|
||||
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.fn.system {
|
||||
'git', 'clone', '--depth', '1',
|
||||
'https://github.com/wbthomason/packer.nvim',
|
||||
install_path
|
||||
}
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
end
|
||||
|
||||
@@ -25,7 +29,11 @@ require('packer').startup(function(use)
|
||||
|
||||
use { -- Autocompletion
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
||||
requires = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
},
|
||||
}
|
||||
|
||||
use { -- Highlight, edit, and navigate code
|
||||
@@ -40,38 +48,28 @@ require('packer').startup(function(use)
|
||||
after = 'nvim-treesitter',
|
||||
}
|
||||
|
||||
-- Git related plugins
|
||||
use 'tpope/vim-fugitive'
|
||||
use 'tpope/vim-rhubarb'
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
|
||||
use 'drewtempelmeyer/palenight.vim' -- Theme based off the Material Pale Night
|
||||
use 'nvim-lualine/lualine.nvim' -- Fancier statusline
|
||||
use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines
|
||||
use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
|
||||
use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
|
||||
-- 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' } }
|
||||
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 }
|
||||
-- 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 }
|
||||
|
||||
-- catppuccin theme
|
||||
use { "catppuccin/nvim", as = "catppuccin" }
|
||||
|
||||
use {
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
require("which-key").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section in the docs
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
-- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua
|
||||
-- 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)
|
||||
@@ -95,12 +93,19 @@ if is_bootstrap then
|
||||
return
|
||||
end
|
||||
|
||||
-- Automatically source and re-compile packer whenever you save this init.lua
|
||||
-- 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',
|
||||
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 ]]
|
||||
@@ -109,8 +114,9 @@ vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
|
||||
-- Make line numbers default
|
||||
-- Make line numbers default, enabled relative line numbers
|
||||
vim.wo.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
@@ -131,16 +137,24 @@ vim.wo.signcolumn = 'yes'
|
||||
|
||||
-- Set colorscheme
|
||||
vim.o.termguicolors = true
|
||||
--vim.cmd.colorscheme('palenight')
|
||||
vim.cmd.colorscheme('catppuccin-macchiato')
|
||||
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)
|
||||
-- NOTE: Must happen before plugins are required
|
||||
-- (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
@@ -148,11 +162,149 @@ vim.g.maplocalleader = ' '
|
||||
-- See `:help vim.keymap.set()`
|
||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
-- Misc options.
|
||||
vim.o.incsearch = true
|
||||
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = 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()
|
||||
@@ -165,8 +317,8 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
-- See `:help lualine.txt`
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = 'catppuccin-macchiato',
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
@@ -178,20 +330,11 @@ require('Comment').setup()
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help indent_blankline.txt`
|
||||
require('indent_blankline').setup {
|
||||
char = '┊',
|
||||
show_trailing_blankline_indent = false,
|
||||
}
|
||||
|
||||
-- Gitsigns
|
||||
-- See `:help gitsigns.txt`
|
||||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
-- char = '┊',
|
||||
show_trailing_blankline_indent = true,
|
||||
space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
@@ -210,35 +353,64 @@ require('telescope').setup {
|
||||
-- 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`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, {
|
||||
desc = '[?] Find recently opened files'
|
||||
})
|
||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, {
|
||||
desc = '[ ] Find existing buffers'
|
||||
})
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
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]' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
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 = { 'c', 'cpp', 'go', 'lua', 'php', 'python', 'rust', 'typescript', 'help' },
|
||||
-- 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' },
|
||||
},
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true, disable = { 'python' } },
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
@@ -248,10 +420,12 @@ require('nvim-treesitter.configs').setup {
|
||||
node_decremental = '<c-backspace>',
|
||||
},
|
||||
},
|
||||
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
-- 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',
|
||||
@@ -294,22 +468,18 @@ require('nvim-treesitter.configs').setup {
|
||||
},
|
||||
}
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- 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
|
||||
-- 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 nmap = function(keys, func, desc)
|
||||
-- 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
|
||||
@@ -317,26 +487,29 @@ local on_attach = function(_, bufnr)
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
local t = require('telescope.builtin')
|
||||
local vbuf = vim.lsp.buf
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
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
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
nm('K', vbuf.hover, 'Hover Documentation')
|
||||
nm('<C-k>', vbuf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
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
|
||||
@@ -351,16 +524,64 @@ 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
|
||||
-- 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',
|
||||
'rust_analyzer',
|
||||
'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',
|
||||
'sumneko_lua',
|
||||
'gopls'
|
||||
-- u
|
||||
-- v / w
|
||||
'volar', -- vue
|
||||
'vuels', -- vue
|
||||
-- x / y / z
|
||||
'lemminx', -- xml
|
||||
'yamlls', -- yaml
|
||||
}
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
@@ -368,6 +589,16 @@ 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)
|
||||
@@ -382,8 +613,7 @@ end
|
||||
-- Turn on lsp status information
|
||||
require('fidget').setup()
|
||||
|
||||
-- Example custom configuration for lua
|
||||
--
|
||||
-- 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')
|
||||
@@ -395,7 +625,8 @@ require('lspconfig').sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
|
||||
-- Tell the language server which version of Lua you're
|
||||
-- using (most likely LuaJIT)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = runtime_path,
|
||||
@@ -407,7 +638,8 @@ require('lspconfig').sumneko_lua.setup {
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
-- Do not send telemetry data containing a randomized
|
||||
-- but unique identifier
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
@@ -456,5 +688,18 @@ cmp.setup {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
184
config/nvim/lua/custom/plugins.lua
Normal file
184
config/nvim/lua/custom/plugins.lua
Normal file
@@ -0,0 +1,184 @@
|
||||
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,
|
||||
})
|
||||
|
||||
-- Markdown support
|
||||
use 'preservim/vim-markdown'
|
||||
use 'godlygeek/tabular'
|
||||
|
||||
-- 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
1
config/nvim/plugin/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
packer_compiled.lua
|
||||
@@ -1,228 +0,0 @@
|
||||
-- Automatically generated packer.nvim plugin loader code
|
||||
|
||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_command('packadd packer.nvim')
|
||||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.inside_compile = true
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
if should_profile then
|
||||
local hrtime = vim.loop.hrtime
|
||||
profile_info = {}
|
||||
time = function(chunk, start)
|
||||
if start then
|
||||
profile_info[chunk] = hrtime()
|
||||
else
|
||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||
end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
for chunk_name, time_taken in pairs(profile_info) do
|
||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||
end
|
||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||
local results = {}
|
||||
for i, elem in ipairs(sorted_times) do
|
||||
if not threshold or threshold and elem[2] > threshold then
|
||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||
end
|
||||
end
|
||||
if threshold then
|
||||
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||
end
|
||||
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], true)
|
||||
local package_path_str = "/Users/ivuorinen/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/ivuorinen/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/ivuorinen/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/ivuorinen/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/Users/ivuorinen/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||
if not string.find(package.path, package_path_str, 1, true) then
|
||||
package.path = package.path .. ';' .. package_path_str
|
||||
end
|
||||
|
||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], false)
|
||||
time([[try_loadstring definition]], true)
|
||||
local function try_loadstring(s, component, name)
|
||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||
if not success then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||
end)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
["Comment.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
||||
url = "https://github.com/numToStr/Comment.nvim"
|
||||
},
|
||||
LuaSnip = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
["fidget.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/fidget.nvim",
|
||||
url = "https://github.com/j-hui/fidget.nvim"
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
["indent-blankline.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
|
||||
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["mason-lspconfig.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||
},
|
||||
["mason.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||
url = "https://github.com/williamboman/mason.nvim"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-treesitter-textobjects"] = {
|
||||
load_after = {},
|
||||
loaded = true,
|
||||
needs_bufread = false,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-textobjects",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["palenight.vim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/palenight.vim",
|
||||
url = "https://github.com/drewtempelmeyer/palenight.vim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["telescope-fzf-native.nvim"] = {
|
||||
cond = { true },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/opt/telescope-fzf-native.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["vim-fugitive"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/vim-fugitive",
|
||||
url = "https://github.com/tpope/vim-fugitive"
|
||||
},
|
||||
["vim-rhubarb"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/vim-rhubarb",
|
||||
url = "https://github.com/tpope/vim-rhubarb"
|
||||
},
|
||||
["vim-sleuth"] = {
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/vim-sleuth",
|
||||
url = "https://github.com/tpope/vim-sleuth"
|
||||
},
|
||||
["which-key.nvim"] = {
|
||||
config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/Users/ivuorinen/.local/share/nvim/site/pack/packer/start/which-key.nvim",
|
||||
url = "https://github.com/folke/which-key.nvim"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: which-key.nvim
|
||||
time([[Config for which-key.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim")
|
||||
time([[Config for which-key.nvim]], false)
|
||||
-- Conditional loads
|
||||
time([[Conditional loading of telescope-fzf-native.nvim]], true)
|
||||
require("packer.load")({"telescope-fzf-native.nvim"}, {}, _G.packer_plugins)
|
||||
time([[Conditional loading of telescope-fzf-native.nvim]], false)
|
||||
-- Load plugins in order defined by `after`
|
||||
time([[Sequenced loading]], true)
|
||||
vim.cmd [[ packadd nvim-treesitter ]]
|
||||
vim.cmd [[ packadd nvim-treesitter-textobjects ]]
|
||||
time([[Sequenced loading]], false)
|
||||
|
||||
_G._packer.inside_compile = false
|
||||
if _G._packer.needs_bufread == true then
|
||||
vim.cmd("doautocmd BufRead")
|
||||
end
|
||||
_G._packer.needs_bufread = false
|
||||
|
||||
if should_profile then save_profiles() end
|
||||
|
||||
end)
|
||||
|
||||
if not no_errors then
|
||||
error_msg = error_msg:gsub('"', '\\"')
|
||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||
end
|
||||
@@ -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" && msg_done "🎉 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
|
||||
}
|
||||
@@ -74,7 +74,7 @@ function section_brew
|
||||
;;
|
||||
update)
|
||||
brew update && brew outdated && brew upgrade && brew cleanup
|
||||
echo "🎉 Done!"
|
||||
msg_done "🎉 Done!"
|
||||
;;
|
||||
updatebundle)
|
||||
# Updates .dotfiles/Brewfile with descriptions
|
||||
@@ -84,6 +84,7 @@ function section_brew
|
||||
--describe && msg_done "🎉 Done!"
|
||||
;;
|
||||
autoupdate)
|
||||
brew autoupdate delete
|
||||
brew autoupdate start 43200 --upgrade --cleanup --immediate
|
||||
;;
|
||||
*)
|
||||
@@ -102,37 +103,30 @@ function section_dotfiles
|
||||
|
||||
case "$1" in
|
||||
link)
|
||||
rcup -B "$HOSTNAME" -f -v && msg_done "🎉 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
|
||||
msg_done "🎉 Done!"
|
||||
$0 dotfiles link
|
||||
msg_done "🎉 dotfiles updated and linked!"
|
||||
;;
|
||||
shfmt)
|
||||
# Format shell scripts according to following rules.
|
||||
shfmt \
|
||||
--find \
|
||||
--list \
|
||||
--write \
|
||||
--diff \
|
||||
--simplify \
|
||||
--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
|
||||
}
|
||||
@@ -183,4 +177,3 @@ case "$1" in
|
||||
tests) section_tests "$2" ;;
|
||||
*) usage && exit 1 ;;
|
||||
esac
|
||||
|
||||
|
||||
82
local/bin/git-dirty
Executable file
82
local/bin/git-dirty
Executable 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"
|
||||
@@ -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
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
# If the status code was zero then repeat.
|
||||
#
|
||||
while [ $? -eq 0 ]; do
|
||||
"$@"
|
||||
"$@"
|
||||
done
|
||||
|
||||
@@ -26,5 +26,5 @@
|
||||
# If the status code was not zero then repeat.
|
||||
#
|
||||
while [ $? -ne 0 ]; do
|
||||
"$@"
|
||||
"$@"
|
||||
done
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
2
rcrc
@@ -1,2 +1,2 @@
|
||||
EXCLUDES="*.md *.sh *.lock.json Brewfile scripts"
|
||||
EXCLUDES="*.md *.sh *.lock.json Brewfile scripts *-secret xbar"
|
||||
HOSTNAME=$(hostname -s)
|
||||
|
||||
@@ -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
|
||||
@@ -76,6 +73,7 @@ handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.y
|
||||
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"
|
||||
@@ -83,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/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"
|
||||
|
||||
@@ -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 $?
|
||||
}
|
||||
|
||||
11
zshrc
11
zshrc
@@ -5,7 +5,7 @@
|
||||
autoload -U colors zsh/terminfo
|
||||
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
|
||||
BREW_BIN=$(brew --prefix)/bin
|
||||
@@ -48,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
|
||||
@@ -63,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
|
||||
@@ -72,14 +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 ruby 2>/dev/null && antigen bundle ruby
|
||||
|
||||
hash nvm 2>/dev/null && antigen bundle Sparragus/zsh-auto-nvm-use
|
||||
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
|
||||
@@ -113,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"
|
||||
|
||||
Reference in New Issue
Block a user