Compare commits

...

9 Commits

Author SHA1 Message Date
56541bae23 nvim: update custom theme and generic config 2025-01-28 17:23:00 +08:00
2c5586fbfd nu: update fzf integration 2025-01-28 17:22:27 +08:00
0ee4d7df89 wezterm: modularize events in apply config step 2025-01-28 17:15:08 +08:00
04e1a9d0b2 nvim: update lazy.nvim lockfile 2025-01-28 17:14:21 +08:00
68cfd827b4 nvim: update plugins config 2025-01-28 17:13:49 +08:00
644960c802 Makefile: add dry-run step 2025-01-24 13:40:46 +08:00
500647c9c1 nvim: update plugin set 2025-01-24 13:38:47 +08:00
9854576ddc flake.lock: update inputs
Flake lock file updates:

• Updated input 'flake-utils':
    'github:numtide/flake-utils/4022d587cbbfd70fe950c1e2083a02621806a725?narHash=sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8%3D' (2023-12-04)
  → 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b?narHash=sha256-l0KFg5HjrsfsO/JpG%2Br7fRrqm12kzFHyUHqHCVpMMbI%3D' (2024-11-13)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/63143ac2c9186be6d9da6035fa22620018c85932?narHash=sha256-QGua89Pmq%2BFBAro8NriTuoO/wNaUtugt29/qqA8zeeM%3D' (2024-01-02)
  → 'github:NixOS/nixpkgs/5757bbb8bd7c0630a0cc4bb19c47e588db30b97c?narHash=sha256-3wFonKmNRWKq1himW9N3TllbeGIHFACI5vmLpk6moF8%3D' (2025-01-22)
2025-01-23 13:02:54 +08:00
fe80d72a54 tridactyl: init rc file
This is actually just from my NixOS configuration, just transferred over
here since it is becoming more common to install Firefox and Tridactyl
together.
2025-01-23 12:57:39 +08:00
17 changed files with 634 additions and 80 deletions

View File

@ -16,3 +16,7 @@ clean:
.PHONY: update
update:
nix flake update --commit-lock-file --commit-lockfile-summary "flake.lock: update inputs"
.PHONY: dry-run
dry-run:
./vtsm --manifest ".vtsm/${MANIFEST}.json" --commands "stow --stow {package} --target {location} --simulate"

12
flake.lock generated
View File

@ -5,11 +5,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1704161960,
"narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
"lastModified": 1737525964,
"narHash": "sha256-3wFonKmNRWKq1himW9N3TllbeGIHFACI5vmLpk6moF8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63143ac2c9186be6d9da6035fa22620018c85932",
"rev": "5757bbb8bd7c0630a0cc4bb19c47e588db30b97c",
"type": "github"
},
"original": {

View File

@ -9,13 +9,22 @@
# used in considering for opening inside of tmux env.
# - FZF_CTRL_T_COMMAND is the default command for Ctrl+T keybinding set for
# this Nu script.
# - FZF_DEFAULT_OPTS is a string
# - FZF_DEFAULT_OPTS contains default arguments to be passed to fzf when
# executing.
# - FZF_ALT_C_COMMAND contains the executable and its arguments used for
# entering directories (with Alt+C keybinding).
let __fzf_defaults = [
--height ($env.FZF_TMUX_HEIGHT? | default "40%")
--bind=ctrl-z:ignore
--reverse
]
let envconvert_cmdstring = {
from_string: { |s| $s | split row ' ' }
to_string: { |s| $s | str join ' ' }
}
def __fzf_select [...flags: string] {
with-env {
FZF_CTRL_T_COMMAND: ($env.FZF_CTRL_T_COMMAND? | default "fzf")
@ -27,10 +36,14 @@ def __fzf_select [...flags: string] {
def __fzf_cd [...flags: string] {
with-env {
FZF_CTRL_T_COMMAND: ($env.FZF_CTRL_T_COMMAND? | default "fzf")
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS? | default $__fzf_defaults)
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS | default $__fzf_defaults)
} {
fzf ...$env.FZF_DEFAULT_OPTS --reverse --walker=dir,hidden,follow ...$flags
if "FZF_ALT_C_COMMAND" in $env {
let command = $env.FZF_ALT_C_COMMAND
run-external ($command | get 0) ...($command | range 1..) | fzf ...$env.FZF_DEFAULT_OPTS ...$flags
} else {
fzf ...$env.FZF_DEFAULT_OPTS --walker=dir,hidden,follow ...$flags
}
}
}
@ -50,6 +63,21 @@ $env.config.keybindings = $env.config.keybindings | append [
}
}
{
name: fzf_parent_select
modifier: alt
keycode: char_t
mode: [emacs vi_normal vi_insert]
event: {
send: ExecuteHostCommand
cmd: "commandline edit --insert (
__fzf_select '--multi' '--walker-root=../'
| lines
| str join ' '
)"
}
}
{
name: fzf_cd
modifier: alt
@ -61,3 +89,10 @@ $env.config.keybindings = $env.config.keybindings | append [
}
}
]
$env.ENV_CONVERSIONS = $env.ENV_CONVERSIONS | merge deep --strategy=append {
FZF_CTRL_T_COMMAND: $envconvert_cmdstring
FZF_ALT_C_COMMAND: $envconvert_cmdstring
FZF_DEFAULT_OPTS: $envconvert_cmdstring
FZF_DEFAULT_COMMAND: $envconvert_cmdstring
}

