Move Nix files back to the root of the project
This commit is contained in:
parent
52044d9995
commit
087153a16d
223 changed files with 12 additions and 12 deletions
9
modules/home-manager/cli/bin.nix
Normal file
9
modules/home-manager/cli/bin.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
home.sessionPath = [ "$HOME/bin" ];
|
||||
|
||||
home.file."bin" = {
|
||||
source = "${self}/bin";
|
||||
recursive = true;
|
||||
};
|
||||
}
|
36
modules/home-manager/cli/bluetuith.nix
Normal file
36
modules/home-manager/cli/bluetuith.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.homeManagerModules.bluetuith.enable = mkEnableOption "Enable bluetuith";
|
||||
|
||||
config = mkIf config.homeManagerModules.bluetuith.enable {
|
||||
home.packages = with pkgs; [
|
||||
bluetuith
|
||||
];
|
||||
|
||||
xdg.configFile."bluetuith/bluetuith.conf" = {
|
||||
text = ''
|
||||
{
|
||||
adapter: ""
|
||||
adapter-states: ""
|
||||
connect-bdaddr: ""
|
||||
gsm-apn: ""
|
||||
gsm-number: ""
|
||||
keybindings: {
|
||||
NavigateDown: j
|
||||
NavigateUp: k
|
||||
}
|
||||
receive-dir: ""
|
||||
theme: {}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
19
modules/home-manager/cli/default.nix
Normal file
19
modules/home-manager/cli/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./bin.nix
|
||||
./bluetuith.nix
|
||||
./direnv.nix
|
||||
./fzf.nix
|
||||
./git.nix
|
||||
./neovim
|
||||
./newsboat.nix
|
||||
./notes.nix
|
||||
./phpactor
|
||||
./starship.nix
|
||||
./tmux.nix
|
||||
./tmux-sessionizer.nix
|
||||
./zsh.nix
|
||||
];
|
||||
}
|
18
modules/home-manager/cli/direnv.nix
Normal file
18
modules/home-manager/cli/direnv.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.homeManagerModules.direnv.enable = mkEnableOption "Enable direnv";
|
||||
|
||||
config = mkIf config.homeManagerModules.direnv.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
nix-direnv.enable = true;
|
||||
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
}
|
10
modules/home-manager/cli/fzf.nix
Normal file
10
modules/home-manager/cli/fzf.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
FZF_DEFAULT_OPTS = "--reverse";
|
||||
};
|
||||
}
|
152
modules/home-manager/cli/git.nix
Normal file
152
modules/home-manager/cli/git.nix
Normal file
|
@ -0,0 +1,152 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.file."${config.xdg.configHome}/git/message".text = ''
|
||||
|
||||
|
||||
# Description
|
||||
#
|
||||
# - Why is this change necessary?
|
||||
# - How does it address the issue?
|
||||
# - What side effects does this change have?
|
||||
#
|
||||
# For breaking changes, uncomment the following line and describe the change:
|
||||
#
|
||||
# BREAKING CHANGE:
|
||||
#
|
||||
#
|
||||
# Add any issue IDs or commit SHAs that this commit references:
|
||||
#
|
||||
# Refs:
|
||||
|
||||
'';
|
||||
|
||||
programs = {
|
||||
git = {
|
||||
enable = true;
|
||||
userName = "Oliver Davies";
|
||||
userEmail = "oliver@oliverdavies.dev";
|
||||
|
||||
includes = [
|
||||
{
|
||||
condition = "gitdir:${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/tfw";
|
||||
contents.user.email = "oliver.davies@tfw.wales";
|
||||
}
|
||||
];
|
||||
|
||||
aliases = {
|
||||
aa = "add --all";
|
||||
assume = "update-index --assume-unchanged";
|
||||
assumed = "!git ls-files -v | grep '^[hsmrck?]' | cut -c 3-";
|
||||
b = "branch";
|
||||
blame = "blame -w -C -C -C";
|
||||
browse = "!gh repo view --web";
|
||||
ca = "commit --amend --verbose";
|
||||
car = "commit --amend --no-edit";
|
||||
cl = "!hub clone";
|
||||
co = "checkout";
|
||||
compare = "!hub compare";
|
||||
current-branch = "rev-parse --abbrev-ref HEAD";
|
||||
dc = "diff --color --word-diff --cached";
|
||||
df = "diff --color --word-diff";
|
||||
dup = "!git checkout develop && git fetch origin && echo && git sl develop..origin/develop && echo && git pull --quiet && git checkout -";
|
||||
fixup = "commit --fixup";
|
||||
issues = "!gh issue list --web";
|
||||
mup = "!git master-to-main-wrapper checkout %BRANCH% && git fetch origin && echo && git sl %BRANCH%..origin/%BRANCH% && echo && git pull --quiet && git checkout -";
|
||||
no-ff = "merge --no-ff";
|
||||
pl = "pull";
|
||||
prune = "remote prune origin";
|
||||
ps = "push";
|
||||
pulls = "!gh pr list --web";
|
||||
rbc = "rebase --continue";
|
||||
rdup = "!git dup && git rebase develop";
|
||||
remotes = "remote -v";
|
||||
repush = "!git pull --rebase && git push";
|
||||
ri = "rebase --interactive";
|
||||
rid = "!git rebase -i $(git merge-base develop HEAD)";
|
||||
rim = "!git rebase -i $(git master-to-main-wrapper merge-base %BRANCH% HEAD)";
|
||||
rip = "!git rebase -i $(git merge-base production HEAD)";
|
||||
ris = "!git rebase -i $(git merge-base staging HEAD)";
|
||||
riu = "!git rebase -i $(git rev-parse --abbrev-ref --symbolic-full-name @{u})";
|
||||
rmup = "!git mup && git master-to-main-wrapper rebase %BRANCH%";
|
||||
sl = "log --oneline --decorate -20";
|
||||
sla = "log --oneline --decorate --graph --all -20";
|
||||
slap = "log --oneline --decorate --graph --all";
|
||||
slp = "log --oneline --decorate";
|
||||
stash = "stash --included-untracked";
|
||||
unassume = "update-index --no-assume-unchanged";
|
||||
uncommit = "reset --soft HEAD^";
|
||||
unstage = "reset";
|
||||
update = "!git fetch --all --jobs=4 --prune --progress && git rebase --autostash --stat";
|
||||
upstream = "rev-parse --abbrev-ref --symbolic-full-name @{u}";
|
||||
ureset = "!git reset --hard $(git upstream)";
|
||||
worktrees = "worktree list";
|
||||
};
|
||||
|
||||
ignores = [
|
||||
"/.ddev/providers/"
|
||||
"/.direnv/"
|
||||
"/.ignored/"
|
||||
"/.issue-id"
|
||||
"/.phpactor.json"
|
||||
"/notes"
|
||||
"/todo"
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
branch = {
|
||||
autosetupmerge = true;
|
||||
autosetuprebase = "always";
|
||||
sort = "-committerdate";
|
||||
};
|
||||
|
||||
checkout.defaultRemote = "origin";
|
||||
color.ui = true;
|
||||
column.ui = "auto";
|
||||
commit.template = "${config.xdg.configHome}/git/message";
|
||||
|
||||
core = {
|
||||
editor = "nvim";
|
||||
excludesFile = "~/.config/git/ignore";
|
||||
};
|
||||
|
||||
diff.tool = "vimdiff";
|
||||
fetch.prune = true;
|
||||
gpg.format = "ssh";
|
||||
grep.lineNumber = true;
|
||||
help.autocorrect = "1";
|
||||
init.defaultBranch = "main";
|
||||
|
||||
maintenance = {
|
||||
auto = false;
|
||||
strategy = "incremental";
|
||||
};
|
||||
|
||||
merge.ff = "only";
|
||||
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
default = "upstream";
|
||||
};
|
||||
|
||||
pull = {
|
||||
ff = "only";
|
||||
rebase = true;
|
||||
};
|
||||
|
||||
rebase = {
|
||||
autosquash = true;
|
||||
autostash = true;
|
||||
};
|
||||
|
||||
user.signingkey = "~/.ssh/id_rsa.pub";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [ nixpkgs-2411.git-instafix ];
|
||||
|
||||
home.sessionVariables = {
|
||||
GIT_INSTAFIX_UPSTREAM = "origin/main";
|
||||
};
|
||||
}
|
1
modules/home-manager/cli/neovim/config/.gitignore
vendored
Normal file
1
modules/home-manager/cli/neovim/config/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/spell/*.spl
|
|
@ -0,0 +1,8 @@
|
|||
vim.opt_local.colorcolumn = "50,72"
|
||||
vim.opt_local.spell = true
|
||||
vim.opt_local.textwidth = 72
|
||||
|
||||
-- autocmd FileType gitcommit highlight ColorColumn ctermbg=8
|
||||
-- filetype indent on
|
||||
-- filetype on
|
||||
-- filetype plugin on
|
|
@ -0,0 +1,3 @@
|
|||
-- TODO: Interim fix for https://github.com/nvim-treesitter/nvim-treesitter-context/issues/431.
|
||||
vim.opt_local.spell = true
|
||||
vim.opt_local.wrap = true
|
|
@ -0,0 +1,5 @@
|
|||
local opt = vim.opt_local
|
||||
|
||||
opt.cursorline = false
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
|
@ -0,0 +1,3 @@
|
|||
vim.keymap.set("v", "<leader>dd", "yodd(['<Esc>pA', <Esc>pA]);<Esc>")
|
||||
vim.keymap.set("v", "<leader>du", "yodump(['<Esc>pA', <Esc>pA]);<Esc>")
|
||||
vim.keymap.set("v", "<leader>vd", "yovar_dump(['<Esc>pA', <Esc>pA]);<Esc>")
|
|
@ -0,0 +1,13 @@
|
|||
local opt = vim.opt_local
|
||||
|
||||
opt.spell = true
|
||||
opt.wrap = true
|
||||
|
||||
local cmp = require "cmp"
|
||||
local sources = cmp.get_config().sources
|
||||
|
||||
-- TODO: confirm these aren't aleady in the list of sources to avoid duplicate suggestions.
|
||||
table.insert(sources, { name = "buffer" })
|
||||
table.insert(sources, { name = "path" })
|
||||
|
||||
cmp.setup.buffer { sources = sources }
|
|
@ -0,0 +1,4 @@
|
|||
setlocal norelativenumber
|
||||
setlocal nonumber
|
||||
|
||||
setlocal scrolloff=0
|
|
@ -0,0 +1,15 @@
|
|||
local opt = vim.opt_local
|
||||
|
||||
opt.spell = true
|
||||
opt.wrap = true
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = 0,
|
||||
callback = function()
|
||||
local last_line = vim.api.nvim_buf_get_lines(0, -2, -1, false)[1]
|
||||
|
||||
if last_line ~= "" then
|
||||
vim.api.nvim_buf_set_lines(0, -1, -1, false, { "" })
|
||||
end
|
||||
end,
|
||||
})
|
12
modules/home-manager/cli/neovim/config/autoload/opdavies.vim
Normal file
12
modules/home-manager/cli/neovim/config/autoload/opdavies.vim
Normal file
|
@ -0,0 +1,12 @@
|
|||
if !exists('*opdavies#save_and_exec')
|
||||
function! opdavies#save_and_exec() abort
|
||||
if &filetype == 'vim'
|
||||
:silent! write
|
||||
:source %
|
||||
elseif &filetype == 'lua'
|
||||
:silent! write
|
||||
:luafile %
|
||||
endif
|
||||
return
|
||||
endfunction
|
||||
endif
|
1
modules/home-manager/cli/neovim/config/init.lua
Normal file
1
modules/home-manager/cli/neovim/config/init.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require "opdavies"
|
|
@ -0,0 +1,13 @@
|
|||
P = function(v)
|
||||
print(vim.inspect(v))
|
||||
return v
|
||||
end
|
||||
|
||||
RELOAD = function(...)
|
||||
return require("plenary.reload").reload_module(...)
|
||||
end
|
||||
|
||||
R = function(name)
|
||||
RELOAD(name)
|
||||
return require(name)
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
require "opdavies.globals"
|
||||
require "opdavies.options"
|
||||
require "opdavies.keymaps"
|
||||
require "opdavies.lsp"
|
|
@ -0,0 +1,78 @@
|
|||
local set = vim.keymap.set
|
||||
|
||||
set("n", "<C-f>", "<cmd>silent !tmux new-window tmux-sessionizer<CR>")
|
||||
|
||||
-- Execute Lua in the current file, line or range.
|
||||
set("n", "<leader><leader>x", "<cmd>source %<CR>")
|
||||
set("n", "<leader>x", ":.lua<CR>")
|
||||
set("v", "<leader>x", ":lua<CR>")
|
||||
|
||||
-- Yank from the current column to the end of the line
|
||||
set("n", "Y", "yg$")
|
||||
|
||||
-- Keep things centred
|
||||
set("n", "n", "nzzzv")
|
||||
set("n", "N", "Nzzzv")
|
||||
|
||||
-- Disable up and down arrow keys.
|
||||
set("v", "<down>", "<nop>")
|
||||
set("v", "<up>", "<nop>")
|
||||
|
||||
-- Easily switch back to visual mode.
|
||||
set("i", "jk", "<Esc>")
|
||||
|
||||
-- Easy insertion of a trailing ; or , from insert mode
|
||||
set("i", ",,", "<Esc>A,<Esc>")
|
||||
set("i", ";;", "<Esc>A;<Esc>")
|
||||
|
||||
-- Automatically resize buffers.
|
||||
set("n", "<leader>=", ":wincmd =<cr>", { noremap = true, silent = true })
|
||||
|
||||
-- Move line(s) up and down.
|
||||
local opts = { noremap = true, silent = true }
|
||||
set("i", "<M-j>", "<Esc>:m .+1<CR>==gi", opts)
|
||||
set("i", "<M-k>", "<Esc>:m .-2<CR>==gi", opts)
|
||||
set("n", "<M-j>", ":m .+1<CR>==", opts)
|
||||
set("n", "<M-k>", ":m .-2<CR>==", opts)
|
||||
set("v", "<M-j>", ":m '>+1<CR>gv=gv", opts)
|
||||
set("v", "<M-k>", ":m '<-2<CR>gv=gv", opts)
|
||||
|
||||
-- Re-centre when navigating.
|
||||
set("n", "#", "#zz", opts)
|
||||
set("n", "%", "%zz", opts)
|
||||
set("n", "*", "*zz", opts)
|
||||
set("n", "<C-d>", "<C-d>zz", opts)
|
||||
set("n", "<C-i>", "<C-i>zz", opts)
|
||||
set("n", "<C-o>", "<C-o>zz", opts)
|
||||
set("n", "<C-u>", "<C-u>zz", opts)
|
||||
set("n", "G", "Gzz", opts)
|
||||
set("n", "N", "Nzz", opts)
|
||||
set("n", "gg", "ggzz", opts)
|
||||
set("n", "n", "Nzz", opts)
|
||||
set("n", "{", "{zz", opts)
|
||||
set("n", "}", "}zz", opts)
|
||||
|
||||
-- Clears hlsearch after doing a search, otherwise just does normal <CR> stuff
|
||||
vim.cmd [[ nnoremap <expr> <CR> {-> v:hlsearch ? ":nohl\<CR>" : "\<CR>"}() ]]
|
||||
|
||||
-- Quicker macro playback.
|
||||
set("n", "Q", "@qj")
|
||||
set("x", "Q", ":norm @q<CR>")
|
||||
|
||||
set("v", "Q", "<nop>")
|
||||
|
||||
set("v", "J", ":m '>+1<CR>gvrgv")
|
||||
set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
set("n", "J", "mzJ`z")
|
||||
set("n", "<C-d>", "<C-d>zz")
|
||||
set("n", "<C-u>", "<C-u>zz")
|
||||
set("n", "n", "nzzzv")
|
||||
set("n", "N", "Nzzzv")
|
||||
|
||||
set("n", "<leader>ec", ":edit composer.json<CR>")
|
||||
set("n", "<leader>ef", ":edit flake.nix<CR>")
|
||||
set("n", "<leader>er", ":edit run<CR>")
|
||||
|
||||
set({ "n", "v" }, "<leader>y", [["+y]])
|
||||
set("n", "<leader>Y", [["+Y]])
|
|
@ -0,0 +1,73 @@
|
|||
local M = {}
|
||||
|
||||
local function should_remove_diagnostic(messages_to_filter, message)
|
||||
for _, filter_message in ipairs(messages_to_filter) do
|
||||
if message:match(filter_message) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
M.definition = function()
|
||||
local params = vim.lsp.util.make_position_params()
|
||||
|
||||
vim.lsp.buf_request(0, "textDocument/definition", params, function(err, result, ctx, config)
|
||||
local bufnr = ctx.bufnr
|
||||
local ft = vim.api.nvim_buf_get_option(bufnr, "filetype")
|
||||
|
||||
local new_result = vim.tbl_filter(function(v)
|
||||
-- Remove any definitions within the nix store via the .direnv directory.
|
||||
if string.find(v.targetUri, ".direnv") then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Remove definitions within vendor-bin directory for PHP files.
|
||||
if ft == "php" then
|
||||
if string.find(v.targetUri, "vendor%-bin") then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end, result)
|
||||
|
||||
if #new_result > 0 then
|
||||
result = new_result
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/definition"](err, result, ctx, config)
|
||||
vim.cmd [[normal! zz]]
|
||||
end)
|
||||
end
|
||||
|
||||
M.on_publish_diagnostics = function(_, result, ctx, config)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
|
||||
if client.name == "cssls" then
|
||||
local filtered_diagnostics = {}
|
||||
|
||||
local messages_to_filter = {
|
||||
"Unknown at rule @apply",
|
||||
"Unknown at rule @plugin",
|
||||
"Unknown at rule @tailwind",
|
||||
"Unknown at rule @theme",
|
||||
}
|
||||
|
||||
-- For each diagnostic, ensure its mesages doesn't match one I want to
|
||||
-- ignore before adding it to the result. If it matches, don't add it to the
|
||||
-- result and it won't be shown.
|
||||
for _, diagnostic in ipairs(result.diagnostics) do
|
||||
if not should_remove_diagnostic(messages_to_filter, diagnostic.message) then
|
||||
table.insert(filtered_diagnostics, diagnostic)
|
||||
end
|
||||
end
|
||||
|
||||
result.diagnostics = filtered_diagnostics
|
||||
end
|
||||
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(_, result, ctx, config)
|
||||
end
|
||||
|
||||
return M
|
142
modules/home-manager/cli/neovim/config/lua/opdavies/lsp/init.lua
Normal file
142
modules/home-manager/cli/neovim/config/lua/opdavies/lsp/init.lua
Normal file
|
@ -0,0 +1,142 @@
|
|||
local cmp_nvim_lsp = require "cmp_nvim_lsp"
|
||||
local handlers = require "opdavies.lsp.handlers"
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
lspconfig.bashls.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.cssls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = function(_, _)
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(handlers.on_publish_diagnostics, {})
|
||||
end,
|
||||
}
|
||||
|
||||
lspconfig.emmet_language_server.setup {
|
||||
capabilities = capabilities,
|
||||
filetypes = { "css", "html", "sass", "scss", "twig" },
|
||||
}
|
||||
|
||||
lspconfig.gopls.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.html.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.phpactor.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
telemetry = {
|
||||
enabled = false,
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.marksman.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.nixd.setup {
|
||||
capabilities = capabilities,
|
||||
cmd = { "nixd" },
|
||||
settings = {
|
||||
nixd = {
|
||||
nixpkgs = {
|
||||
expr = "import <nixpkgs> { }",
|
||||
},
|
||||
formatting = {
|
||||
command = "nix fmt",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.tailwindcss.setup {
|
||||
capabilities = capabilities,
|
||||
filetypes = { "html", "javascript", "twig", "typescript", "vue" },
|
||||
settings = {
|
||||
init_options = {
|
||||
userLanguages = {
|
||||
["html.twig"] = "html",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.terraformls.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.ts_ls.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.vuels.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.yamlls.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
yaml = {
|
||||
keyOrdering = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config {
|
||||
float = { source = true },
|
||||
signs = true,
|
||||
underline = false,
|
||||
update_in_insert = false,
|
||||
virtual_text = { spacing = 2 },
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function()
|
||||
local builtin = require "telescope.builtin"
|
||||
|
||||
vim.keymap.set("n", "gd", builtin.lsp_definitions, { buffer = 0 })
|
||||
vim.keymap.set("n", "gr", builtin.lsp_references, { buffer = 0 })
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { buffer = 0 })
|
||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, { buffer = 0 })
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0 })
|
||||
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { buffer = 0 })
|
||||
vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, { buffer = 0 })
|
||||
|
||||
vim.keymap.set("n", "<leader>dl", vim.diagnostic.setqflist, { buffer = 0 })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>dd", function()
|
||||
vim.diagnostic.enable(false)
|
||||
vim.diagnostic.reset()
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<leader>de", function()
|
||||
vim.diagnostic.enable(true)
|
||||
end)
|
|
@ -0,0 +1,53 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.g.snippets = "luasnip"
|
||||
|
||||
local settings = {
|
||||
autoindent = true,
|
||||
backup = false,
|
||||
breakindent = true,
|
||||
expandtab = true,
|
||||
exrc = true,
|
||||
foldlevel = 1,
|
||||
foldlevelstart = 99,
|
||||
foldmethod = "indent",
|
||||
formatoptions = "clqjp",
|
||||
hidden = false,
|
||||
hlsearch = false,
|
||||
inccommand = "split",
|
||||
laststatus = 3,
|
||||
linebreak = true,
|
||||
list = true,
|
||||
mouse = "a",
|
||||
number = true,
|
||||
pumblend = 10,
|
||||
pumheight = 10,
|
||||
relativenumber = true,
|
||||
scrolloff = 5,
|
||||
shiftwidth = 2,
|
||||
showmode = false,
|
||||
signcolumn = "yes:1",
|
||||
smartindent = true,
|
||||
softtabstop = 2,
|
||||
spellfile = "/home/opdavies/Code/dotfiles/nvim/spell/en.utf-8.add",
|
||||
splitbelow = true,
|
||||
splitright = true,
|
||||
swapfile = false,
|
||||
syntax = "on",
|
||||
tabstop = 2,
|
||||
termguicolors = true,
|
||||
textwidth = 0,
|
||||
undodir = os.getenv "XDG_STATE_HOME" .. "/nvim/undodir",
|
||||
undofile = true,
|
||||
updatetime = 1000,
|
||||
wrap = false,
|
||||
}
|
||||
|
||||
for key, value in pairs(settings) do
|
||||
vim.o[key] = value
|
||||
end
|
||||
|
||||
vim.opt.backupdir:remove "." -- keep backups out of the current directory
|
||||
vim.opt.completeopt = { "menu", "menuone", "noinsert", "noselect" }
|
||||
vim.opt.listchars:append {
|
||||
trail = "·",
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
require("luasnip.session.snippet_collection").clear_snippets "javascript"
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
local i = ls.insert_node
|
||||
local s = ls.snippet
|
||||
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
|
||||
ls.add_snippets("javascript", {
|
||||
s("log", fmta("console.log(<>);", { i(1, "value") })),
|
||||
})
|
|
@ -0,0 +1,23 @@
|
|||
require("luasnip.session.snippet_collection").clear_snippets "lua"
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
local f = ls.function_node
|
||||
local i = ls.insert_node
|
||||
local s = ls.snippet
|
||||
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
ls.add_snippets("lua", {
|
||||
s(
|
||||
"req",
|
||||
fmt([[local {} = require "{}"]], {
|
||||
f(function(import_name)
|
||||
local parts = vim.split(import_name[1][1], ".", true)
|
||||
|
||||
return parts[#parts] or ""
|
||||
end, { 1 }),
|
||||
i(1),
|
||||
})
|
||||
),
|
||||
})
|
|
@ -0,0 +1,66 @@
|
|||
require("luasnip.session.snippet_collection").clear_snippets "php"
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
local c = ls.choice_node
|
||||
local i = ls.insert_node
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
|
||||
ls.add_snippets("php", {
|
||||
s("func", fmta("function <>(<>)<> {\n <>\n}<>", { i(1), i(2), i(3), i(4), i(0) })),
|
||||
|
||||
s(
|
||||
"met",
|
||||
fmta(
|
||||
[[
|
||||
<> function <>(<>)<> {
|
||||
<>
|
||||
}<>
|
||||
]],
|
||||
{ c(1, { t "public", t "protected", t "private" }), i(2), i(3), i(4), i(5), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s("pest", fmta("<>('<>', function() {\n <>\n});", { c(1, { t "it", t "test" }), i(2), i(0) })),
|
||||
|
||||
s(
|
||||
"test",
|
||||
fmta(
|
||||
[[
|
||||
public function test<>(): void {
|
||||
<>
|
||||
}<>
|
||||
]],
|
||||
{ i(1), i(2), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
"testan",
|
||||
fmta(
|
||||
[[
|
||||
/** @test */
|
||||
public function <>(): void {
|
||||
<>
|
||||
}<>
|
||||
]],
|
||||
{ i(1), i(2), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
"testat",
|
||||
fmta(
|
||||
[[
|
||||
[#Test]
|
||||
public function <>(): void {
|
||||
<>
|
||||
}<>
|
||||
]],
|
||||
{ i(1), i(2), i(0) }
|
||||
)
|
||||
),
|
||||
})
|
|
@ -0,0 +1,63 @@
|
|||
require("luasnip.session.snippet_collection").clear_snippets "rst"
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
|
||||
local fill_line = function(char)
|
||||
return function()
|
||||
local row = vim.api.nvim_win_get_cursor(0)[1]
|
||||
local lines = vim.api.nvim_buf_get_lines(0, row - 2, row, false)
|
||||
return string.rep(char, #lines[1])
|
||||
end
|
||||
end
|
||||
|
||||
ls.add_snippets("rst", {
|
||||
s("class", t(".. class:: ", i(1))),
|
||||
|
||||
s("footer", t(".. footer:: ", i(1))),
|
||||
|
||||
s("link", t(".. _", i(1), ":")),
|
||||
|
||||
s("raw", t(".. raw:: ", i(1))),
|
||||
|
||||
-- TODO: add an optional new line and ":width" property.
|
||||
s("image", t(".. image:: ", i(1))),
|
||||
|
||||
s("head", f(fill_line "=", {})),
|
||||
|
||||
s("sub", f(fill_line "-", {})),
|
||||
|
||||
s("subsub", f(fill_line "^", {})),
|
||||
|
||||
-- Add a page break with an optional page template.
|
||||
s(
|
||||
"pb",
|
||||
fmta(
|
||||
[[
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak<>
|
||||
]],
|
||||
{ i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
-- Add a new speaker note.
|
||||
s(
|
||||
"ta",
|
||||
fmta(
|
||||
[[
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "<>"
|
||||
]],
|
||||
{ i(0) }
|
||||
)
|
||||
),
|
||||
})
|
|
@ -0,0 +1,12 @@
|
|||
require("luasnip.session.snippet_collection").clear_snippets "scss"
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
local i = ls.insert_node
|
||||
local s = ls.snippet
|
||||
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
|
||||
ls.add_snippets("scss", {
|
||||
s("bp", fmta("@include breakpoint(<>) {\n <>\n}", { i(1), i(0) })),
|
||||
})
|
|
@ -0,0 +1,28 @@
|
|||
require("luasnip.session.snippet_collection").clear_snippets "twig"
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
|
||||
ls.add_snippets("twig", {
|
||||
s("do", fmta("{% <> %}<>", { i(1), i(0) })),
|
||||
s("dump", fmta("{{ dump(<>) }}<>", { i(1), i(0) })),
|
||||
s("echo", fmta("{{ <> }}<>", { i(1), i(0) })),
|
||||
|
||||
s(
|
||||
"for",
|
||||
fmta(
|
||||
[[
|
||||
{% for <> in <> %}
|
||||
<>
|
||||
{% endfor %}<>
|
||||
]],
|
||||
{ i(1), i(2), i(3), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s("if", fmta("{% if <> %}<>{% endif %}<>", { i(1), i(2), i(0) })),
|
||||
})
|
|
@ -0,0 +1,47 @@
|
|||
require("luasnip.session.snippet_collection").clear_snippets "yaml"
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
local c = ls.choice_node
|
||||
local i = ls.insert_node
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
|
||||
ls.add_snippets("yaml", {
|
||||
s(
|
||||
"drupal_info",
|
||||
fmta(
|
||||
[[
|
||||
name: <module_name>
|
||||
description: <description>
|
||||
core_version_requirement: ^10 || ^11
|
||||
type: <type>
|
||||
package: <package>
|
||||
]],
|
||||
{ module_name = i(1), description = i(2), type = c(3, { t "module", t "theme" }), package = i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
"drupal_route",
|
||||
fmta(
|
||||
[[
|
||||
<module>.<route>:
|
||||
path: /<path>
|
||||
defaults:
|
||||
_controller: Drupal\<module_same>\Controller\<class>
|
||||
# _form:
|
||||
# _title:
|
||||
# _title_callback:
|
||||
methods: [GET]
|
||||
requirements:
|
||||
_permission: access content
|
||||
# _access: TRUE<finish>
|
||||
]],
|
||||
{ module = i(1), route = i(2), path = i(3), module_same = rep(1), class = i(4), finish = i(0) }
|
||||
)
|
||||
),
|
||||
})
|
|
@ -0,0 +1,57 @@
|
|||
local conf = require("telescope.config").values
|
||||
local finders = require "telescope.finders"
|
||||
local make_entry = require "telescope.make_entry"
|
||||
local pickers = require "telescope.pickers"
|
||||
|
||||
local M = {}
|
||||
|
||||
local live_multigrep = function(opts)
|
||||
opts = opts or {}
|
||||
opts.cwd = opts.cwd or vim.uv.cwd()
|
||||
|
||||
local finder = finders.new_async_job {
|
||||
command_generator = function(prompt)
|
||||
if not prompt or prompt == "" then
|
||||
return nil
|
||||
end
|
||||
|
||||
local pieces = vim.split(prompt, " ")
|
||||
local args = { "rg" }
|
||||
|
||||
if pieces[1] then
|
||||
table.insert(args, "-e")
|
||||
table.insert(args, pieces[1])
|
||||
end
|
||||
|
||||
if pieces[2] then
|
||||
table.insert(args, "-g")
|
||||
table.insert(args, pieces[2])
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: deprecated
|
||||
return vim.tbl_flatten {
|
||||
args,
|
||||
{ "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" },
|
||||
}
|
||||
end,
|
||||
|
||||
cwd = opts.cwd,
|
||||
entry_maker = make_entry.gen_from_vimgrep(opts),
|
||||
}
|
||||
|
||||
pickers
|
||||
.new(opts, {
|
||||
debounce = 100,
|
||||
finder = finder,
|
||||
previewer = conf.grep_previewer(opts),
|
||||
prompt_title = "Multi Grep",
|
||||
sorter = require("telescope.sorters").empty(),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
vim.keymap.set("n", "<leader>fg", live_multigrep)
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,7 @@
|
|||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
desc = "Highlight when yanking (copying) text",
|
||||
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,25 @@
|
|||
local status_ok, catppuccin = pcall(require, "catppuccin")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
catppuccin.setup {
|
||||
flavour = "macchiato",
|
||||
integrations = {
|
||||
cmp = true,
|
||||
gitsigns = true,
|
||||
mini = {
|
||||
enabled = true,
|
||||
indentscope_color = "",
|
||||
},
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
},
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
},
|
||||
term_colors = true,
|
||||
transparent_background = true,
|
||||
}
|
||||
|
||||
vim.cmd.colorscheme "catppuccin"
|
19
modules/home-manager/cli/neovim/config/plugin/comment.lua
Normal file
19
modules/home-manager/cli/neovim/config/plugin/comment.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local status_ok, comment = pcall(require, "Comment")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
comment.setup {
|
||||
padding = true,
|
||||
|
||||
opleader = {
|
||||
line = "gc",
|
||||
block = "gb",
|
||||
},
|
||||
|
||||
mappings = {
|
||||
basic = true,
|
||||
extra = true,
|
||||
extended = false,
|
||||
},
|
||||
}
|
76
modules/home-manager/cli/neovim/config/plugin/completion.lua
Normal file
76
modules/home-manager/cli/neovim/config/plugin/completion.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
local cmp = require "cmp"
|
||||
local ls = require "luasnip"
|
||||
|
||||
vim.opt.shortmess:append "c"
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
ls.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
|
||||
["<C-h>"] = cmp.mapping(function()
|
||||
if ls.locally_jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<C-l>"] = cmp.mapping(function()
|
||||
if ls.expand_or_locally_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<C-y>"] = cmp.mapping.confirm { select = true },
|
||||
["<tab>"] = cmp.config.disable,
|
||||
},
|
||||
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "calc" },
|
||||
},
|
||||
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format {
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[buf]",
|
||||
cmp_tabnine = "[tn]",
|
||||
luasnip = "[snip]",
|
||||
nvim_lsp = "[lsp]",
|
||||
nvim_lua = "[lua]",
|
||||
path = "[path]",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
experimental = {
|
||||
native_menu = false,
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup.filetype({ "mysql", "sql" }, {
|
||||
sources = {
|
||||
{ name = "vim-dadbod-completion" },
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
46
modules/home-manager/cli/neovim/config/plugin/conform.lua
Normal file
46
modules/home-manager/cli/neovim/config/plugin/conform.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
local conform = require "conform"
|
||||
|
||||
conform.setup {
|
||||
formatters_by_ft = {
|
||||
bash = { "shellcheck" },
|
||||
go = { "gofmt" },
|
||||
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
just = { "just" },
|
||||
lua = { "stylua" },
|
||||
nix = { "nixfmt" },
|
||||
php = { "php_cs_fixer", "phpcbf", stop_after_first = true },
|
||||
terraform = { "terraform_fmt" },
|
||||
yaml = { "yamlfmt" },
|
||||
},
|
||||
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable with a global or buffer-local variable.
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
|
||||
return {
|
||||
lsp_fallback = false,
|
||||
quiet = true,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
vim.api.nvim_create_user_command("FormatDisable", function(args)
|
||||
if args.bang then
|
||||
-- FormatDisable! will disable formatting just for this buffer
|
||||
vim.b.disable_autoformat = true
|
||||
else
|
||||
vim.g.disable_autoformat = true
|
||||
end
|
||||
end, {
|
||||
desc = "Disable autoformat-on-save",
|
||||
bang = true,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("FormatEnable", function()
|
||||
vim.b.disable_autoformat = false
|
||||
vim.g.disable_autoformat = false
|
||||
end, {
|
||||
desc = "Re-enable autoformat-on-save",
|
||||
})
|
69
modules/home-manager/cli/neovim/config/plugin/dap.lua
Normal file
69
modules/home-manager/cli/neovim/config/plugin/dap.lua
Normal file
|
@ -0,0 +1,69 @@
|
|||
local dap = require "dap"
|
||||
local ui = require "dapui"
|
||||
|
||||
dap.adapters.php = {
|
||||
type = "executable",
|
||||
command = "node",
|
||||
args = { os.getenv "HOME" .. "/build/vscode-php-debug/out/phpDebug.js" },
|
||||
}
|
||||
|
||||
dap.configurations.php = {
|
||||
{
|
||||
type = "php",
|
||||
request = "launch",
|
||||
name = "Listen for Xdebug",
|
||||
port = 9003,
|
||||
pathMappings = {
|
||||
["/app"] = "${workspaceFolder}",
|
||||
["/var/www/html"] = "${workspaceFolder}",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
dap.listeners.after.event_initialized["ui_config"] = function()
|
||||
ui.open()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_terminated["ui_config"] = function()
|
||||
ui.close()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_exited["ui_config"] = function()
|
||||
ui.close()
|
||||
end
|
||||
|
||||
ui.setup {
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 0.25 },
|
||||
"breakpoints",
|
||||
"stacks",
|
||||
"watches",
|
||||
},
|
||||
size = 40, -- 40 columns
|
||||
position = "right",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
"console",
|
||||
},
|
||||
size = 0.25, -- 25% of total lines
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("nvim-dap-virtual-text").setup {
|
||||
commented = true,
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>b", dap.toggle_breakpoint)
|
||||
vim.keymap.set("n", "<leader>gb", dap.run_to_cursor)
|
||||
|
||||
vim.keymap.set("n", "<F1>", dap.continue)
|
||||
vim.keymap.set("n", "<F2>", dap.step_into)
|
||||
vim.keymap.set("n", "<F3>", dap.step_over)
|
||||
vim.keymap.set("n", "<F4>", dap.step_out)
|
||||
vim.keymap.set("n", "<F5>", dap.step_back)
|
|
@ -0,0 +1,54 @@
|
|||
vim.fn["edit_alternate#rule#add"]("php", function(filename)
|
||||
if filename:find "Test.php$" then
|
||||
filename = filename:gsub("Test.php$", ".php")
|
||||
|
||||
if filename:find "tests/src/" then
|
||||
-- Drupal tests. Remove the `src/{type}` from the path.
|
||||
return filename:gsub("tests/src/(.-)/", "src/")
|
||||
else
|
||||
return filename:gsub("tests/", "src/")
|
||||
end
|
||||
else
|
||||
filename = filename:gsub(".php$", "Test.php")
|
||||
|
||||
if filename:find "modules/custom" then
|
||||
-- Drupal test types.
|
||||
local test_types = { "Functional", "FunctionalJavaScript", "Kernel", "Unit" }
|
||||
|
||||
for _, test_type in ipairs(test_types) do
|
||||
local filename_with_test_type = filename:gsub("src/", string.format("tests/src/%s/", test_type))
|
||||
|
||||
-- Return the first matching test file that exists.
|
||||
if vim.fn.filereadable(filename_with_test_type) == 1 then
|
||||
return filename_with_test_type
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if vim.fn.filereadable "composer.json" == 1 then
|
||||
vim.fn["edit_alternate#rule#add"]("json", function(filename)
|
||||
if filename:find "composer.json" then
|
||||
return (filename:gsub("%.json$", ".lock"))
|
||||
end
|
||||
end)
|
||||
|
||||
vim.fn["edit_alternate#rule#add"]("lock", function(filename)
|
||||
if filename:find "composer.lock" then
|
||||
return (filename:gsub("%.lock$", ".json"))
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if vim.fn.filereadable "fractal.config.js" == 1 then
|
||||
vim.fn["edit_alternate#rule#add"]("twig", function(filename)
|
||||
return (filename:gsub("%.twig$", ".config.yml"))
|
||||
end)
|
||||
|
||||
vim.fn["edit_alternate#rule#add"]("yml", function(filename)
|
||||
return (filename:gsub("%.config.yml$", ".twig"))
|
||||
end)
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>ea", "<CMD>EditAlternate<CR>", { silent = true })
|
13
modules/home-manager/cli/neovim/config/plugin/filetype.lua
Normal file
13
modules/home-manager/cli/neovim/config/plugin/filetype.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
vim.filetype.add {
|
||||
extension = {
|
||||
inc = "php",
|
||||
install = "php",
|
||||
module = "php",
|
||||
pcss = "scss",
|
||||
theme = "php",
|
||||
},
|
||||
|
||||
filename = {
|
||||
["composer.lock"] = "json",
|
||||
},
|
||||
}
|
25
modules/home-manager/cli/neovim/config/plugin/fugitive.lua
Normal file
25
modules/home-manager/cli/neovim/config/plugin/fugitive.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
vim.keymap.set("n", "<leader>gc", "<cmd>Git commit<cr><C-w>K")
|
||||
|
||||
-- Open the ":Git" window in its own buffer, not a split.
|
||||
vim.keymap.set("n", "<leader>gs", "<cmd>0Git<cr>")
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||
pattern = "*",
|
||||
|
||||
callback = function()
|
||||
if vim.bo.ft ~= "fugitive" then
|
||||
return
|
||||
end
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
vim.keymap.set("n", "<leader>p", function()
|
||||
vim.cmd.Git "push"
|
||||
end, opts)
|
||||
|
||||
vim.keymap.set("n", "<leader>P", function()
|
||||
vim.cmd.Git { "pull", "--rebase" }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
30
modules/home-manager/cli/neovim/config/plugin/gitsigns.lua
Normal file
30
modules/home-manager/cli/neovim/config/plugin/gitsigns.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
local gitsigns = require "gitsigns"
|
||||
|
||||
gitsigns.setup {
|
||||
linehl = false,
|
||||
numhl = true,
|
||||
}
|
||||
|
||||
local set = vim.keymap.set
|
||||
|
||||
set("n", "[h", "<cmd>Gitsigns prev_hunk<CR>")
|
||||
set("n", "]h", "<cmd>Gitsigns next_hunk<CR>")
|
||||
|
||||
set("n", "<leader>hR", gitsigns.reset_buffer)
|
||||
set("n", "<leader>hS", gitsigns.stage_buffer)
|
||||
set("n", "<leader>hb", gitsigns.blame_line)
|
||||
set("n", "<leader>hp", gitsigns.preview_hunk)
|
||||
set("n", "<leader>hr", gitsigns.reset_hunk)
|
||||
set("n", "<leader>hs", gitsigns.stage_hunk)
|
||||
set("n", "<leader>hu", gitsigns.undo_stage_hunk)
|
||||
|
||||
set("v", "<leader>hr", function()
|
||||
gitsigns.reset_hunk { vim.fn.line ".", vim.fn.line "v" }
|
||||
end)
|
||||
|
||||
set("v", "<leader>hs", function()
|
||||
gitsigns.stage_hunk { vim.fn.line ".", vim.fn.line "v" }
|
||||
end)
|
||||
|
||||
-- Text object.
|
||||
set({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
34
modules/home-manager/cli/neovim/config/plugin/harpoon.lua
Normal file
34
modules/home-manager/cli/neovim/config/plugin/harpoon.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
local harpoon = require "harpoon"
|
||||
|
||||
harpoon:setup()
|
||||
|
||||
vim.keymap.set("n", "<leader>a", function()
|
||||
harpoon:list():add()
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<C-e>", function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<C-h>", function()
|
||||
harpoon:list():select(1)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<C-j>", function()
|
||||
harpoon:list():select(2)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<C-k>", function()
|
||||
harpoon:list():select(3)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<C-l>", function()
|
||||
harpoon:list():select(4)
|
||||
end)
|
||||
|
||||
-- Set <space>1..<space>5 be my shortcuts to moving to the files
|
||||
for _, idx in ipairs { 1, 2, 3, 4, 5 } do
|
||||
vim.keymap.set("n", string.format("<space>%d", idx), function()
|
||||
harpoon:list():select(idx)
|
||||
end)
|
||||
end
|
19
modules/home-manager/cli/neovim/config/plugin/lint.lua
Normal file
19
modules/home-manager/cli/neovim/config/plugin/lint.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local lint = require "lint"
|
||||
|
||||
lint.linters_by_ft = {
|
||||
dockerfile = { "hadolint" },
|
||||
javascript = { "eslint_d" },
|
||||
json = { "jsonlint" },
|
||||
lua = { "luacheck" },
|
||||
markdown = { "markdownlint" },
|
||||
nix = { "nix" },
|
||||
php = { "php", "phpcs", "phpstan" },
|
||||
}
|
||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
13
modules/home-manager/cli/neovim/config/plugin/mini.lua
Normal file
13
modules/home-manager/cli/neovim/config/plugin/mini.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
require("mini.ai").setup { n_lines = 500 }
|
||||
|
||||
require("mini.align").setup {}
|
||||
|
||||
require("mini.bracketed").setup {}
|
||||
|
||||
require("mini.move").setup {}
|
||||
|
||||
require("mini.operators").setup {}
|
||||
|
||||
require("mini.splitjoin").setup {}
|
||||
|
||||
require("mini.surround").setup {}
|
3
modules/home-manager/cli/neovim/config/plugin/netrw.lua
Normal file
3
modules/home-manager/cli/neovim/config/plugin/netrw.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.keymap.set("n", "-", vim.cmd.Ex)
|
||||
|
||||
vim.g.netrw_banner = 0
|
|
@ -0,0 +1,2 @@
|
|||
vim.keymap.set("n", "<leader>pm", "<cmd>PhpactorContextMenu<CR>")
|
||||
vim.keymap.set("n", "<leader>pn", "<cmd>PhpactorClassNew<CR>")
|
|
@ -0,0 +1,12 @@
|
|||
local refactoring = require "refactoring"
|
||||
|
||||
-- TODO: add keymaps - https://github.com/ThePrimeagen/refactoring.nvim#configuration-for-refactoring-operations
|
||||
refactoring.setup {}
|
||||
|
||||
local opts = { silent = true }
|
||||
|
||||
vim.keymap.set("n", "<Leader>ri", "<Cmd>lua require 'refactoring'.refactor 'Inline Variable'<Cr>", opts)
|
||||
|
||||
vim.keymap.set("v", "<Leader>re", "<Esc><Cmd>lua require 'refactoring'.refactor 'Extract Function'<Cr>", opts)
|
||||
vim.keymap.set("v", "<Leader>ri", "<Esc><Cmd>lua require 'refactoring'.refactor 'Inline Variable'<Cr>", opts)
|
||||
vim.keymap.set("v", "<Leader>rv", "<Esc><Cmd>lua require 'refactoring'.refactor 'Extract Variable'<Cr>", opts)
|
32
modules/home-manager/cli/neovim/config/plugin/snippets.lua
Normal file
32
modules/home-manager/cli/neovim/config/plugin/snippets.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local ls = require "luasnip"
|
||||
|
||||
ls.config.set_config {
|
||||
enable_autosnippets = true,
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
|
||||
for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("lua/opdavies/snippets/*.lua", true)) do
|
||||
loadfile(ft_path)()
|
||||
end
|
||||
|
||||
-- Expand the current item or just to the next item within the snippet.
|
||||
vim.keymap.set({ "i", "s" }, "<c-k>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
-- Jump backwards.
|
||||
vim.keymap.set({ "i", "s" }, "<c-j>", function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
-- Select within a list of options.
|
||||
vim.keymap.set("i", "<c-l>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end)
|
64
modules/home-manager/cli/neovim/config/plugin/telescope.lua
Normal file
64
modules/home-manager/cli/neovim/config/plugin/telescope.lua
Normal file
|
@ -0,0 +1,64 @@
|
|||
local telescope = require "telescope"
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
layout_config = { prompt_position = "top" },
|
||||
path_display = { truncate = 1 },
|
||||
prompt_prefix = "$ ",
|
||||
sorting_strategy = "ascending",
|
||||
},
|
||||
|
||||
pickers = {
|
||||
lsp_references = {
|
||||
previewer = false,
|
||||
},
|
||||
},
|
||||
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
telescope.load_extension "fzf"
|
||||
telescope.load_extension "refactoring"
|
||||
telescope.load_extension "ui-select"
|
||||
|
||||
local builtin = require "telescope.builtin"
|
||||
|
||||
local M = {}
|
||||
|
||||
M.grep_bluecheese = function()
|
||||
builtin.live_grep { cwd = "web/sites/default/themes/bluecheese" }
|
||||
end
|
||||
|
||||
M.grep_drupalorg_theme = function()
|
||||
builtin.live_grep { cwd = "web/themes/contrib/drupalorg_theme" }
|
||||
end
|
||||
|
||||
M.search_all_files = function()
|
||||
builtin.find_files {
|
||||
find_command = { "rg", "--no-ignore", "--files" },
|
||||
}
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<space>/", builtin.current_buffer_fuzzy_find)
|
||||
vim.keymap.set("n", "<space>fb", builtin.buffers)
|
||||
vim.keymap.set("n", "<space>fd", builtin.find_files)
|
||||
vim.keymap.set("n", "<space>fh", builtin.help_tags)
|
||||
vim.keymap.set("n", "<space>fi", M.search_all_files)
|
||||
vim.keymap.set("n", "<space>fk", builtin.keymaps)
|
||||
vim.keymap.set("n", "<space>fr", builtin.lsp_references)
|
||||
vim.keymap.set("n", "<space>ft", builtin.git_files)
|
||||
|
||||
vim.keymap.set("n", "<space>ds", builtin.lsp_document_symbols)
|
||||
|
||||
vim.keymap.set("n", "<space>gw", builtin.grep_string)
|
||||
|
||||
vim.keymap.set("n", "<space>dgb", M.grep_bluecheese)
|
||||
vim.keymap.set("n", "<space>dgd", M.grep_drupalorg_theme)
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<space>gw", builtin.grep_string)
|
||||
|
||||
require("opdavies.telescope.multigrep").setup {}
|
133
modules/home-manager/cli/neovim/config/plugin/treesitter.lua
Normal file
133
modules/home-manager/cli/neovim/config/plugin/treesitter.lua
Normal file
|
@ -0,0 +1,133 @@
|
|||
local configs = require "nvim-treesitter.configs"
|
||||
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
|
||||
|
||||
configs.setup {
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
context_commenting = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
indent = {
|
||||
disable = { "yaml" },
|
||||
enable = true,
|
||||
},
|
||||
|
||||
matchup = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
|
||||
keymaps = {
|
||||
["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" },
|
||||
["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" },
|
||||
["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" },
|
||||
["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" },
|
||||
|
||||
["a:"] = { query = "@property.outer", desc = "Select outer part of an object property" },
|
||||
["i:"] = { query = "@property.inner", desc = "Select inner part of an object property" },
|
||||
["l:"] = { query = "@property.lhs", desc = "Select left part of an object property" },
|
||||
["r:"] = { query = "@property.rhs", desc = "Select right part of an object property" },
|
||||
|
||||
["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" },
|
||||
["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" },
|
||||
|
||||
["ac"] = { query = "@class.outer", desc = "Select outer part of a class" },
|
||||
["ic"] = { query = "@class.inner", desc = "Select inner part of a class" },
|
||||
|
||||
["af"] = { query = "@call.outer", desc = "Select outer part of a function call" },
|
||||
["if"] = { query = "@call.inner", desc = "Select inner part of a function call" },
|
||||
|
||||
["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" },
|
||||
["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" },
|
||||
|
||||
["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" },
|
||||
["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" },
|
||||
|
||||
["am"] = { query = "@function.outer", desc = "Select outer part of a method/function definition" },
|
||||
["im"] = { query = "@function.inner", desc = "Select inner part of a method/function definition" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
swap = {
|
||||
enable = true,
|
||||
|
||||
swap_next = {
|
||||
["<leader>na"] = "@parameter.inner", -- swap parameters/argument with next
|
||||
["<leader>n:"] = "@property.outer", -- swap object property with next
|
||||
["<leader>nm"] = "@function.outer", -- swap function with next
|
||||
},
|
||||
|
||||
swap_previous = {
|
||||
["<leader>pa"] = "@parameter.inner", -- swap parameters/argument with prev
|
||||
["<leader>p:"] = "@property.outer", -- swap object property with prev
|
||||
["<leader>pm"] = "@function.outer", -- swap function with previous
|
||||
},
|
||||
},
|
||||
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
|
||||
goto_next_start = {
|
||||
["]f"] = { query = "@call.outer", desc = "Next function call start" },
|
||||
["]m"] = { query = "@function.outer", desc = "Next method/function def start" },
|
||||
["]c"] = { query = "@class.outer", desc = "Next class start" },
|
||||
["]i"] = { query = "@conditional.outer", desc = "Next conditional start" },
|
||||
["]l"] = { query = "@loop.outer", desc = "Next loop start" },
|
||||
|
||||
["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" },
|
||||
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
|
||||
},
|
||||
|
||||
goto_next_end = {
|
||||
["]F"] = { query = "@call.outer", desc = "Next function call end" },
|
||||
["]M"] = { query = "@function.outer", desc = "Next method/function def end" },
|
||||
["]C"] = { query = "@class.outer", desc = "Next class end" },
|
||||
["]I"] = { query = "@conditional.outer", desc = "Next conditional end" },
|
||||
["]L"] = { query = "@loop.outer", desc = "Next loop end" },
|
||||
},
|
||||
|
||||
goto_previous_start = {
|
||||
["[f"] = { query = "@call.outer", desc = "Prev function call start" },
|
||||
["[m"] = { query = "@function.outer", desc = "Prev method/function def start" },
|
||||
["[c"] = { query = "@class.outer", desc = "Prev class start" },
|
||||
["[i"] = { query = "@conditional.outer", desc = "Prev conditional start" },
|
||||
["[l"] = { query = "@loop.outer", desc = "Prev loop start" },
|
||||
},
|
||||
|
||||
goto_previous_end = {
|
||||
["[F"] = { query = "@call.outer", desc = "Prev function call end" },
|
||||
["[M"] = { query = "@function.outer", desc = "Prev method/function def end" },
|
||||
["[C"] = { query = "@class.outer", desc = "Prev class end" },
|
||||
["[I"] = { query = "@conditional.outer", desc = "Prev conditional end" },
|
||||
["[L"] = { query = "@loop.outer", desc = "Prev loop end" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local set = vim.keymap.set
|
||||
|
||||
set("n", "<leader>th", "<cmd>TSHighlightCapturesUnderCursor<CR>")
|
||||
set("n", "<leader>tp", "<cmd>TSPlaygroundToggle<CR>")
|
||||
|
||||
-- vim way: ; goes to the direction you were moving.
|
||||
set({ "n", "o", "x" }, ";", ts_repeat_move.repeat_last_move)
|
||||
set({ "n", "o", "x" }, ",", ts_repeat_move.repeat_last_move_opposite)
|
||||
|
||||
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
|
||||
set({ "n", "o", "x" }, "f", ts_repeat_move.builtin_f)
|
||||
set({ "n", "o", "x" }, "F", ts_repeat_move.builtin_F)
|
||||
set({ "n", "o", "x" }, "t", ts_repeat_move.builtin_t)
|
||||
set({ "n", "o", "x" }, "T", ts_repeat_move.builtin_T)
|
|
@ -0,0 +1 @@
|
|||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
16
modules/home-manager/cli/neovim/config/plugin/vim-test.lua
Normal file
16
modules/home-manager/cli/neovim/config/plugin/vim-test.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
local set = vim.keymap.set
|
||||
|
||||
local options = {
|
||||
silent = true,
|
||||
}
|
||||
|
||||
set("n", "<leader>tf", ":TestFile<CR>", options)
|
||||
set("n", "<leader>tg", ":TestVisit<CR>", options)
|
||||
set("n", "<leader>tl", ":TestLast<CR>", options)
|
||||
set("n", "<leader>tn", ":TestNearest<CR>", options)
|
||||
set("n", "<leader>ts", ":TestSuite<CR>", options)
|
||||
|
||||
vim.cmd [[
|
||||
let test#php#phpunit#options = '--colors=always --testdox'
|
||||
let g:test#strategy = 'vimux'
|
||||
]]
|
132
modules/home-manager/cli/neovim/config/spell/en.utf-8.add
Normal file
132
modules/home-manager/cli/neovim/config/spell/en.utf-8.add
Normal file
|
@ -0,0 +1,132 @@
|
|||
ANP
|
||||
AWS
|
||||
Acquia
|
||||
Ansible
|
||||
Appnovation
|
||||
Architected
|
||||
BAU
|
||||
Behat
|
||||
Bitbucket
|
||||
Bluecheese
|
||||
BrumPHP
|
||||
CMSes
|
||||
CTI
|
||||
Cachix
|
||||
Centarro
|
||||
CiviCRM
|
||||
Configs
|
||||
D7
|
||||
DDEV
|
||||
DevOps
|
||||
DigitalOcean
|
||||
Drupal
|
||||
Drupal's
|
||||
DrupalCamp
|
||||
DrupalCon
|
||||
DrupalEasy
|
||||
Drupaler
|
||||
Drush
|
||||
FPM
|
||||
FTSE
|
||||
GitLab
|
||||
Gitea
|
||||
HDN
|
||||
HashiCorp
|
||||
Hetzner
|
||||
Homelab
|
||||
Immich
|
||||
InvalidArgumentException
|
||||
Inviqa
|
||||
JSON
|
||||
Jellyfin
|
||||
Kickstart
|
||||
Lando
|
||||
Laravel
|
||||
Linode
|
||||
Magento
|
||||
MariaDB
|
||||
Microserve
|
||||
Mischa
|
||||
MySQL
|
||||
NGINX
|
||||
Neovim
|
||||
Netlify
|
||||
Nginx
|
||||
NixOS
|
||||
NodeInterface
|
||||
Nomensa
|
||||
OpenID
|
||||
OpenTofu
|
||||
PDOException
|
||||
PHPDoc
|
||||
PHPStan
|
||||
PHPUnit
|
||||
Packagist
|
||||
PhpStorm
|
||||
PostBuilder
|
||||
PostNodeRepository
|
||||
Pulumi
|
||||
S3
|
||||
SHA
|
||||
SQLSTATE
|
||||
SQLite
|
||||
SSO
|
||||
Sculpin
|
||||
Silex
|
||||
SimpleTest
|
||||
Sylius
|
||||
Symfony
|
||||
TODO
|
||||
TermInterface
|
||||
Themers
|
||||
Traefik
|
||||
TypeScript
|
||||
Ubercart
|
||||
VSCode
|
||||
Vaultwarden
|
||||
WCAG
|
||||
WSL
|
||||
Wellbeing
|
||||
ZSH
|
||||
Zellij
|
||||
Zettelkasten
|
||||
architected
|
||||
assertContainsOnlyInstancesOf
|
||||
assertSame
|
||||
bootcamp
|
||||
contrib
|
||||
devenv
|
||||
dotfiles
|
||||
drupal
|
||||
eCommerce
|
||||
foreach
|
||||
getPost
|
||||
ghostty
|
||||
hotfix
|
||||
isNotPublished
|
||||
isPublished
|
||||
localhost
|
||||
macOS
|
||||
mentees
|
||||
nixpkgs
|
||||
nodeStorage
|
||||
opdavies
|
||||
osCommerce
|
||||
param
|
||||
reStructuredText
|
||||
rebase
|
||||
rebasing
|
||||
roadmapping
|
||||
rst2pdf
|
||||
rwxrob
|
||||
src
|
||||
stylesheet
|
||||
stylesheets
|
||||
testbot
|
||||
tmux
|
||||
url
|
||||
vhost
|
||||
wildcard
|
||||
worktree
|
||||
worktrees
|
||||
www
|
8
modules/home-manager/cli/neovim/config/stylua.toml
Normal file
8
modules/home-manager/cli/neovim/config/stylua.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
line_endings = "Unix"
|
||||
no_call_parentheses = true
|
||||
quote_style = "AutoPreferDouble"
|
||||
|
||||
[sort_requires]
|
||||
enabled = true
|
193
modules/home-manager/cli/neovim/default.nix
Normal file
193
modules/home-manager/cli/neovim/default.nix
Normal file
|
@ -0,0 +1,193 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
php = pkgs.php82;
|
||||
phpPackages = pkgs.php82Packages;
|
||||
in
|
||||
{
|
||||
options.homeManagerModules.neovim.enable = mkEnableOption "Enable neovim";
|
||||
|
||||
config = mkIf config.homeManagerModules.neovim.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
comment-nvim
|
||||
conf-vim
|
||||
edit-alternate-vim
|
||||
gitsigns-nvim
|
||||
harpoon2
|
||||
mini-nvim
|
||||
nvim-web-devicons
|
||||
phpactor
|
||||
refactoring-nvim
|
||||
standard-vim
|
||||
undotree
|
||||
vim-caser
|
||||
vim-nix
|
||||
vim-pasta
|
||||
vim-repeat
|
||||
vim-sleuth
|
||||
vim-textobj-indent
|
||||
vim-textobj-user
|
||||
vim-textobj-xmlattr
|
||||
vim-unimpaired
|
||||
|
||||
# Testing
|
||||
vim-test
|
||||
vimux
|
||||
|
||||
# Git
|
||||
vim-fugitive
|
||||
|
||||
# Debugging
|
||||
nvim-dap
|
||||
nvim-dap-ui
|
||||
nvim-dap-virtual-text
|
||||
|
||||
# Treesitter
|
||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
||||
plugins: with plugins; [
|
||||
bash
|
||||
comment
|
||||
css
|
||||
csv
|
||||
dockerfile
|
||||
gitattributes
|
||||
gitignore
|
||||
go
|
||||
html
|
||||
javascript
|
||||
json
|
||||
kdl
|
||||
lua
|
||||
luadoc
|
||||
make
|
||||
markdown
|
||||
markdown_inline
|
||||
nix
|
||||
php
|
||||
phpdoc
|
||||
query
|
||||
rst
|
||||
scss
|
||||
sql
|
||||
terraform
|
||||
twig
|
||||
typescript
|
||||
vim
|
||||
vimdoc
|
||||
vue
|
||||
xml
|
||||
yaml
|
||||
]
|
||||
))
|
||||
nvim-treesitter-textobjects
|
||||
|
||||
# LSP, linting and formatting
|
||||
conform-nvim
|
||||
lsp-status-nvim
|
||||
nvim-lint
|
||||
nvim-lspconfig
|
||||
|
||||
# Completion
|
||||
cmp-buffer
|
||||
cmp-calc
|
||||
cmp-cmdline
|
||||
cmp-nvim-lsp
|
||||
cmp-path
|
||||
cmp-treesitter
|
||||
cmp_luasnip
|
||||
lspkind-nvim
|
||||
nvim-cmp
|
||||
|
||||
# Snippets
|
||||
friendly-snippets
|
||||
luasnip
|
||||
|
||||
# Telescope
|
||||
plenary-nvim
|
||||
popup-nvim
|
||||
telescope-frecency-nvim
|
||||
telescope-fzf-native-nvim
|
||||
telescope-live-grep-args-nvim
|
||||
telescope-nvim
|
||||
telescope-ui-select-nvim
|
||||
|
||||
# Databases
|
||||
vim-dadbod
|
||||
vim-dadbod-ui
|
||||
vim-dadbod-completion
|
||||
|
||||
# Themes
|
||||
catppuccin-nvim
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
# Languages
|
||||
nodePackages.typescript
|
||||
nodejs-slim
|
||||
php
|
||||
|
||||
# Language servers
|
||||
bash-language-server
|
||||
dockerfile-language-server-nodejs
|
||||
emmet-language-server
|
||||
gopls
|
||||
lua-language-server
|
||||
lua54Packages.luacheck
|
||||
marksman
|
||||
nixd
|
||||
phpactor
|
||||
tailwindcss-language-server
|
||||
terraform-ls
|
||||
typescript-language-server
|
||||
vscode-langservers-extracted
|
||||
vue-language-server
|
||||
yaml-language-server
|
||||
|
||||
# Formatters
|
||||
black
|
||||
eslint_d
|
||||
nixfmt-rfc-style
|
||||
nodePackages.prettier
|
||||
stylua
|
||||
yamlfmt
|
||||
|
||||
# Tools
|
||||
hadolint
|
||||
html-tidy
|
||||
mariadb
|
||||
nodePackages.jsonlint
|
||||
nodePackages.markdownlint-cli
|
||||
phpPackages.php-codesniffer
|
||||
phpPackages.phpstan
|
||||
proselint
|
||||
ripgrep
|
||||
shellcheck
|
||||
yamllint
|
||||
];
|
||||
};
|
||||
|
||||
xdg.configFile.nvim = {
|
||||
source = ./config;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
home.file.".markdownlint.yaml".text = ''
|
||||
default: true
|
||||
|
||||
line-length: false
|
||||
|
||||
no-duplicate-heading:
|
||||
siblings_only: true
|
||||
'';
|
||||
};
|
||||
}
|
335
modules/home-manager/cli/newsboat.nix
Normal file
335
modules/home-manager/cli/newsboat.nix
Normal file
|
@ -0,0 +1,335 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.homeManagerModules.newsboat.enable = mkEnableOption "Enable newsboat";
|
||||
|
||||
config = mkIf config.homeManagerModules.newsboat.enable {
|
||||
programs.newsboat = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = ''
|
||||
bind-key j down
|
||||
bind-key k up
|
||||
|
||||
bind-key j next articlelist
|
||||
bind-key k prev articlelist
|
||||
bind-key J next-feed articlelist
|
||||
bind-key K prev-feed articlelist
|
||||
|
||||
bind-key g home
|
||||
bind-key G end
|
||||
|
||||
bind-key d pagedown
|
||||
bind-key u pageup
|
||||
|
||||
bind-key a toggle-article-read
|
||||
bind-key n next-unread
|
||||
bind-key N prev-unread
|
||||
bind-key x pb-delete
|
||||
|
||||
color info white black bold
|
||||
'';
|
||||
|
||||
urls = [
|
||||
{ url = "https://www.reddit.com/r/nginx/new/.rss"; }
|
||||
{ url = "https://www.reddit.com/r/devops/.rss"; }
|
||||
{ url = "https://medium.com/feed/@bdfinst"; }
|
||||
{ url = "https://blog.system76.com/rss"; }
|
||||
{ url = "https://medium.com/feed/@codemonkeymike"; }
|
||||
{ url = "https://www.reddit.com/r/devops/new/.rss"; }
|
||||
{ url = "https://www.reddit.com/r/sysadmin/.rss"; }
|
||||
{
|
||||
url = "https://www.carlpullein.com/blog?format=RSS";
|
||||
title = "Carl Pullein";
|
||||
tags = [ "Productivity" ];
|
||||
}
|
||||
{ url = "https://feeds.feedburner.com/Faildesk"; }
|
||||
{ url = "https://syndication.thedailywtf.com/TheDailyWtf"; }
|
||||
{ url = "https://www.sherdog.com/rss/videos2.xml"; }
|
||||
{
|
||||
url = "https://www.reddit.com/r/MMA/.rss";
|
||||
tags = [ "MMA" ];
|
||||
}
|
||||
{
|
||||
url = "https://mmaweekly.com/feed/rss";
|
||||
tags = [ "MMA" ];
|
||||
}
|
||||
{
|
||||
url = "https://www.sherdog.com/rss/news2.xml";
|
||||
tags = [ "MMA" ];
|
||||
}
|
||||
{
|
||||
url = "https://www.sherdog.com/rss/articles2.xml";
|
||||
tags = [ "MMA" ];
|
||||
}
|
||||
{
|
||||
url = "https://www.ufc.com/rss/news";
|
||||
tags = [ "MMA" ];
|
||||
}
|
||||
{ url = "https://www.theregister.co.uk/headlines.atom"; }
|
||||
{
|
||||
url = "https://www.rbs6nations.com/en/RssLatestNews.xml";
|
||||
tags = [ "Rugby" ];
|
||||
}
|
||||
{
|
||||
url = "https://feeds.feedburner.com/rugbydump";
|
||||
tags = [ "Rugby" ];
|
||||
}
|
||||
{
|
||||
url = "https://www.telegraph.co.uk/sport/rugbyunion/rss";
|
||||
tags = [ "Rugby" ];
|
||||
}
|
||||
{ url = "https://code.facebook.com/posts/rss"; }
|
||||
{ url = "https://nginx.com/feed/rss"; }
|
||||
{
|
||||
url = "https://www.lornajane.net/feed";
|
||||
tags = [ "Software" ];
|
||||
}
|
||||
{
|
||||
url = "https://nginx.org/index.rss";
|
||||
tags = [ "Software" ];
|
||||
}
|
||||
{ url = "https://www.engadget.com/rss.xml"; }
|
||||
{ url = "https://rss.slashdot.org/Slashdot/slashdotIt"; }
|
||||
{ url = "https://lwn.net/headlines/newrss"; }
|
||||
{ url = "https://rss.slashdot.org/Slashdot/slashdotLinux"; }
|
||||
{
|
||||
url = "https://blog.sebastian-daschner.com/feeds/rss";
|
||||
title = "Sebastian Daschner";
|
||||
}
|
||||
{ url = "https://www.reddit.com/r/linux/.rss"; }
|
||||
{ url = "https://githubengineering.com/atom.xml"; }
|
||||
{ url = "https://rss.slashdot.org/Slashdot/slashdotDevelopers"; }
|
||||
{ url = "https://www.alistapart.com/rss.xml"; }
|
||||
{ url = "https://www.christitus.com/index.xml"; }
|
||||
{ url = "https://www.freeagentcentral.com/feed.rss"; }
|
||||
{ url = "https://akrabat.com/feed Software"; }
|
||||
{ url = "https://jasonmccreary.me/feed.atom"; }
|
||||
{ url = "https://martinfowler.com/bliki/bliki.atom"; }
|
||||
{ url = "https://lornajane.net/feed"; }
|
||||
{ url = "https://christoph-rumpel.com/feed.xml"; }
|
||||
{ url = "https://gdstechnology.blog.gov.uk/feed/atom"; }
|
||||
{ url = "https://weierophinney.net/matthew/feeds/index.rss2"; }
|
||||
{ url = "https://stitcher.io/rss"; }
|
||||
{ url = "https://www.reddit.com/r/css.rss"; }
|
||||
{ url = "https://www.reddit.com/r/PHP/.rss"; }
|
||||
{ url = "https://whateverthing.com/atom.xml"; }
|
||||
{ url = "https://mnapoli.fr/atom.xml"; }
|
||||
{ url = "https://www.epicweb.dev/rss.xml?ck_subscriber_id=2498091571"; }
|
||||
{ url = "https://dev.to/feed"; }
|
||||
{ url = "https://localheinz.com/feed.xml"; }
|
||||
{ url = "https://www.ben-morris.com/feed"; }
|
||||
{ url = "https://www.jbrains.ca/rss"; }
|
||||
{ url = "https://blog.thecodewhisperer.com/rss"; }
|
||||
{ url = "https://odan.github.io/feed.xml"; }
|
||||
{ url = "https://feeds.feedburner.com/symfony/blog"; }
|
||||
{ url = "https://www.alwaysagileconsulting.com/feed"; }
|
||||
{ url = "https://blog.sensiolabs.com/feed"; }
|
||||
{ url = "https://pascalbaljetmedia.com/rss"; }
|
||||
{ url = "https://tighten.co/blog/feed.atom"; }
|
||||
{ url = "https://ryangjchandler.co.uk/feed"; }
|
||||
{ url = "https://jnsgr.uk/posts/index.xml"; }
|
||||
{ url = "https://timacdonald.me/feed.xml"; }
|
||||
{ url = "https://phppot.com/feed"; }
|
||||
{ url = "https://howtocodewell.libsyn.com/rss"; }
|
||||
{ url = "https://ctankersley.com/atom.xml"; }
|
||||
{ url = "https://blog.wyrihaximus.net/atom.xml"; }
|
||||
{ url = "https://dotfyle.com/this-week-in-neovim/rss.xml"; }
|
||||
{ url = "https://paul-m-jones.com/feed"; }
|
||||
{ url = "https://www.tomasvotruba.cz/rss.xml"; }
|
||||
{ url = "https://www.reddit.com/r/git/.rss"; }
|
||||
{ url = "https://www.daveismyname.com/feed"; }
|
||||
{
|
||||
url = "https://murze.be/feed/php";
|
||||
title = "freek.dev";
|
||||
tags = [
|
||||
"PHP"
|
||||
"Laravel"
|
||||
"Software"
|
||||
];
|
||||
}
|
||||
{ url = "https://nikic.github.io/rss.xml"; }
|
||||
{
|
||||
url = "https://drupal.org/planet/rss.xml";
|
||||
tags = [ "Drupal" ];
|
||||
}
|
||||
{ url = "https://www.bram.us/feed"; }
|
||||
{ url = "https://feeds.feedburner.com/GiantRobotsSmashingIntoOtherGiantRobots"; }
|
||||
{ url = "https://murze.be/feed/originals"; }
|
||||
{ url = "https://www.patkua.com/feed"; }
|
||||
{ url = "https://www.benjystanton.co.uk/feed.xml"; }
|
||||
{
|
||||
url = "https://drupal.org/security/rss.xml";
|
||||
tags = [ "Drupal" ];
|
||||
}
|
||||
{
|
||||
url = "https://uk.indeed.com/rss?q=symfony&l=np18";
|
||||
tags = [ "Jobs" ];
|
||||
}
|
||||
{
|
||||
url = "https://uk.indeed.com/rss?q=php&l=np18";
|
||||
tags = [ "Jobs" ];
|
||||
}
|
||||
{
|
||||
url = "https://jobs.drupal.org/all-jobs/feed";
|
||||
tags = [ "Jobs" ];
|
||||
}
|
||||
{
|
||||
url = "https://www.reed.co.uk/jobs/rss/np18?source=rss&keywords=drupal&salaryfrom=50000&sortby=DisplayDate";
|
||||
tags = [ "Jobs" ];
|
||||
}
|
||||
{
|
||||
url = "https://www.reed.co.uk/jobs/rss/np18?source=rss&keywords=php&salaryfrom=50000&sortby=DisplayDate";
|
||||
tags = [ "Jobs" ];
|
||||
}
|
||||
{
|
||||
url = "https://uk.indeed.com/rss?q=drupal&l=np18";
|
||||
tags = [ "Jobs" ];
|
||||
}
|
||||
{
|
||||
url = "https://www.reed.co.uk/jobs/rss/np18?source=rss&keywords=symfony&salaryfrom=50000&sortby=DisplayDate";
|
||||
tags = [ "Jobs" ];
|
||||
}
|
||||
{ url = "https://emilywebber.co.uk/feed"; }
|
||||
{ url = "https://introvertdear.com/feed"; }
|
||||
{ url = "https://designli.co/blog/feed"; }
|
||||
{ url = "https://www.oliverdavies.uk/rss/daily.xml"; }
|
||||
{
|
||||
url = "https://www.drupal.org/project/issues/rss/override_node_options";
|
||||
tags = [ "Drupal" ];
|
||||
}
|
||||
{
|
||||
url = "https://www.drupal.org/project/issues/rss/tailwindcss";
|
||||
tags = [ "Drupal" ];
|
||||
}
|
||||
{
|
||||
url = "https://nixos.org/blog/announcements-rss.xml";
|
||||
tags = [ "Linux" ];
|
||||
}
|
||||
{
|
||||
url = "https://laracasts.com/feed";
|
||||
tags = [
|
||||
"PHP"
|
||||
"Laravel"
|
||||
];
|
||||
}
|
||||
{
|
||||
url = "https://feeds.feedburner.com/knpuniversity";
|
||||
title = "SymfonyCasts";
|
||||
tags = [
|
||||
"PHP"
|
||||
"Symfony"
|
||||
];
|
||||
}
|
||||
{
|
||||
url = "https://nickjanetakis.com/atom.xml";
|
||||
title = "Nick Janetakis";
|
||||
}
|
||||
{
|
||||
url = "https://www.learnlinux.tv/feed";
|
||||
tags = [ "Linux" ];
|
||||
}
|
||||
{
|
||||
url = "https://tailwindcss.com/feeds/feed.xml";
|
||||
tags = [
|
||||
"Software"
|
||||
"CSS"
|
||||
];
|
||||
}
|
||||
{
|
||||
url = "https://monospacementor.com/feed";
|
||||
tags = [
|
||||
"Linux"
|
||||
"Software"
|
||||
];
|
||||
}
|
||||
{
|
||||
url = "https://frontendmasters.com/blog/feed";
|
||||
tags = [ "Software" ];
|
||||
title = "Frontend Masters Boost";
|
||||
}
|
||||
{
|
||||
url = "https://www.youtube.com/feeds/videos.xml?channel_id=UC2aHRY064THg_t7JZoGSYGg";
|
||||
title = "YouTube - elysse";
|
||||
tags = [
|
||||
"Software"
|
||||
"YouTube"
|
||||
];
|
||||
}
|
||||
{
|
||||
url = "https://www.youtube.com/feeds/videos.xml?channel_id=UCSUA5RARrNt4-Ik3qtbETLQ";
|
||||
title = "YouTube - Jason Swett";
|
||||
tags = [
|
||||
"Software"
|
||||
"YouTube"
|
||||
];
|
||||
}
|
||||
{
|
||||
url = "https://www.youtube.com/feeds/videos.xml?channel_id=UCorzANoC3fX9VVefJHM5wtA";
|
||||
title = "~YouTube - Nick Janetakis";
|
||||
tags = [
|
||||
"Software"
|
||||
"YouTube"
|
||||
];
|
||||
}
|
||||
{ url = "https://devenv.sh/feed_rss_created.xml"; }
|
||||
{ url = "https://sive.rs/en.atom"; }
|
||||
{ url = "https://kressle.in/feed.xml"; }
|
||||
{
|
||||
url = "https://github.com/sculpin/sculpin/releases.atom";
|
||||
tags = [
|
||||
"PHP"
|
||||
"Sculpin"
|
||||
"Open Source"
|
||||
];
|
||||
}
|
||||
{ url = "https://www.theminimalists.com/feed"; }
|
||||
{ url = "https://opensourcepledge.com/rss.xml"; }
|
||||
{
|
||||
url = "https://feeds.bbci.co.uk/sport/rugby-union/teams/ng-dragons/rss.xml";
|
||||
tags = [ "Rugby" ];
|
||||
}
|
||||
{
|
||||
url = "https://openrss.org/www.twitch.tv/thealtf4stream/videos?filter=all&sort=time";
|
||||
tags = [ "Twitch" ];
|
||||
}
|
||||
{
|
||||
url = "https://openrss.org/www.twitch.tv/theprimeagen/videos?filter=all&sort=time";
|
||||
tags = [ "Twitch" ];
|
||||
}
|
||||
{
|
||||
url = "https://openrss.org/www.twitch.tv/teej_dv/videos?filter=all&sort=time";
|
||||
tags = [ "Twitch" ];
|
||||
}
|
||||
{
|
||||
url = "https://openrss.org/www.twitch.tv/monospacementor/videos?filter=all&sort=time";
|
||||
tags = [ "Twitch" ];
|
||||
}
|
||||
{ url = "https://www.reddit.com/r/librewolf/new/.rss"; }
|
||||
{
|
||||
url = "https://www.youtube.com/feeds/videos.xml?channel_id=UCSJKQnpmPcdkysduL0mNktg";
|
||||
title = "YouTube - teej_daily";
|
||||
tags = [
|
||||
"Software"
|
||||
"YouTube"
|
||||
];
|
||||
}
|
||||
{
|
||||
url = "https://feeds.bbci.co.uk/sport/rugby-union/rss.xml";
|
||||
tags = [ "Rugby" ];
|
||||
}
|
||||
{
|
||||
url = "https://feeds.bbci.co.uk/sport/rugby-union/teams/ng-dragons/rss.xml";
|
||||
tags = [ "Rugby" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
}
|
32
modules/home-manager/cli/notes.nix
Normal file
32
modules/home-manager/cli/notes.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.homeManagerModules.notes;
|
||||
in
|
||||
{
|
||||
options.homeManagerModules.notes = {
|
||||
enable = mkEnableOption "Enable notes";
|
||||
|
||||
directory = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
packages = with pkgs; [ notes ];
|
||||
|
||||
sessionVariables = {
|
||||
NOTES_DIRECTORY = "${cfg.directory}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
6
modules/home-manager/cli/phpactor/config/phpactor.yml
Normal file
6
modules/home-manager/cli/phpactor/config/phpactor.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
code_transform.class_new.variants:
|
||||
collection: collection
|
||||
default: default
|
||||
drupal-functional-test: drupal-functional-test
|
||||
drupal-kernel-test: drupal-kernel-test
|
||||
drupal-unit-test: drupal-unit-test
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} implements \IteratorAggregate {
|
||||
|
||||
public function __construct(private array $items = []) {
|
||||
}
|
||||
|
||||
public function getIterator(): \Iterator {
|
||||
return new \ArrayIterator($this->items);
|
||||
}
|
||||
|
||||
public function toArray(): array {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
}
|
||||
{% endfor %}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} {
|
||||
}
|
||||
{% endfor %}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} extends BrowserTestBase {
|
||||
|
||||
public $defaultTheme = 'stark';
|
||||
|
||||
public static $modules = [];
|
||||
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
||||
{% endfor %}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} extends KernelTestBase {
|
||||
|
||||
public static $modules = [];
|
||||
|
||||
protected $strictConfigSchema = FALSE;
|
||||
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
||||
{% endfor %}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} extends UnitTestCase {
|
||||
|
||||
}
|
||||
{% endfor %}
|
6
modules/home-manager/cli/phpactor/default.nix
Normal file
6
modules/home-manager/cli/phpactor/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
xdg.configFile.phpactor = {
|
||||
source = ./config;
|
||||
recursive = true;
|
||||
};
|
||||
}
|
175
modules/home-manager/cli/starship.nix
Normal file
175
modules/home-manager/cli/starship.nix
Normal file
|
@ -0,0 +1,175 @@
|
|||
let
|
||||
inherit (builtins) concatStringsSep;
|
||||
in
|
||||
{
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
settings = {
|
||||
add_newline = false;
|
||||
|
||||
# https://starship.rs/config/#prompt
|
||||
format = concatStringsSep "" [
|
||||
"\n"
|
||||
"$username"
|
||||
"$hostname"
|
||||
"$directory"
|
||||
"$vcsh"
|
||||
"$git_branch"
|
||||
"$git_status"
|
||||
"$git_metrics"
|
||||
"$docker_context"
|
||||
"$nodejs"
|
||||
"$php"
|
||||
"$terraform"
|
||||
"$nix_shell"
|
||||
"$direnv"
|
||||
"\${custom.mob}"
|
||||
"$memory_usage"
|
||||
"$cmd_duration"
|
||||
"$lua"
|
||||
"$status"
|
||||
"$character"
|
||||
];
|
||||
|
||||
cmd_duration.disabled = true;
|
||||
direnv.disabled = false;
|
||||
directory.format = "[$path]($style) ";
|
||||
git_status.disabled = true;
|
||||
nix_shell.disabled = true;
|
||||
nodejs.disabled = true;
|
||||
php.disabled = true;
|
||||
username.disabled = true;
|
||||
|
||||
custom = {
|
||||
mob = {
|
||||
command = "echo $MOB_TIMER_ROOM";
|
||||
format = "[($output)]($style) ";
|
||||
when = "[[ -v MOB_TIMER_ROOM ]]";
|
||||
};
|
||||
};
|
||||
|
||||
# https://starship.rs/presets/plain-text
|
||||
aws.symbol = "aws ";
|
||||
azure.symbol = "az ";
|
||||
bun.symbol = "bun ";
|
||||
c.symbol = "C ";
|
||||
character = {
|
||||
success_symbol = "[>](bold green)";
|
||||
error_symbol = "[x](bold red)";
|
||||
vimcmd_symbol = "[<](bold green)";
|
||||
};
|
||||
cobol.symbol = "cobol ";
|
||||
conda.symbol = "conda ";
|
||||
crystal.symbol = "cr ";
|
||||
cmake.symbol = "cmake ";
|
||||
daml.symbol = "daml ";
|
||||
dart.symbol = "dart ";
|
||||
deno.symbol = "deno ";
|
||||
dotnet.symbol = ".NET ";
|
||||
directory.read_only = " ro";
|
||||
docker_context.symbol = "docker ";
|
||||
elixir.symbol = "exs ";
|
||||
elm.symbol = "elm ";
|
||||
fennel.symbol = "fnl ";
|
||||
fossil_branch.symbol = "fossil ";
|
||||
gcloud.symbol = "gcp ";
|
||||
git_branch.symbol = "git ";
|
||||
git_commit.tag_symbol = " tag ";
|
||||
git_status = {
|
||||
ahead = ">";
|
||||
behind = "<";
|
||||
diverged = "<>";
|
||||
renamed = "r";
|
||||
deleted = "x";
|
||||
};
|
||||
gleam.symbol = "gleam ";
|
||||
golang.symbol = "go ";
|
||||
gradle.symbol = "gradle ";
|
||||
guix_shell.symbol = "guix ";
|
||||
hg_branch.symbol = "hg ";
|
||||
java.symbol = "java ";
|
||||
julia.symbol = "jl ";
|
||||
kotlin.symbol = "kt ";
|
||||
lua.symbol = "lua ";
|
||||
nodejs.symbol = "nodejs ";
|
||||
memory_usage.symbol = "memory ";
|
||||
meson.symbol = "meson ";
|
||||
nats.symbol = "nats ";
|
||||
nim.symbol = "nim ";
|
||||
nix_shell.symbol = "nix ";
|
||||
ocaml.symbol = "ml ";
|
||||
opa.symbol = "opa ";
|
||||
os.symbols = {
|
||||
AIX = "aix ";
|
||||
Alpaquita = "alq ";
|
||||
AlmaLinux = "alma ";
|
||||
Alpine = "alp ";
|
||||
Amazon = "amz ";
|
||||
Android = "andr ";
|
||||
Arch = "rch ";
|
||||
Artix = "atx ";
|
||||
CentOS = "cent ";
|
||||
Debian = "deb ";
|
||||
DragonFly = "dfbsd ";
|
||||
Emscripten = "emsc ";
|
||||
EndeavourOS = "ndev ";
|
||||
Fedora = "fed ";
|
||||
FreeBSD = "fbsd ";
|
||||
Garuda = "garu ";
|
||||
Gentoo = "gent ";
|
||||
HardenedBSD = "hbsd ";
|
||||
Illumos = "lum ";
|
||||
Kali = "kali ";
|
||||
Linux = "lnx ";
|
||||
Mabox = "mbox ";
|
||||
Macos = "mac ";
|
||||
Manjaro = "mjo ";
|
||||
Mariner = "mrn ";
|
||||
MidnightBSD = "mid ";
|
||||
Mint = "mint ";
|
||||
NetBSD = "nbsd ";
|
||||
NixOS = "nix ";
|
||||
OpenBSD = "obsd ";
|
||||
OpenCloudOS = "ocos ";
|
||||
openEuler = "oeul ";
|
||||
openSUSE = "osuse ";
|
||||
OracleLinux = "orac ";
|
||||
Pop = "pop ";
|
||||
Raspbian = "rasp ";
|
||||
Redhat = "rhl ";
|
||||
RedHatEnterprise = "rhel ";
|
||||
RockyLinux = "rky ";
|
||||
Redox = "redox ";
|
||||
Solus = "sol ";
|
||||
SUSE = "suse ";
|
||||
Ubuntu = "ubnt ";
|
||||
Ultramarine = "ultm ";
|
||||
Unknown = "unk ";
|
||||
Void = "void ";
|
||||
Windows = "win ";
|
||||
};
|
||||
package.symbol = "pkg ";
|
||||
perl.symbol = "pl ";
|
||||
php.symbol = "php ";
|
||||
pijul_channel.symbol = "pijul ";
|
||||
pulumi.symbol = "pulumi ";
|
||||
purescript.symbol = "purs ";
|
||||
python.symbol = "py ";
|
||||
quarto.symbol = "quarto ";
|
||||
raku.symbol = "raku ";
|
||||
ruby.symbol = "rb ";
|
||||
rust.symbol = "rs ";
|
||||
scala.symbol = "scala ";
|
||||
spack.symbol = "spack ";
|
||||
solidity.symbol = "solidity ";
|
||||
status.symbol = "[x](bold red) ";
|
||||
sudo.symbol = "sudo ";
|
||||
swift.symbol = "swift ";
|
||||
typst.symbol = "typst ";
|
||||
terraform.symbol = "terraform ";
|
||||
zig.symbol = "zig ";
|
||||
};
|
||||
};
|
||||
}
|
41
modules/home-manager/cli/tmux-sessionizer.nix
Normal file
41
modules/home-manager/cli/tmux-sessionizer.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.homeManagerModules.tmux-sessionizer.enable = mkEnableOption "Enable tmux-sessionizer";
|
||||
|
||||
config = mkIf config.homeManagerModules.tmux-sessionizer.enable {
|
||||
home.packages = with pkgs; [ tmux-sessionizer ];
|
||||
|
||||
home.file."${config.xdg.configHome}/tmux-sessionizer/default".source = "${
|
||||
pkgs.writeShellApplication {
|
||||
name = ".tmux-sessionizer";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
tmux
|
||||
];
|
||||
|
||||
text = ''
|
||||
set +o errexit
|
||||
set +o nounset
|
||||
|
||||
if [[ "$PWD" == "$XDG_REPOS_DIR/os" || "$PWD" == "$XDG_REPOS_DIR/personal" ]]; then
|
||||
clear
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new-window -d -n scratch
|
||||
nvim .
|
||||
clear
|
||||
'';
|
||||
}
|
||||
}/bin/.tmux-sessionizer";
|
||||
};
|
||||
}
|
97
modules/home-manager/cli/tmux.nix
Normal file
97
modules/home-manager/cli/tmux.nix
Normal file
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
inherit (pkgs) tmuxPlugins;
|
||||
in
|
||||
{
|
||||
options.homeManagerModules.tmux.enable = mkEnableOption "Enable tmux";
|
||||
|
||||
config = mkIf config.homeManagerModules.tmux.enable {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
|
||||
terminal = "tmux-256color";
|
||||
|
||||
extraConfig = ''
|
||||
set-option -g status-keys "vi"
|
||||
set-option -sa terminal-features "''${TERM}:RGB"
|
||||
|
||||
bind -n S-Left resize-pane -L 2
|
||||
bind -n S-Right resize-pane -R 2
|
||||
bind -n S-Down resize-pane -D 1
|
||||
bind -n S-Up resize-pane -U 1
|
||||
|
||||
bind -n C-Left resize-pane -L 10
|
||||
bind -n C-Right resize-pane -R 10
|
||||
bind -n C-Down resize-pane -D 5
|
||||
bind -n C-Up resize-pane -U 5
|
||||
|
||||
# Status line customisation
|
||||
set-option -g status-left ""
|
||||
set-option -g status-right " #{session_name}"
|
||||
set-option -g status-right-length 100
|
||||
set-option -g status-style "fg=#7C7D83 bg=default"
|
||||
set-option -g window-status-activity-style none
|
||||
set-option -g window-status-current-style "fg=#E9E9EA"
|
||||
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
|
||||
set -g base-index 1
|
||||
set -g pane-base-index 1
|
||||
set -g renumber-windows on
|
||||
|
||||
# Break a pane into a new window.
|
||||
bind-key b break-pane -d
|
||||
bind-key J command-prompt -p "join pane from: " "join-pane -h -s '%%'"
|
||||
|
||||
bind-key C-j choose-tree
|
||||
|
||||
set-window-option -g mode-keys vi
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||
|
||||
bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
|
||||
|
||||
bind-key K run-shell 'tmux switch-client -n \; kill-session -t "$(tmux display-message -p "#S")" || tmux kill-session'
|
||||
|
||||
# Allow clearing screen with ctrl-l by using <prefix> C-l
|
||||
bind C-l send-keys "C-l"
|
||||
bind C-k send-keys "C-k"
|
||||
|
||||
# Enable mouse support.
|
||||
setw -g mouse on
|
||||
|
||||
# Remove delay when switching Vim modes.
|
||||
set -sg escape-time 0
|
||||
|
||||
set-option -g pane-active-border-style "fg=#1f2335"
|
||||
set-option -g pane-border-style "fg=#1f2335"
|
||||
|
||||
# Vim-like pane navigation.
|
||||
bind ^ last-window
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
bind-key -r f run-shell "tmux new-window tmux-sessionizer"
|
||||
|
||||
bind-key -r D new-window -c "#{pane_current_path}" "[[ -e TODO.md ]] && nvim TODO.md || nvim ~/Documents/wiki/todo.txt"
|
||||
bind-key -r N new-window "notes"
|
||||
bind-key -r W split-window -h -c ~/Documents/wiki "nvim '+Telescope find_files'"
|
||||
'';
|
||||
|
||||
plugins = [
|
||||
tmuxPlugins.vim-tmux-navigator
|
||||
tmuxPlugins.yank
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
92
modules/home-manager/cli/zsh.nix
Normal file
92
modules/home-manager/cli/zsh.nix
Normal file
|
@ -0,0 +1,92 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
zsh-abbr = {
|
||||
enable = true;
|
||||
|
||||
abbreviations = import ./zsh/abbreviations.nix;
|
||||
};
|
||||
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
shellAliases = (import ./zsh/aliases.nix { inherit config; });
|
||||
|
||||
localVariables = {
|
||||
ABBR_SET_EXPANSION_CURSOR = 1;
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
if [[ -z "$DISPLAY" ]] && [[ "$(tty)" == "/dev/tty1" ]]; then
|
||||
exec startx &>/dev/null
|
||||
fi
|
||||
|
||||
# suffix
|
||||
alias -s gz="tar -tf"
|
||||
alias -s {html,HTML}="background firefox"
|
||||
alias -s {jpg,JPG,png,PNG}="background okular"
|
||||
alias -s {pdf,PDF}="background okular"
|
||||
alias -s {zip,ZIP}="unzip -l"
|
||||
|
||||
git() {
|
||||
case "$1" in
|
||||
clone)
|
||||
shift
|
||||
|
||||
local repo_url="$1"
|
||||
local repo_path="''${2:-}"
|
||||
|
||||
if [ -n "$TARGET_DIR" ]; then
|
||||
command git clone "$repo_url" "$repo_path"
|
||||
else
|
||||
command git clone "$repo_url"
|
||||
repo_path=$(basename "$repo_url" .git)
|
||||
fi
|
||||
|
||||
${pkgs.tmux-sessionizer}/bin/tmux-sessionizer "$repo_path"
|
||||
;;
|
||||
|
||||
root)
|
||||
shift
|
||||
|
||||
local ROOT="$(${pkgs.git}/bin/git rev-parse --show-toplevel 2> /dev/null || echo -n .)"
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
cd "''${ROOT}"
|
||||
else
|
||||
(cd "''${ROOT}" && eval "''${@}")
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
${pkgs.git}/bin/git "''${@}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
mbsync() {
|
||||
${pkgs.isync}/bin/mbsync --config "${config.xdg.configHome}/isync/mbsyncrc" "''${@}"
|
||||
}
|
||||
|
||||
ttyper() {
|
||||
command ${pkgs.ttyper}/bin/ttyper --language english1000 --words 50 "''${@}"
|
||||
}
|
||||
|
||||
yt-dlp() {
|
||||
command yt-dlp --paths ~/Videos "$@"
|
||||
}
|
||||
|
||||
bindkey -s ^f "tmux-sessionizer\n"
|
||||
bindkey -s ^v "nvim\n"
|
||||
|
||||
setopt auto_cd
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
||||
'';
|
||||
};
|
||||
}
|
151
modules/home-manager/cli/zsh/abbreviations.nix
Normal file
151
modules/home-manager/cli/zsh/abbreviations.nix
Normal file
|
@ -0,0 +1,151 @@
|
|||
{
|
||||
cl = "clear";
|
||||
cs = "create-script";
|
||||
daily = "run create-daily next";
|
||||
rst = "rst2pdf";
|
||||
st = "source .tmux";
|
||||
sz = "source ~/.config/zsh/.zshrc";
|
||||
ti = "timer";
|
||||
uagr = "update-all-git-repos";
|
||||
v = "nvim";
|
||||
yt = "yt-dlp";
|
||||
|
||||
evl = "export-video-list";
|
||||
vv = "cat ~/Documents/videos.json";
|
||||
|
||||
g = "git";
|
||||
ga = "git add";
|
||||
gan = "git add -N";
|
||||
gap = "git add -p";
|
||||
gb = "git branch";
|
||||
gbl = "git blame";
|
||||
gc = "git commit";
|
||||
gca = "git commit --amend";
|
||||
gcan = "git commit --amend --no-edit";
|
||||
gcl = "git clone";
|
||||
gcm = "git commit -m";
|
||||
gco = "git checkout";
|
||||
gcob = "git checkout -b";
|
||||
gd = "git diff";
|
||||
gds = "git diff --staged";
|
||||
gf = "git fetch";
|
||||
gfa = "git fetch --all";
|
||||
gl = "git log";
|
||||
glo = "git log --oneline";
|
||||
gls = "git log --stat";
|
||||
gm = "git merge";
|
||||
gmf = "git merge --ff";
|
||||
gmnf = "git merge --no-ff";
|
||||
gp = "git push";
|
||||
gpa = "git push acquia";
|
||||
gpam = "git push acquia main";
|
||||
gpap = "git push acquia HEAD:production";
|
||||
gpl = "git pull";
|
||||
gplr = "git pull --rebase";
|
||||
gpo = "git push origin";
|
||||
gpom = "git push origin main";
|
||||
gr = "git rebase";
|
||||
gra = "git rebase --abort";
|
||||
grc = "git rebase --continue";
|
||||
gri = "git rebase -i";
|
||||
gs = "git status";
|
||||
gsh = "git show";
|
||||
gst = "git stash";
|
||||
gstp = "git stash pop";
|
||||
|
||||
# tmux
|
||||
ta = "tmux attach";
|
||||
tl = "tmux list-sessions";
|
||||
tk = "tmux kill-session";
|
||||
|
||||
# Docker and Docker Compose.
|
||||
dk = "docker";
|
||||
dkp = "docker ps";
|
||||
dkpa = "docker ps -a";
|
||||
dkpaq = "docker ps -a -q";
|
||||
dkb = "docker build -t";
|
||||
dks = "docker start";
|
||||
dkt = "docker stop";
|
||||
dkrm = "docker rm";
|
||||
dkri = "docker rmi";
|
||||
dke = "docker exec -ti";
|
||||
dkl = "docker logs -f";
|
||||
dki = "docker images";
|
||||
dkpu = "docker pull";
|
||||
dkph = "docker push";
|
||||
dkbnc = "docker build --no-cache -t";
|
||||
dkr = "docker run --rm";
|
||||
dkrti = "docker run --rm -ti";
|
||||
dkc = "docker compose";
|
||||
dkcb = "docker compose build";
|
||||
dkcu = "docker compose up";
|
||||
dkclean = "docker ps -q -a -f status=exited | xargs -r docker rm && docker images -q -f dangling=true | xargs -r docker rmi";
|
||||
|
||||
# Nix and direnv.
|
||||
dea = "direnv allow";
|
||||
dee = "direnv edit";
|
||||
nxf = "nix flake";
|
||||
nxfc = "nix flake check";
|
||||
nxfs = "nix flake show";
|
||||
nxfu = "nix flake update";
|
||||
nxr = "nix run nixpkgs#%";
|
||||
nxs = "nix shell nixpkgs#%";
|
||||
|
||||
# run scripts.
|
||||
r = "run";
|
||||
rc = "run composer";
|
||||
rcda = "run composer dump-autoload";
|
||||
rci = "run composer install";
|
||||
rcr = "run composer require";
|
||||
rcu = "run composer update";
|
||||
rd = "run drush";
|
||||
rdce = "run drush config:export -y";
|
||||
rdci = "run drush config:import -y";
|
||||
rdcr = "run drush cache:rebuild";
|
||||
rdscr = "run drush php:script";
|
||||
rduli = "run drush uli";
|
||||
rdup = "run drush updatedb -y";
|
||||
rpub = "run publish";
|
||||
rt = "run test";
|
||||
|
||||
"-g A1" = "| awk '{print $1}'";
|
||||
"-g C" = "| xclip -sel clip";
|
||||
"-g Fj" = "| jq .";
|
||||
"-g Fy" = "| yq .";
|
||||
"-g G" = "| grep";
|
||||
"-g GH" = "| grep HTTP";
|
||||
"-g Gi" = "| grep -i";
|
||||
"-g H2" = "| head -n 20";
|
||||
"-g H" = "| head";
|
||||
"-g L" = "| less";
|
||||
"-g V" = "| nvim -";
|
||||
"-g X" = "| xargs -I1";
|
||||
|
||||
nah = "git reset --hard; git clean -fd";
|
||||
wip = "git commit -m wip";
|
||||
|
||||
dv = "devenv";
|
||||
dvi = "devenv info";
|
||||
dvp = "devenv processes";
|
||||
dvs = "devenv shell";
|
||||
dvt = "devenv tasks";
|
||||
dvu = "devenv up";
|
||||
|
||||
c = "composer";
|
||||
cr = "composer require";
|
||||
crd = "composer require drupal/%";
|
||||
cu = "composer update";
|
||||
cul = "composer update --lock";
|
||||
cw = "composer why";
|
||||
cwn = "composer why-not";
|
||||
|
||||
d = "drush";
|
||||
dce = "drush config:export -y";
|
||||
dci = "drush config:import -y";
|
||||
dcr = "drush cache:rebuild";
|
||||
den = "drush pm:enable -y";
|
||||
deu = "drush pm:uninstall";
|
||||
dscr = "drush php:script";
|
||||
duli = "drush uli";
|
||||
dup = "drush updatedb -y";
|
||||
}
|
15
modules/home-manager/cli/zsh/aliases.nix
Normal file
15
modules/home-manager/cli/zsh/aliases.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
"$" = "";
|
||||
"-" = "cd -";
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
"...." = "cd ../../..";
|
||||
"....." = "cd ../../../..";
|
||||
s = "secrets";
|
||||
secrets = ''doppler --project "$(whoami)" run'';
|
||||
tag = "tag-release";
|
||||
vss = "LC_ALL=C sort --unique ${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/dotfiles/nvim/spell/en.utf-8.add --output ${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/dotfiles/nvim/spell/en.utf-8.add";
|
||||
wt = "git worktree";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue