Compare commits

...

4 Commits

Author SHA1 Message Date
Henrik Bakken 5310712394 codex tips 2026-03-10 22:01:15 +01:00
Henrik Bakken e2e5716f80 zshrc added catai 2026-03-10 00:23:48 +01:00
Henrik Bakken fdfefd1d16 nvim better gitsign hunks 2026-03-07 23:08:11 +01:00
Henrik Bakken c08828490c atuin use absolute time 2026-03-07 23:07:52 +01:00
6 changed files with 148 additions and 50 deletions
+3
View File
@@ -279,3 +279,6 @@ records = true
## The "workspace" mode is skipped when not in a workspace or workspaces = false.
## Default filter mode can be overridden with the filter_mode setting.
# filters = [ "global", "host", "session", "workspace", "directory" ]
[ui]
columns = ["datetime", "duration", "host", "command"]
+118 -31
View File
@@ -22,10 +22,7 @@ vim.o.timeoutlen = 500
vim.o.virtualedit = "block"
vim.o.wildmode = "longest:full,full"
vim.o.wrap = false
vim.opt.diffopt:append("linematch:60") -- second stage diff to align lines
vim.opt.diffopt:append("hiddenoff")
vim.opt.diffopt:append("vertical")
vim.opt.diffopt:append("algorithm:histogram")
vim.opt.diffopt = "internal,filler,closeoff,hiddenoff,vertical,algorithm:histogram"
vim.opt.wildignore:append(
"blue.vim,darkblue.vim,delek.vim,desert.vim,elflord.vim,evening.vim,habamax.vim,industry.vim,"
.. "koehler.vim,lunaperche.vim,morning.vim,murphy.vim,pablo.vim,peachpuff.vim,quiet.vim,retrobox.vim,ron.vim,"
@@ -140,8 +137,8 @@ map("n", "<C-l>", "<cmd>vertical resize +2<cr>", { desc = "Increase Window Width
-- https://github.com/mhinz/vim-galore#tips-1
-- smarter next/prev in command line
map("n", "<c-n>", "wildmenumode() ? '<c-n>' : '<down>'", { expr = true, desc = "Next" })
map("n", "<c-p>", "wildmenumode() ? '<c-p>' : '<up>'", { expr = true, desc = "Prev" })
map("c", "<c-n>", "wildmenumode() ? '<c-n>' : '<down>'", { expr = true, desc = "Next" })
map("c", "<c-p>", "wildmenumode() ? '<c-p>' : '<up>'", { expr = true, desc = "Prev" })
-- Add undo break-points
map("i", ",", ",<c-g>u")
@@ -182,11 +179,11 @@ map("n", "<leader>uI", function()
vim.api.nvim_input("I")
end, { desc = "Inspect Tree" })
-- Terminal Mappings
map("n", "<C-/>", "<cmd>terminal<cr>", { desc = "Show Terminal" })
map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
map("n", "<C-_>", "<cmd>terminal<cr>", { desc = "which_key_ignore" })
map("t", "<C-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
-- Terminal Mappings overridden by Snacks.terminal
-- map("n", "<C-/>", "<cmd>terminal<cr>", { desc = "Show Terminal" })
-- map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
-- map("n", "<C-_>", "<cmd>terminal<cr>", { desc = "which_key_ignore" })
-- map("t", "<C-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
-- windows
map("n", "<M-v>", "<cmd>vsplit<cr>", { desc = "Split Window Right", remap = true })
@@ -211,7 +208,7 @@ map("n", "<leader><tab>d", "<cmd>tabclose<cr>", { desc = "Close Tab" })
map("n", "<leader><tab>p", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
-- other
map("n", "<leader>cw", [[:cd %:p:h<cr>]], { desc = "Set Workspace To Buffer Path" })
map("n", "<leader>cW", [[:cd %:p:h<cr>]], { desc = "Set Workspace To Buffer Path" })
map("n", "<leader>o", "m`o<Esc>``", { desc = "Insert Newline" })
map(
"n",
@@ -296,7 +293,7 @@ vim.api.nvim_create_autocmd("FileType", {
-- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("wrap_spell", { clear = true }),
pattern = { "text", "plaintex", "typst", "gitcommit", "markdown" },
pattern = { "text", "plaintext", "typst", "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
@@ -313,6 +310,7 @@ vim.api.nvim_create_user_command("ConvertEOL", function(opts)
vim.notify("Unsupported file format: " .. fmt, vim.log.levels.ERROR, {
title = "ConvertEOL",
})
return
end
vim.bo.fileformat = fmt
vim.cmd([[write]])
@@ -547,7 +545,9 @@ local function makespec_hexokinase()
return {
-- coloring of colornames
"rrethy/vim-hexokinase",
build = "cd /home/hjalmarlucius/.local/share/nvim/lazy/vim-hexokinase; make hexokinase",
build = function(plugin)
vim.system({ "make", "hexokinase" }, { cwd = plugin.dir }):wait()
end,
config = function() vim.g.Hexokinase_highlighters = { "virtual" } end,
}
end
@@ -970,6 +970,7 @@ local function makespec_whichkey()
spec = {
{
mode = { "n", "v" },
{ "<leader>a", group = "ai" },
{ "<leader>c", group = "code/content" },
{ "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" },
@@ -1147,7 +1148,7 @@ local function makespec_snacks()
Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("<leader>uc")
Snacks.toggle.diagnostics():map("<leader>ud")
Snacks.toggle.dim():map("<leader>uD")
Snacks.toggle.inlay_hints():map("<leader>ui")
-- Snacks.toggle.inlay_hints():map("<leader>ui") -- using vim.show_pos instead
Snacks.toggle.line_number():map("<leader>ul")
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us")
@@ -1352,23 +1353,36 @@ local function makespec_treesitter()
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
opts = {
{
ensure_installed = {
"bash",
"c",
"cpp",
"git_rebase",
"gitcommit",
"lua",
"python",
"regex",
"vimdoc",
},
auto_install = true,
highlight = { enable = true },
indent = { enable = true, disable = { "python" }, additional_vim_regex_highlighting = { "python" } },
-- incremental_selection done by flash plugin
ensure_installed = {
"bash",
"c",
"cpp",
"css",
"diff",
"git_rebase",
"gitcommit",
"gitignore",
"html",
"javascript",
"json",
"json5",
"lua",
"markdown",
"markdown_inline",
"python",
"regex",
"toml",
"tsx",
"typescript",
"typst",
"vim",
"vimdoc",
"yaml",
},
auto_install = true,
highlight = { enable = true },
indent = { enable = true, disable = { "python" } },
-- incremental_selection done by flash plugin
},
init = function() vim.opt.foldexpr = "nvim_treesitter#foldexpr()" end,
}
@@ -1466,6 +1480,78 @@ local function makespec_conform()
}
end
local function makespec_avante()
return {
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false,
build = "make",
opts = {
provider = "openai",
auto_suggestions_provider = "openai",
providers = {
openai = {
model = "gpt-4.1",
extra_request_body = {
temperature = 0,
},
max_tokens = 4096,
},
gemini = {
model = "gemini-2.5-flash",
extra_request_body = {
temperature = 0,
max_tokens = 4096,
},
},
},
ignore_patterns = {
".git",
"node_modules",
"dist",
"build",
"target",
".cache",
".venv",
"venv",
"__pycache__",
".pytest_cache",
".mypy_cache",
".ruff_cache",
".DS_Store",
"*.lock",
"*.png",
"*.jpg",
"*.jpeg",
"*.gif",
"*.webp",
"*.pdf",
"*.svg",
"*.zip",
"*.tar",
"*.gz",
"*.min.js",
"*.map",
"*.secret",
"*.whl",
"*.data",
},
},
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"echasnovski/mini.icons",
"nvim-treesitter/nvim-treesitter",
},
keys = {
{ "<leader>ai", "<cmd>AvanteAsk<cr>", desc = "AI Ask", mode = { "n", "v" } },
{ "<leader>ae", "<cmd>AvanteEdit<cr>", desc = "AI Edit Selection", mode = "v" },
{ "<leader>ar", "<cmd>AvanteRefresh<cr>", desc = "AI Refresh Context" },
},
}
end
local function makespec_noice()
return {
"folke/noice.nvim",
@@ -1526,6 +1612,7 @@ for _, spec in ipairs({
makespec_autotag(),
makespec_lint(),
makespec_mason(),
-- makespec_avante(),
-- navigation
makespec_atone(),
makespec_whichkey(),
+3 -3
View File
@@ -164,10 +164,10 @@ c.tabs.tabs_are_windows = False
c.tabs.title.format = "{index}.{current_title}"
c.tabs.undo_stack_size = 1000
c.tabs.width = "15%"
c.url.start_pages = "http://www.google.com/search?hl=en&source=hp"
c.url.default_page = "http://www.google.com/search?hl=en&source=hp"
c.url.start_pages = "https://www.google.com/search?hl=en&source=hp"
c.url.default_page = "https://www.google.com/search?hl=en&source=hp"
c.url.searchengines = dict(
DEFAULT="http://www.google.com/search?hl=en&source=hp&q={}",
DEFAULT="https://www.google.com/search?hl=en&source=hp&q={}",
aw="https://wiki.archlinux.org/?search={}",
ap="https://www.archlinux.org/packages/?q={}",
gh="https://github.com/search?q={}&type=repositories",
+11 -13
View File
@@ -12,12 +12,11 @@ set -g allow-passthrough
set -g history-limit 100000
set -g focus-events on
# Set the default terminal terminfo
set -g default-terminal "foot"
# Advertise tmux correctly to programs running inside it.
set -g default-terminal "tmux-256color"
# True color support (Tc) and undercurl support (Smol)
set -as terminal-overrides ',foot:Tc'
set -as terminal-overrides ',foot:Smol'
# Tell tmux which features the outer Foot client supports.
set -as terminal-features ',foot*:RGB,clipboard,focus,title'
# Start with index 1
set -g base-index 1
@@ -31,11 +30,8 @@ bg_active_window="color252"
bg_highlight="red"
# pane title
ps_pid='#(pgrep -P "#{pane_pid}" | tr "\n" " ")'
cmd='#(ps --no-headers -o args $(pgrep -P "#{pane_pid}"))'
# cmd='#(ps --no-headers -t #{pane_tty} -o args -O-c | tr "\n" " ")'
setw -g pane-border-status top
setw -g pane-border-format " #{pane_current_path} #{=/-20/…:pane_current_command} ${ps_pid}[${cmd}] #{?alternate_on,<Alt Mode> ,}"
setw -g pane-border-format " #{pane_current_path} #{=/-40/…:pane_current_command} #{?alternate_on,<Alt Mode> ,}"
set -g pane-border-style "fg=${fg_inactive_pane}"
set -g pane-active-border-style "fg=${fg_active_pane}"
@@ -68,11 +64,12 @@ set -g set-titles on
# Note : you can press super key by set M.
# (tested with tty only)
set -g prefix M-a
bind M-a send-prefix
# First remove *all* keybindings
unbind -a
bind M-a send-prefix
# Basic bindings
bind ? list-keys
bind d detach-client
@@ -90,12 +87,13 @@ bind c copy-mode
# clipboard control
bind p paste-buffer
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 -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
bind -T copy-mode-vi Enter send-keys -X copy-selection-and-cancel
bind -T copy-mode-vi r send-keys -X rectangle-toggle
bind -T copy-mode-vi Escape send-keys -X cancel
bind -T copy-mode-vi q send-keys -X clear-selection
bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection primary -filter | xclip -selection clipboard"
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection primary -filter | xclip -selection clipboard"
bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "wl-copy"
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "wl-copy"
# Rename window
bind , command-prompt "rename-window %%"
+8
View File
@@ -13,6 +13,14 @@ export SAVEHIST=200000
alias ls='ls --color=auto -Ah'
alias ..='cd ..'
alias ...='cd ../..'
catai () {
rg --files --hidden --glob '!.git/*' "$@" | while read -r f; do
printf "\n── %s ──\n" "$f"
echo '```'
cat "$f"
echo '```'
done
}
# --- basic keybinds ---
bindkey '^[[Z' reverse-menu-complete # shift-tab
+5 -3
View File
@@ -14,6 +14,7 @@
# - ... etc
# - sudo enable ufw
from difflib import unified_diff
from getpass import getuser
from os.path import lexists
from pathlib import Path
from shutil import rmtree
@@ -21,14 +22,15 @@ from subprocess import run
from urllib.request import urlretrieve
HOSTNAME = open("/etc/hostname").read().strip()
HOME_TGT = Path("~").expanduser()
HOME_TGT = Path.home()
ROOT_TGT = Path("/")
DOTFILES = HOME_TGT / "dotfiles"
DOTFILES = Path(__file__).resolve().parent
HOME_SRC = DOTFILES / "HOME"
ROOT_SRC = DOTFILES / "ROOT"
CFG_TGT = HOME_TGT / ".config"
CFG_SRC = DOTFILES / "CONFIG"
CUSTOM_SRC = DOTFILES / f"custom-{HOSTNAME}"
USERNAME = getuser()
installmap = dict(
fonts=(
"noto-fonts-emoji",
@@ -430,7 +432,7 @@ def configure_pytools(overwrite: bool) -> None:
def install_virtwin(overwrite: bool, reinstall: bool) -> None:
helper_install(*installmap["virtwin"], reinstall=reinstall)
run("sudo usermod -aG libvirt $USER".split())
run(["sudo", "usermod", "-aG", "libvirt", USERNAME])
run("sudo virsh net-start default".split())
run("sudo virsh net-autostart default".split())
run("systemctl enable --now libvirtd".split())