View File

@ -3,7 +3,7 @@
-- Bootstrapping for the package manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
local out = vim.fn.system({
"git",
"clone",
"--filter=blob:none",
@ -11,6 +11,15 @@ if not vim.loop.fs_stat(lazypath) then
"--branch=stable", -- latest stable release
lazypath,
})
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)

View File

@ -12,18 +12,27 @@
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" },
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
"lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"lush.nvim": { "branch": "main", "commit": "45a79ec4acb5af783a6a29673a999ce37f00497e" },
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
"neorg": { "branch": "main", "commit": "ed43ed58116caa0a17bbbc7aa663e32bf94bc531" },
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" },
"nvim-lspconfig": { "branch": "master", "commit": "14b5a806c928390fac9ff4a5630d20eb902afad8" },
"nvim-treesitter": { "branch": "master", "commit": "4423f3053964461656c7432fd33f205ef88a6168" },
"nvim-dap": { "branch": "master", "commit": "ead0de6eac91a555b714bfd7d28959eeecfb96f9" },
"nvim-lspconfig": { "branch": "master", "commit": "1f941b3668151963fca3e1230922c433ea4b7b64" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "043d5fb1505ca4bc0f48b42666ae7ebc4bb1a671" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"nvim-web-devicons": { "branch": "master", "commit": "1c9136332840edee0c593f2f4f89598c8ed97f5f" },
"oil.nvim": { "branch": "master", "commit": "add50252b5e9147c0a09d36480d418c7e2737472" },
"pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"snacks.nvim": { "branch": "main", "commit": "b72364f916905bbb355d5105d364e96de118766d" },
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" },
"vim-airline": { "branch": "master", "commit": "7a552f415c48aed33bf7eaa3c50e78504d417913" },
"vim-gitgutter": { "branch": "main", "commit": "7b0b5098e3e57be86bb96cfbf2b8902381eef57c" },
"vim-nix": { "branch": "master", "commit": "e25cd0f2e5922f1f4d3cd969f92e35a9a327ffb0" },
"vimspector": { "branch": "master", "commit": "5e24df822e278ee79abfc8c7110089a5322d1a3c" },
"which-key.nvim": { "branch": "main", "commit": "6cebd86917df559a88de0f806b2989799c6e6423" },
"zig.vim": { "branch": "master", "commit": "f023e86b042c0d5bef68b9f0651144a6bf6d642e" }
}

View File

@ -394,5 +394,9 @@ return lush(function()
-- Indent-Blank-Lines
IndentGuide({ fg = base01, bg = base05 }),
-- snacks.nvim
SnacksIndentScope({ fg = base0C, gui = "bold" }),
SnacksIndentChunk({ fg = base0C, gui = "bold" }),
}
end)

View File

@ -13,8 +13,50 @@ return {
end,
},
-- More useful status bar
"vim-airline/vim-airline",
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
icons_enabled = true,
always_divide_middle = true,
globalstatus = true,
-- Disable the section separators.
section_separators = {
left = "",
right = "",
},
sections = {
lualine_a = { "mode" },
lualine_c = {
{
"filename",
newline_status = true,
shorting_target = 10,
path = 1,
},
},
lualine_z = { "location" },
},
},
},
-- Remember your keys.
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
},
-- Colorize common color strings
{

View File

@ -108,7 +108,7 @@ return {
"clangd",
"rust_analyzer",
"pyright",
"tsserver",
"ts_ls",
"nixd",
"lua_ls",
"rubocop",

View File

@ -5,11 +5,19 @@ return {
depedencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-project.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
module = true,
config = function()
local telescope = require("telescope")
telescope.setup({
defaults = {
layout_config = {
height = 0.95,
width = 0.9,
anchor_padding = 0,
},
},
extensions = {
project = {
base_dirs = {
@ -18,6 +26,7 @@ return {
{ "~/library/writings" },
},
},
fzf = { },
},
})
@ -30,25 +39,28 @@ return {
end
end
vim.keymap.set("n", "<leader>ff", get_builtin("find_files", { hidden = true }), opts)
vim.keymap.set("n", "<leader>ff", get_builtin("find_files", { hidden = true, preview = false }), {
noremap = true,
desc = "Find files in project",
})
vim.keymap.set("n", "<leader>fF", function()
builtins.find_files({
cwd = require("telescope.utils").buffer_dir(),
hidden = true,
preview = false,
})
end, opts)
end, { noremap = true, desc = "Find files in current directory" })
vim.keymap.set("n", "<leader>fg", get_builtin("grep_string"), opts)
vim.keymap.set("n", "<leader>fG", get_builtin("live_grep"), opts)
vim.keymap.set("n", "<leader>fb", get_builtin("buffers"), opts)
vim.keymap.set("n", "<leader>fh", get_builtin("help_tags"), opts)
vim.keymap.set("n", "<leader>ft", get_builtin("treesitter"), opts)
vim.keymap.set("n", "<leader>fb", get_builtin("buffers"), opts)
vim.keymap.set("n", "<leader>fM", get_builtin("man_pages"), opts)
vim.keymap.set("n", "<leader>fg", get_builtin("grep_string"), { noremap = true, desc = "Grep for string in cursor" })
vim.keymap.set("n", "<leader>fG", get_builtin("live_grep"), { noremap = true, desc = "Grep for string in project" })
vim.keymap.set("n", "<leader>fb", get_builtin("buffers"), { noremap = true, desc = "Search currently opened buffers" })
vim.keymap.set("n", "<leader>fh", get_builtin("help_tags"), { noremap = true, desc = "Search help pages" })
vim.keymap.set("n", "<leader>ft", get_builtin("treesitter"), { noremap = true, desc = "Search treesitter objects" })
vim.keymap.set("n", "<leader>fM", get_builtin("man_pages"), { noremap = true, desc = "Search manpages" })
vim.keymap.set("n", "<leader>fS", get_builtin("spell_suggest"), { noremap = true, desc = "Pick spell suggestions" })
vim.keymap.set("n", "<leader>fA", get_builtin("resume"), opts)
vim.keymap.set("n", "<leader>fA", get_builtin("resume"), { noremap = true, desc = "Return last search" })
-- Ekeymap.set
vim.keymap.set("n", "<leader>fp", [[<cmd>lua require("telescope").extensions.project.project({})<cr>]], opts)
end,
},
@ -57,7 +69,7 @@ return {
{
"ThePrimeagen/harpoon",
config = function()
vim.keymap.set("n", "<leader>fm", "<cmd>lua require('harpoon.mark').add_file()<cr>", {})
vim.keymap.set("n", "<leader>fm", "<cmd>lua require('harpoon.mark').add_file()<cr>", { desc = "Add mark to file" })
local has_telescope, telescope = pcall("telescope")
if has_telescope then

View File

@ -0,0 +1,39 @@
local function get_note(subfolder)
return vim.fn.expand("~/Documents/Notes/") .. subfolder
end
return {
{
"nvim-neorg/neorg",
lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default
version = "*", -- Pin Neorg to the latest stable release
config = true,
opts = {
load = {
["core.defaults"] = {},
["core.concealer"] = {},
["core.completion"] = {
config = {
engine = "nvim-cmp",
},
},
["core.journal"] = {
config = {
strategy = "flat",
},
},
["core.summary"] = {},
["core.ui.calendar"] = {},
["core.dirman"] = {
config = {
workspaces = {
personal = get_note("Personal"),
work = get_note("Work"),
wiki = get_note("Wiki"),
},
},
},
},
},
}
}

92
nvim/lua/plugins/qol.lua Normal file
View File

@ -0,0 +1,92 @@
return {
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
indent = {
enabled = true,
char = "",
scope = {
underline = true,
},
chunk = {
enabled = true,
},
},
input = { enabled = true },
notifier = { enabled = true },
git = { enabled = true, },
lazygit = {
enabled = vim.fn.executable("lazygit") == 1,
},
quickfile = { enabled = true },
rename = { enabled = true },
scope = { enabled = true },
statuscolumn = { enabled = true },
toggle = {
enabled = true,
which_key = pcall(require, "which-key"),
},
words = { enabled = true },
},
keys = {
{ "<leader>gb", function() Snacks.git.blame_line() end, desc = "Open blame lines for current file" },
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Open lazygit" },
{ "<leader>gf", function() Snacks.lazygit.log_file() end, desc = "Open current file history in lazygit" },
},
init = function()
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
callback = function()
-- Setup some globals for debugging (lazy-loaded)
_G.dd = function(...)
Snacks.debug.inspect(...)
end
_G.bt = function()
Snacks.debug.backtrace()
end
vim.print = _G.dd -- Override print to use snacks for `:=` command
-- Create some toggle mappings
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us")
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
Snacks.toggle.option("relativenumber", { name = "Relative number" }):map("<leader>uL")
Snacks.toggle.diagnostics():map("<leader>ud")
Snacks.toggle.line_number():map("<leader>ul")
Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("<leader>uc")
Snacks.toggle.treesitter():map("<leader>uT")
Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark style" }):map("<leader>ub")
Snacks.toggle.inlay_hints():map("<leader>uh")
Snacks.toggle.indent():map("<leader>ug")
Snacks.toggle.dim():map("<leader>uD")
end,
})
end,
},
{
"stevearc/oil.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
"nvim-telescope/telescope.nvim",
},
opts = {
default_file_explorer = true,
columns = { "icon", "permissions" },
view_options = {
hidden = true,
},
},
keys = {
{ "-", "<cmd>Oil<CR>", { desc = "Open parent directory in file explorer" } },
{ "<C-->", function () require("oil").open(vim.fn.getcwd()) end, { desc = "Open current working directory in file explorer" } },
},
},
}

View File

@ -28,22 +28,128 @@ return {
indent = { enable = true },
-- custom text objects with nvim-treesitter-textobjects
-- I've just copied this from the README but they are reasonable additions to me.
highlight_current_scope = { enable = false },
highlight_definitions = { clear_on_cursor_move = true, enable = true },
navigation = {
enable = true,
keymaps = {
goto_definition = "gnd",
goto_next_usage = "<a-*>",
goto_previous_usage = "<a-#>",
list_definitions = "gnD",
list_definitions_toc = "gO",
},
},
smart_rename = { enable = true, keymaps = { smart_rename = "grr" } },
textobjects = {
lsp_interop = {
border = "none",
enable = true,
peek_definition_code = {
["<leader>dF"] = { desc = "Peek definition of class", query = "@class.outer" },
["<leader>df"] = { desc = "Peek definition of function", query = "@function.outer" },
},
},
move = {
enable = true,
goto_next_end = {
["]]b"] = { desc = "Jump to inner part of the next block", query = "@block.inner" },
["]]c"] = { desc = "Jump to inner part of the next class", query = "@class.inner" },
["]]d"] = { desc = "Jump to inner part of the next conditional", query = "@conditional.inner" },
["]]f"] = { desc = "Jump to inner part of the next call", query = "@call.inner" },
["]]l"] = { desc = "Jump to inner part of the next loop", query = "@loop.inner" },
["]]m"] = { desc = "Jump to inner part of the next function", query = "@function.inner" },
["]]s"] = { desc = "Jump to inner part of the next statement", query = "@statement.inner" },
["]b"] = { desc = "Jump to next block", query = "@block.outer" },
["]c"] = { desc = "Jump to next class", query = "@class.outer" },
["]d"] = { desc = "Jump to next conditional", query = "@conditional.outer" },
["]f"] = { desc = "Jump to next call", query = "@call.outer" },
["]l"] = { desc = "Jump to next loop", query = "@loop.outer" },
["]m"] = { desc = "Jump to next function", query = "@function.outer" },
["]s"] = { desc = "Jump to next statement", query = "@statement.outer" },
},
goto_next_start = {
["]]b"] = { desc = "Jump to inner part of the next block", query = "@block.inner" },
["]]c"] = { desc = "Jump to inner part of the next class", query = "@class.inner" },
["]]d"] = { desc = "Jump to inner part of the next conditional", query = "@conditional.inner" },
["]]f"] = { desc = "Jump to inner part of the next call", query = "@call.inner" },
["]]l"] = { desc = "Jump to inner part of the next loop", query = "@loop.inner" },
["]]m"] = { desc = "Jump to inner part of the next function", query = "@function.inner" },
["]]s"] = { desc = "Jump to inner part of the next statement", query = "@statement.inner" },
["]b"] = { desc = "Jump to next block", query = "@block.outer" },
["]c"] = { desc = "Jump to next class", query = "@class.outer" },
["]d"] = { desc = "Jump to next conditional", query = "@conditional.outer" },
["]f"] = { desc = "Jump to next call", query = "@call.outer" },
["]l"] = { desc = "Jump to next loop", query = "@loop.outer" },
["]m"] = { desc = "Jump to next function", query = "@function.outer" },
["]s"] = { desc = "Jump to next statement", query = "@statement.outer" },
},
goto_previous_end = {
["[B"] = { desc = "Jump to previous block", query = "@block.outer" },
["[C"] = { desc = "Jump to previous class", query = "@class.outer" },
["[D"] = { desc = "Jump to previous conditional", query = "@conditional.outer" },
["[F"] = { desc = "Jump to previous call", query = "@call.outer" },
["[L"] = { desc = "Jump to previous loop", query = "@loop.outer" },
["[M"] = { desc = "Jump to previous function", query = "@function.outer" },
["[S"] = { desc = "Jump to previous statement", query = "@statement.outer" },
["[[B"] = { desc = "Jump to inner part of the previous block", query = "@block.inner" },
["[[C"] = { desc = "Jump to inner part of the previous class", query = "@class.inner" },
["[[D"] = { desc = "Jump to inner part of the previous conditional", query = "@conditional.inner" },
["[[F"] = { desc = "Jump to inner part of the previous call", query = "@call.inner" },
["[[L"] = { desc = "Jump to inner part of the previous loop", query = "@loop.inner" },
["[[M"] = { desc = "Jump to inner part of the previous function", query = "@function.inner" },
["[[S"] = { desc = "Jump to inner part of the previous statement", query = "@statement.inner" },
},
goto_previous_start = {
["[B"] = { desc = "Jump to previous block", query = "@block.outer" },
["[C"] = { desc = "Jump to previous class", query = "@class.outer" },
["[D"] = { desc = "Jump to previous conditional", query = "@conditional.outer" },
["[F"] = { desc = "Jump to previous call", query = "@call.outer" },
["[L"] = { desc = "Jump to previous loop", query = "@loop.outer" },
["[M"] = { desc = "Jump to previous function", query = "@function.outer" },
["[S"] = { desc = "Jump to previous statement", query = "@statement.outer" },
["[[B"] = { desc = "Jump to inner part of the previous block", query = "@block.inner" },
["[[C"] = { desc = "Jump to inner part of the previous class", query = "@class.inner" },
["[[D"] = { desc = "Jump to inner part of the previous conditional", query = "@conditional.inner" },
["[[F"] = { desc = "Jump to inner part of the previous call", query = "@call.inner" },
["[[L"] = { desc = "Jump to inner part of the previous loop", query = "@loop.inner" },
["[[M"] = { desc = "Jump to inner part of the previous function", query = "@function.inner" },
["[[S"] = { desc = "Jump to inner part of the previous statement", query = "@statement.inner" },
},
set_jumps = true,
},
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ae"] = "@block.outer",
["ie"] = "@block.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["aC"] = "@conditional.outer",
["iC"] = "@conditional.inner",
aa = { desc = "Select around the attribute region", query = "@attribute.outer" },
ab = { desc = "Select around the block region", query = "@block.outer" },
ac = { desc = "Select around the class region", query = "@class.outer" },
af = { desc = "Select around the call region", query = "@call.outer" },
al = { desc = "Select around the loop region", query = "@loop.outer" },
am = { desc = "Select around the function region", query = "@function.outer" },
as = { desc = "Select around the statement region", query = "@statement.outer" },
ia = { desc = "Select inner part of the attribute region", query = "@attribute.inner" },
ib = { desc = "Select inner part of the block region", query = "@block.inner" },
ic = { desc = "Select inner part of the class region", query = "@class.inner" },
["if"] = { desc = "Select inner part of the call region", query = "@call.inner" },
il = { desc = "Select inner part of the loop region", query = "@loop.inner" },
im = { desc = "Select inner part of the function region", query = "@function.inner" },
is = { desc = "Select inner part of the statement region", query = "@statement.inner" },
},
lookahead = true,
selection_modes = { ["@block.outer"] = "<c-v>", ["@class.outer"] = "<c-v>", ["@function.outer"] = "V" },
},
swap = {
enable = true,
swap_next = {
["<leader>sa"] = { desc = "Jump to next parameter", query = "@parameter.outer" },
["<leader>sd"] = { desc = "Jump to next conditional", query = "@conditional.outer" },
["<leader>sf"] = { desc = "Jump to next function", query = "@function.outer" },
},
swap_previous = {
["<leader>SA"] = { desc = "Jump to previous parameter", query = "@parameter.outer" },
["<leader>SD"] = { desc = "Jump to previous conditional", query = "@conditional.outer" },
["<leader>SF"] = { desc = "Jump to previous function", query = "@function.outer" },
},
},
},

View File

@ -17,7 +17,7 @@ function module.setup()
vim.opt.tabstop = 4
vim.opt.conceallevel = 1
vim.opt.list = true
vim.opt.listchars = { tab = " ", trail = "·" }
vim.opt.listchars = { tab = "", trail = "·" }
vim.opt_local.spell = true
vim.opt.smartindent = true
@ -28,10 +28,13 @@ function module.setup()
vim.cmd("highlight clear SpellRare")
vim.cmd("highlight Visual term=reverse cterm=reverse")
-- Keybindings
-- Basic keybindings
vim.keymap.set("n", "<leader>bd", ":bd<cr>", {})
vim.keymap.set("i", "jk", "<Esc>", {})
vim.keymap.set("i", "jk", "<Esc>", { desc = "Escape" })
vim.keymap.set("n", "<leader>hr", "<cmd>source $MYVIMRC<cr>", {})
vim.keymap.set("n", "<leader>x", ":.lua<CR>", { desc = "Execute Lua under cursor" })
vim.keymap.set("v", "<leader>x", ":lua<CR>", { desc = "Execute Lua under cursor" })
end
return module

192
tridactyl/tridactylrc Normal file
View File

@ -0,0 +1,192 @@
" This enforces Tridactyl to only have this file as the source of truth.
" Also the first time you open Firefox with this Tridactyl configuration, you
" might want to restart immediately since the autocontainers are not in
" effect.
sanitise tridactyllocal tridactylsync
" Tridactyl settings.
set viewsource default
set auconcreatecontainer true
" This is giving me the most trouble since I use multiple extensions that
" makes use of contextual identities like Facebook and Google containers. If
" this is in strict mode, it'll result in Tridactyl and the other container
" extensions fighting for the control of the tab and infinitely reloading the
" tab. Not the greatest experience.
set autocontainmode relaxed
set minincsearchlen 4
" Disable update checks entirely. We're going to rely on the distro's
" packaging (or on nixpkgs entirely) to install the native messenger.
set update.nag false
set update.nativeinstallcmd echo
" Additional and modified keybindings.
bind yt tabduplicate
bind yf hint -y
bind gK elementunhide
bind gR reader --tab
" Make it closer to Vim, I guess since we're going to use closer functions
" with the `d` prefix.
unbind d
bind dd tabclose
unbind f
unbind F
bind ff hint
bind fF hint -t
bind fB hint -b
bind fI hint -I
bind fz hint -z
" Recontaining them nicefully.
bind qQ recontain Personal
bind qW recontain Work
bind qe recontain Banking
bind qE recontain Shopping
bind qC recontain Chat
bind qq recontain Cooking
" Sorting them nicefully.
bind qss tabsort --url
bind qsS tabsort --containers
bind qst tabsort --title
bind <C-Q> fillcmdline containerclose
bind dQ containerclose Personal
bind dW containerclose Work
bind de containerclose Banking
bind dE containerclose Shopping
bind dg containerclose Gaming
bind dC containerclose Chat
bind dc containerclose Cooking
" Assuming the Google and Facebook containers extensions are installed.
bind dF containerclose Facebook
bind dG containerclose Google
bind dA containerclose Amazon
bind dM containerclose Microsoft
" My default set of containers. Take note, we're assuming Facebook and Google
" containers extension is already installed and there's a reasonable set of
" default containers that are already configured for us.
containercreate Personal blue fingerprint
containercreate Self-hosted pink fingerprint
containercreate Work red briefcase
containercreate Banking green dollar
containercreate Shopping pink cart
containercreate Gaming turquoise chill
containercreate Chat blue chill
containercreate Cooking orange food
" Most of the MOOC are for personal purposes so it is in "Personal" container.
autocontain -s coursera\.org Personal
autocontain -s skillshare\.org Personal
autocontain -s edx\.org Personal
" Most of the news site I PERSONALLY visit are in "Personal" container, yes?
" Ideally, I should visit via web subscriptions in my Thunderbird thingy.
autocontain -s phoronix\.com Personal
autocontain -s omgubuntu\.co\.uk Personal
autocontain -s omglinux\.com Personal
autocontain -s lwn\.net Personal
" Ideally, this should be in Tangram or similar.
autocontain -s discourse\.nixos\.org Personal
autocontain -s discourse\.gohugo\.io Personal
autocontain -s .+\.github\.io Personal
autocontain -s .+\.gitlab\.io Personal
" My communication chat apps. Facebook Messenger should be in its own
" container.
autocontain -s discord\.com Chat
autocontain -s .+\.zulipchat\.com Chat
autocontain -s element\.io Chat
autocontain -s rocket\.chat Chat
autocontain -s revolt\.chat Chat
autocontain -s slack\.com Chat
autocontain -s telegram\.com Chat
" My self-hosted instances and my personal domain.
autocontain -s .+\.local Self-hosted
autocontain -s .+\.internal Self-hosted
autocontain -s .+\.theinternaltld Self-hosted
autocontain -s foodogsquared\.one Self-hosted
" Most software forges should be separated.
autocontain -s github\.com Work
autocontain -s gitlab\.com Work
autocontain -s archive\.softwareheritage\.com Work
autocontain -s sourcegraph\.com Work
autocontain -s app\.netlify\.com Work
autocontain -s hetzner\.com Work
autocontain -s digitalocean\.com Work
autocontain -s aws\.amazon\.com Work
autocontain -s mxroute\.com Work
autocontain -s mailbox\.org Work
autocontain -s cloud\.oracle\.com Work
autocontain -s tailscale\.com Work
autocontain -s cloudflare\.com Work
" So does most freelancing sites.
autocontain -s upwork\.com Work
autocontain -s monster\.com Work
autocontain -s foundit\.com(\.ph?) Work
autocontain -s fiverr\.com Work
autocontain -s (ph\.?)linkedin\.com Work
autocontain -s jobstreet\.com(\.ph?) Work
autocontain -s (ph\.?)jobstreet\.com(\.ph?) Work
autocontain -s vscode\.dev Work
" Shopping, shopping, shopping!
autocontain -s yelp\.com Shopping
autocontain -s shopee\.(com|ph) Shopping
autocontain -s lazada\.com(\.ph?) Shopping
autocontain -s amazon\.com Shopping
autocontain -s ebay\.com Shopping
autocontain -s foodpanda\.(com|ph) Shopping
autocontain -s carousell\.ph Shopping
autocontain -s slickdeals\.net Shopping
" What's a shopping spree without your wallet.
autocontain -s paypal\.com(\.ph?) Banking
autocontain -s unionbankph\.com Banking
autocontain -s bdo\.com\.ph Banking
autocontain -s bpi\.com\.ph Banking
autocontain -s gcash\.com Banking
autocontain -s paymaya\.com Banking
autocontain -s metamask\.io Banking
autocontain -s uphold\.com Banking
" Potato gaming.
autocontain -s gog\.com Gaming
autocontain -s epicgames\.com Gaming
autocontain -s steampowered\.com Gaming
autocontain -s gamejolt\.com Gaming
autocontain -s itch\.io Gaming
" My word games. THIS IS WHAT PURE UNADULTERATED GAMING LOOKS LIKE!
autocontain -s nytimes\.com/games Gaming
autocontain -s merriam-webster\.com/games Gaming
autocontain -s britannica\.com/games Gaming
autocontain -s wafflegame\.net Gaming
autocontain -s duotrigordle\.com Gaming
seturl nytimes\.com/games disable true
seturl merriam-webster\.com/games disable true
seturl britannica\.com/games disable true
" My cooking gotos.
autocontain -s lecremedelacrumb\.com Cooking
autocontain -s cookingclassy\.com Cooking
autocontain -s panlasangpinoy\.com Cooking
" Ignore all of the keybindings.
blacklistadd https://design.penpot.app
" vim: ft=vim

View File

@ -3,43 +3,51 @@ local wezterm = require("wezterm")
local io = require("io")
local os = require("os")
wezterm.on("update-right-status", function(window, _)
local key = window:active_key_table()
if key then
key = "TABLE: " .. key
end
window:set_right_status(key or "")
end)
function module.apply_to_config(config)
wezterm.on("update-right-status", function(window, _)
local key = window:active_key_table()
if key then
key = "TABLE: " .. key
end
window:set_right_status(key or "")
end)
wezterm.on("view-last-output-in-new-pane", function(_, pane)
local zones = pane:get_semantic_zones("Output")
local last_zone = zones[#zones - 1]
wezterm.on("view-last-output-in-new-pane", function(_, pane)
local zones = pane:get_semantic_zones("Output")
local last_zone = zones[#zones - 1]
if not last_zone then
return nil
end
if not last_zone then
return nil
end
local output = pane:get_text_from_semantic_zone(last_zone)
local output = pane:get_text_from_semantic_zone(last_zone)
local tmpname = os.tmpname()
local f = io.open(tmpname, "w+")
if f ~= nil then
f:write(output)
f:flush()
f:close()
end
local tmpname = os.tmpname()
local f = io.open(tmpname, "w+")
if f ~= nil then
f:write(output)
f:flush()
f:close()
end
pane:split({
args = { os.getenv("PAGER") or "less", tmpname },
direction = "Bottom",
domain = { DomainName = "local" },
})
pane:split({
args = { os.getenv("PAGER") or "less", tmpname },
direction = "Bottom",
domain = { DomainName = "local" },
})
-- Without this, it would quickly close all of the process immediately.
wezterm.sleep_ms(1000)
-- Without this, it would quickly close all of the process immediately.
wezterm.sleep_ms(1000)
-- While it isn't required, it is nice to clean it up.
os.remove(tmpname)
end)
-- While it isn't required, it is nice to clean it up.
os.remove(tmpname)
end)
-- Maximize the terminal on startup.
wezterm.on('gui-startup', function(cmd)
local tab, pane, window = wezterm.mux.spawn_window(cmd or {})
window:gui_window():maximize()
end)
end
return module

View File

@ -2,9 +2,6 @@ local wezterm = require("wezterm")
local base = require("config/base")
local act = wezterm.action
-- Take note this is required to import the events in this module.
local _ = require("config/events")
local keymod = base.keymod
local alt_keymod = base.alt_keymod
local module = {}

View File

@ -1,6 +1,8 @@
local config = require("wezterm").config_builder()
config:set_strict_mode(true)
require("config/events").apply_to_config(config)
require("config/base").apply_to_config(config)
require("config/keys").apply_to_config(config)
require("config/appearance").apply_to_config(config)