diff options
| -rw-r--r-- | flake.lock | 138 | ||||
| -rw-r--r-- | flake.nix | 10 | ||||
| -rw-r--r-- | mut/dwm/config.h | 4 | ||||
| -rw-r--r-- | mut/ghostty/config | 12 | ||||
| -rw-r--r-- | mut/ghostty/themes/GruvboxLuke | 23 | ||||
| l--------- | mut/lf/icons | 2 | ||||
| -rw-r--r-- | mut/neovim/after/queries/nu/highlights.scm | 313 | ||||
| -rw-r--r-- | mut/neovim/after/queries/nu/indents.scm | 25 | ||||
| -rw-r--r-- | mut/neovim/after/queries/nu/injections.scm | 2 | ||||
| -rw-r--r-- | mut/neovim/lua/my/init.lua | 118 | ||||
| -rw-r--r-- | mut/neovim/lua/my/lsp.lua | 1 | ||||
| -rw-r--r-- | mut/neovim/lua/my/packages/blink.lua | 345 | ||||
| -rw-r--r-- | mut/neovim/lua/my/packages/go.lua | 43 | ||||
| -rw-r--r-- | mut/neovim/lua/my/packages/init.lua | 3 | ||||
| -rw-r--r-- | mut/neovim/lua/my/packages/oil.lua | 2 | ||||
| m--------- | mut/neovim/pack/plugins/start/vim-yaml-folds | 0 | ||||
| -rw-r--r-- | overlays/suckless.nix | 2 | ||||
| -rw-r--r-- | profiles/core/home.nix | 9 |
18 files changed, 1019 insertions, 33 deletions
@@ -156,6 +156,22 @@ "type": "github" } }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -213,9 +229,48 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghostty": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": "nixpkgs-unstable", + "zig": "zig" + }, + "locked": { + "lastModified": 1735535921, + "narHash": "sha256-cfsHww91bRA2Frni54+blIGZGU9/269vaWzeGcNRNN0=", + "owner": "ghostty-org", + "repo": "ghostty", + "rev": "87bd0bb744d6a1c45022aa39f21219d0b6ff3261", + "type": "github" + }, + "original": { + "owner": "ghostty-org", + "repo": "ghostty", + "type": "github" + } + }, "git-hooks": { "inputs": { - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_4", "gitignore": "gitignore", "nixpkgs": [ "neovim-nightly-overlay", @@ -306,7 +361,7 @@ }, "neovim-nightly-overlay": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "flake-parts": "flake-parts", "git-hooks": "git-hooks", "hercules-ci-effects": "hercules-ci-effects", @@ -378,6 +433,22 @@ }, "nixpkgs-stable": { "locked": { + "lastModified": 1733423277, + "narHash": "sha256-TxabjxEgkNbCGFRHgM/b9yZWlBj60gUOUnRT/wbVQR8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e36963a147267afc055f7cf65225958633e536bf", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { + "locked": { "lastModified": 1713434076, "narHash": "sha256-+/p5edwlkqKZc6GDAQl+92Hoe1f3NNbUF9uj+X9H3pU=", "owner": "NixOS", @@ -392,6 +463,22 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1733229606, + "narHash": "sha256-FLYY5M0rpa5C2QAE3CKLYAM6TwbKicdRK6qNrSHlNrE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "566e53c2ad750c84f6d31f9ccb9d00f823165550", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1721226092, @@ -476,6 +563,7 @@ "deploy-rs": "deploy-rs", "dns": "dns", "drduh-yubikey-guide": "drduh-yubikey-guide", + "ghostty": "ghostty", "home-manager": "home-manager", "neovim-nightly-overlay": "neovim-nightly-overlay", "nix-darwin": "nix-darwin", @@ -487,7 +575,7 @@ "simple-nixos-mailserver": { "inputs": { "blobs": "blobs", - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_5", "nixpkgs": "nixpkgs_5", "utils": "utils_2" }, @@ -508,7 +596,7 @@ "sops-nix": { "inputs": { "nixpkgs": "nixpkgs_6", - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { "lastModified": 1713532771, @@ -554,6 +642,21 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems" @@ -574,7 +677,7 @@ }, "utils_2": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1709126324, @@ -589,6 +692,31 @@ "repo": "flake-utils", "type": "github" } + }, + "zig": { + "inputs": { + "flake-compat": [ + "ghostty" + ], + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "ghostty", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1717848532, + "narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } } }, "root": "root", @@ -20,6 +20,9 @@ url = "path:/home/ivi/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; + ghostty = { + url = "github:ghostty-org/ghostty"; + }; }; outputs = inputs @ { @@ -28,6 +31,7 @@ home-manager, sops-nix, deploy-rs, + ghostty, ... }: let withLibs = @@ -127,6 +131,11 @@ modules = [ ./machines/vm-aarch64.nix + { + environment.systemPackages = [ + ghostty.packages.aarch64-linux.default + ]; + } ] ++ modulesIn ./profiles/core ++ modulesIn ./profiles/graphical; @@ -155,6 +164,7 @@ modules = [ ./machines/work.nix + ghostty.packages.x86_64-linux.default ] ++ modulesIn ./profiles/core; opts = { diff --git a/mut/dwm/config.h b/mut/dwm/config.h index 49d70dc..2528ebf 100644 --- a/mut/dwm/config.h +++ b/mut/dwm/config.h @@ -1,8 +1,8 @@ /* See LICENSE file for copyright and license details. */ /* Constants */ -#define TERMINAL "st" -#define TERMCLASS "St" +#define TERMINAL "ghostty" +#define TERMCLASS "Ghostty" #define BROWSER "chromium" /* appearance */ diff --git a/mut/ghostty/config b/mut/ghostty/config new file mode 100644 index 0000000..259a616 --- /dev/null +++ b/mut/ghostty/config @@ -0,0 +1,12 @@ +keybind = alt+k=scroll_page_fractional:-0.4 +keybind = alt+j=scroll_page_fractional:+0.4 +keybind = alt+b=scroll_page_up +keybind = alt+f=scroll_page_down +keybind = alt+c=copy_to_clipboard +keybind = alt+v=paste_from_clipboard +keybind = alt+shift+k=increase_font_size:1 +keybind = alt+shift+j=decrease_font_size:1 + +keybind = ctrl+zero=unbind +theme=GruvboxLuke +window-decoration=false diff --git a/mut/ghostty/themes/GruvboxLuke b/mut/ghostty/themes/GruvboxLuke new file mode 100644 index 0000000..3f09286 --- /dev/null +++ b/mut/ghostty/themes/GruvboxLuke @@ -0,0 +1,23 @@ +palette = 0=#262626 +palette = 1=#d75f5f +palette = 2=#afaf00 +palette = 3=#ffaf00 +palette = 4=#83adad +palette = 5=#d485ad +palette = 6=#85ad85 +palette = 7=#dab997 +palette = 8=#8a8a8a +palette = 9=#d75f5f +palette = 10=#afaf00 +palette = 11=#ffaf00 +palette = 12=#83adad +palette = 13=#d485ad +palette = 14=#85ad85 +palette = 15=#ebdbb2 + +background = #262626 +foreground = #dab997 +cursor-color = #dab997 + +selection-background = #665c54 +selection-foreground = #ebdbb2 diff --git a/mut/lf/icons b/mut/lf/icons index 9c21023..147b137 120000 --- a/mut/lf/icons +++ b/mut/lf/icons @@ -1 +1 @@ -/nix/store/lzsjy22l8zq0gagapm0zwgia3di6l66j-home-manager-files/.config/lf/icons
\ No newline at end of file +/nix/store/znw7za4drsyyarhvzp2gjy1aaz4iwnl1-home-manager-files/.config/lf/icons
\ No newline at end of file diff --git a/mut/neovim/after/queries/nu/highlights.scm b/mut/neovim/after/queries/nu/highlights.scm new file mode 100644 index 0000000..55b04ed --- /dev/null +++ b/mut/neovim/after/queries/nu/highlights.scm @@ -0,0 +1,313 @@ +;;; --- +;;; keywords +[ + "def" + "alias" + "export-env" + "export" + "extern" + "module" + + "let" + "let-env" + "mut" + "const" + + "hide-env" + + "source" + "source-env" + + "overlay" + "register" + + "loop" + "while" + "error" + + "do" + "if" + "else" + "try" + "catch" + "match" + + "break" + "continue" + "return" + +] @keyword + +(hide_mod "hide" @keyword) +(decl_use "use" @keyword) + +(ctrl_for + "for" @keyword + "in" @keyword +) +(overlay_list "list" @keyword.storage.modifier) +(overlay_hide "hide" @keyword.storage.modifier) +(overlay_new "new" @keyword.storage.modifier) +(overlay_use + "use" @keyword.storage.modifier + "as" @keyword +) +(ctrl_error "make" @keyword.storage.modifier) + +;;; --- +;;; literals +(val_number) @number +(val_duration unit: _ @variable.parameter) +(val_filesize unit: _ @variable.parameter) +(val_binary + [ + "0b" + "0o" + "0x" + ] @number + "[" @punctuation.bracket + digit: [ + "," @punctuation.delimiter + (hex_digit) @number + ] + "]" @punctuation.bracket +) @number +(val_bool) @constant.builtin +(val_nothing) @constant.builtin +(val_string) @variable.parameter +arg_str: (val_string) @variable.parameter +file_path: (val_string) @variable.parameter +(val_date) @number +(inter_escape_sequence) @constant.character.escape +(escape_sequence) @constant.character.escape +(val_interpolated [ + "$\"" + "$\'" + "\"" + "\'" +] @string) +(unescaped_interpolated_content) @string +(escaped_interpolated_content) @string +(expr_interpolated ["(" ")"] @variable.parameter) + +;;; --- +;;; operators +(expr_binary [ + "+" + "-" + "*" + "/" + "mod" + "//" + "++" + "**" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "=~" + "!~" + "and" + "or" + "xor" + "bit-or" + "bit-xor" + "bit-and" + "bit-shl" + "bit-shr" + "in" + "not-in" + "starts-with" + "ends-with" +] @operator ) + +(where_command [ + "+" + "-" + "*" + "/" + "mod" + "//" + "++" + "**" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "=~" + "!~" + "and" + "or" + "xor" + "bit-or" + "bit-xor" + "bit-and" + "bit-shl" + "bit-shr" + "in" + "not-in" + "starts-with" + "ends-with" +] @operator) + +(assignment [ + "=" + "+=" + "-=" + "*=" + "/=" + "++=" +] @operator) + +(expr_unary ["not" "-"] @operator) + +(val_range [ + ".." + "..=" + "..<" +] @operator) + +["=>" "=" "|"] @operator + +[ + "o>" "out>" + "e>" "err>" + "e+o>" "err+out>" + "o+e>" "out+err>" +] @operator + +;;; --- +;;; punctuation +[ + "," + ";" +] @punctuation.special + +(param_long_flag ["--"] @punctuation.delimiter) +(long_flag ["--"] @punctuation.delimiter) +(long_flag_equals_value ["--"] @punctuation.delimiter) +(short_flag ["-"] @punctuation.delimiter) +(long_flag_equals_value ["="] @punctuation.special) +(param_short_flag ["-"] @punctuation.delimiter) +(param_rest "..." @punctuation.delimiter) +(param_type [":"] @punctuation.special) +(param_value ["="] @punctuation.special) +(param_cmd ["@"] @punctuation.special) +(param_opt ["?"] @punctuation.special) +(returns "->" @punctuation.special) + +[ + "(" ")" + "{" "}" + "[" "]" +] @punctuation.bracket + +(val_record + (record_entry ":" @punctuation.delimiter)) +key: (identifier) @property + +;;; --- +;;; identifiers +(param_rest + name: (_) @variable.parameter) +(param_opt + name: (_) @variable.parameter) +(parameter + param_name: (_) @variable.parameter) +(param_cmd + (cmd_identifier) @string) + +(param_long_flag (long_flag_identifier) @attribute) +(param_short_flag (param_short_flag_identifier) @attribute) + +(short_flag (short_flag_identifier) @attribute) +(long_flag_identifier) @attribute + +(scope_pattern [(wild_card) @function]) + +(cmd_identifier) @function +; generated with Nu 0.93.0 +; > help commands +; | filter { $in.command_type == builtin and $in.category != core } +; | each {$'"($in.name | split row " " | $in.0)"'} +; | uniq +; | str join ' ' +(command + head: [ + (cmd_identifier) @function.builtin + (#any-of? @function.builtin + "all" "ansi" "any" "append" "ast" "bits" "bytes" "cal" "cd" "char" "clear" + "collect" "columns" "compact" "complete" "config" "cp" "date" "debug" + "decode" "default" "detect" "dfr" "drop" "du" "each" "encode" "enumerate" + "every" "exec" "exit" "explain" "explore" "export-env" "fill" "filter" + "find" "first" "flatten" "fmt" "format" "from" "generate" "get" "glob" + "grid" "group" "group-by" "hash" "headers" "histogram" "history" "http" + "input" "insert" "inspect" "interleave" "into" "is-empty" "is-not-empty" + "is-terminal" "items" "join" "keybindings" "kill" "last" "length" + "let-env" "lines" "load-env" "ls" "math" "merge" "metadata" "mkdir" + "mktemp" "move" "mv" "nu-check" "nu-highlight" "open" "panic" "par-each" + "parse" "path" "plugin" "port" "prepend" "print" "ps" "query" "random" + "range" "reduce" "reject" "rename" "reverse" "rm" "roll" "rotate" + "run-external" "save" "schema" "select" "seq" "shuffle" "skip" "sleep" + "sort" "sort-by" "split" "split-by" "start" "stor" "str" "sys" "table" + "take" "tee" "term" "timeit" "to" "touch" "transpose" "tutor" "ulimit" + "uname" "uniq" "uniq-by" "update" "upsert" "url" "values" "view" "watch" + "where" "which" "whoami" "window" "with-env" "wrap" "zip" + ) + ]) + +(command + "^" @punctuation.delimiter + head: (_) @function +) + +"where" @function.builtin + +(path + ["." "?"] @punctuation.delimiter +) @variable.parameter + +(stmt_let (identifier) @variable) + +(val_variable + "$" @punctuation.special + [ + (identifier) @variable + "in" @special + "nu" @namespace + "env" @constant + ] +) @none + +(record_entry + ":" @punctuation.special) + +;;; --- +;;; types +(flat_type) @type +(list_type + "list" @type.enum + ["<" ">"] @punctuation.bracket +) +(collection_type + ["record" "table"] @type.enum + "<" @punctuation.bracket + key: (_) @variable.parameter + ["," ":"] @punctuation.special + ">" @punctuation.bracket +) + +(shebang) @keyword.directive +(comment) @comment +( + (comment) @comment.documentation + (decl_def) +) +( + (parameter) + (comment) @comment.documentation +) diff --git a/mut/neovim/after/queries/nu/indents.scm b/mut/neovim/after/queries/nu/indents.scm new file mode 100644 index 0000000..488772a --- /dev/null +++ b/mut/neovim/after/queries/nu/indents.scm @@ -0,0 +1,25 @@ +[ + (expr_parenthesized) + (parameter_bracks) + + (val_record) + (val_list) + (val_closure) + (val_table) + + (block) +] @indent.begin + +[ + "}" + "]" + ")" +] @indent.end + +[ + "}" + "]" + ")" +] @indent.branch + +(comment) @indent.auto diff --git a/mut/neovim/after/queries/nu/injections.scm b/mut/neovim/after/queries/nu/injections.scm new file mode 100644 index 0000000..30804d6 --- /dev/null +++ b/mut/neovim/after/queries/nu/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment"))
\ No newline at end of file diff --git a/mut/neovim/lua/my/init.lua b/mut/neovim/lua/my/init.lua index b10615b..6b368fe 100644 --- a/mut/neovim/lua/my/init.lua +++ b/mut/neovim/lua/my/init.lua @@ -7,10 +7,10 @@ _G.ternary = function ( cond , T , F ) end vim.cmd "colorscheme kanagawa-wave" -vim.cmd("filetype plugin on") -vim.cmd("filetype indent on") -vim.cmd("highlight WinSeparator guibg=None") -vim.cmd("packadd cfilter") +vim.cmd "filetype plugin on" +vim.cmd "filetype indent on" +vim.cmd "highlight WinSeparator guibg=None" +vim.cmd "packadd cfilter" vim.api.nvim_set_hl(0, "VirtualTextWarning", {link= "Grey"}) vim.api.nvim_set_hl(0, "VirtualTextError", {link= "DiffDelete"}) @@ -18,6 +18,7 @@ vim.api.nvim_set_hl(0, "VirtualTextInfo", {link= "DiffChange"}) vim.api.nvim_set_hl(0, "VirtualTextHint", {link= "DiffAdd"}) local map = vim.keymap.set +local unmap = vim.keymap.del function i_grep(word, file) vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( @@ -32,6 +33,7 @@ function i_grep(word, file) end function cope() + require("quicker").refresh() vim.cmd(":botright copen " .. math.floor(vim.o.lines / 2.1)) end @@ -87,7 +89,7 @@ map("n", "<leader>:", function() i_grep("<c-r><c-w>", vim.fn.bufname("%")) end) map("v", "<leader>:", ":Vgrep!<cr>") map("n", "<leader>;", function() i_grep("", vim.fn.fnamemodify(vim.fn.bufname("%"), ":h")) end) map("v", "<leader>;", ":Vgrep<cr>") -map("n", "<leader>'", ":silent args `fd `<left>") +map("n", "<leader>'", ":Find ") map("n", "<leader>x<cr>", function() vim.cmd "b #" end) require("nvim_comment").setup() @@ -142,7 +144,10 @@ end, ) -function qf(inputs) +local last_job_state = nil +local last_job_thunk = nil +local last_job_lines = "" +function qf(inputs, opts) local id, title = inputs.id, inputs.title local prettify = function(line) local l = line:gsub("%c+%[[0-9:;<=>?]*[!\"#$%%&'()*+,-./]*[@A-Z%[%]^_`a-z{|}~]*;?[A-Z]?", "") @@ -159,11 +164,14 @@ function qf(inputs) return function(lines) lines = vim.iter(lines):map(prettify):totable() vim.schedule(function() + local what = { + id=id, + title=title, + lines=lines, + efm=opts.efm, + } vim.fn.setqflist( - {}, "a", { - id=id, title=title, - lines=lines - } + {}, "a", what ) if (not in_qf()) or (is_at_last_line() and in_qf()) then vim.cmd ":cbottom" @@ -172,28 +180,44 @@ function qf(inputs) end end -local last_job_state = nil -local last_job_thunk = nil -function qfjob(cmd, stdin) +function qfjob(cmd, stdin, opts) + last_job_lines = "" + local opts = opts or {} + opts.filter = opts.filter or (function(line) + return line + end) + local title = table.concat(cmd, " ") vim.fn.setqflist({}, " ", {title=title}) - local append_lines = qf(vim.fn.getqflist({id=0,title=1})) + local append_lines = qf(vim.fn.getqflist({id=0,title=1}), opts) last_job_state = vim.system( cmd, { stdin=stdin, stdout=function(err,data) if data then - append_lines(data:gmatch("[^\n]+")) + if not opts.buffer then + append_lines(vim.iter(data:gmatch("[^\n]+")):map(opts.filter)) + else + last_job_lines = last_job_lines .. data + end end end, stderr=function(err,data) if data then - append_lines(data:gmatch("[^\n]+")) + if not opts.buffer then + append_lines(vim.iter(data:gmatch("[^\n]+")):map(opts.filter)) + else + last_job_lines = last_job_lines .. data + end end end, }, function(job) vim.schedule(function() + if opts.buffer then + append_lines(vim.iter(last_job_lines:gmatch("[^\n]+")):map(opts.filter)) + end + local winnr = vim.fn.winnr() if not (job.code == 0) then cope() @@ -202,6 +226,9 @@ function qfjob(cmd, stdin) vim.cmd "wincmd p | cbot" end else + if opts.open then + cope() + end vim.notify([["]] .. title .. [[" succeeded!]]) end end) @@ -209,9 +236,47 @@ function qfjob(cmd, stdin) end vim.api.nvim_create_user_command( + "Find", + function(cmd) + local bufs = vim.iter(vim.api.nvim_list_bufs()) + :fold({}, function(acc, b) + acc[vim.api.nvim_buf_get_name(b)] = vim.api.nvim_buf_get_mark(b, [["]]) + return acc + end) + qfjob({ "fdfind", "--absolute-path", "--type", "f", "-E", vim.fn.expand("%:."), cmd.args }, nil, {efm = "%f:%l:%c:%m", open = true, filter = function(line) + local pos = bufs[line] or {} + local lnum, col = (pos[1] or "1"), (pos[2] or "0") + return line .. ":" .. lnum .. ":" .. col .. ":" .. "hello" + end}) + end, + {nargs="*", bang=true, complete="file"}) + +function opts_for_args(args) + local opts = { + go = { + test = function(cmd) + return {buffer = true, efm=require('my.packages.go').efm()} + end + } + } + local arg_opts = vim.iter(args) + :fold(opts, function(acc, v) + if type(acc) == "table" and acc[v] then + return acc[v] + end + return acc + end) + if type(arg_opts) == "function" then + return arg_opts() + elseif type(arg_opts) == "table" then + return (arg_opts[1] or function() return {} end)() + end +end + +vim.api.nvim_create_user_command( "Sh", function(cmd) - local thunk = function() qfjob({ "nu", "--commands", cmd.args }, nil) end + local thunk = function() qfjob({ "nu", "--commands", cmd.args }, nil, opts_for_args(cmd.fargs)) end last_job_thunk = thunk thunk() end, @@ -417,7 +482,24 @@ require('avante').setup ({ }, }) - +require("quicker").setup({ + keys = { + { + ">", + function() + require("quicker").expand({ before = 2, after = 2, add_to_existing = true }) + end, + desc = "Expand quickfix context", + }, + { + "<", + function() + require("quicker").collapse() + end, + desc = "Collapse quickfix context", + }, + }, +}) -- (local -- draw -- (fn [toggle] diff --git a/mut/neovim/lua/my/lsp.lua b/mut/neovim/lua/my/lsp.lua index 3097c58..2fad5aa 100644 --- a/mut/neovim/lua/my/lsp.lua +++ b/mut/neovim/lua/my/lsp.lua @@ -40,6 +40,7 @@ M.attach = function (ev) local fn = capability_map[c] if fn then fn() end end) + ev.client.capabilities = require('blink.cmp').get_lsp_capabilities(ev.client.capabilities) end return M diff --git a/mut/neovim/lua/my/packages/blink.lua b/mut/neovim/lua/my/packages/blink.lua new file mode 100644 index 0000000..bb5b30e --- /dev/null +++ b/mut/neovim/lua/my/packages/blink.lua @@ -0,0 +1,345 @@ +local blink = require('blink.cmp') +blink.setup { +-- When specifying 'preset' in the keymap table, the custom key mappings are merged with the preset, + -- and any conflicting keys will overwrite the preset mappings. + -- The "fallback" command will run the next non blink keymap. + -- + -- Example: + -- + -- keymap = { + -- preset = 'default', + -- ['<Up>'] = { 'select_prev', 'fallback' }, + -- ['<Down>'] = { 'select_next', 'fallback' }, + -- + -- -- disable a keymap from the preset + -- ['<C-e>'] = {}, + -- + -- -- show with a list of providers + -- ['<C-space>'] = { function(cmp) cmp.show({ providers = { 'snippets' } }) end }, + -- + -- -- note that your function will often be run in a "fast event" where most vim.api functions will throw an error + -- -- you may want to wrap your function in `vim.schedule` or use `vim.schedule_wrap` + -- ['<C-space>'] = { function(cmp) vim.schedule(function() your_behavior end) }, + -- + -- -- optionally, define different keymaps for cmdline + -- cmdline = { + -- preset = 'super-tab' + -- } + -- } + -- + -- When defining your own keymaps without a preset, no keybinds will be assigned automatically. + -- + -- Available commands: + -- show, hide, cancel, accept, select_and_accept, select_prev, select_next, show_documentation, hide_documentation, + -- scroll_documentation_up, scroll_documentation_down, snippet_forward, snippet_backward, fallback + -- + -- "default" keymap + -- ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' }, + -- ['<C-e>'] = { 'hide' }, + -- ['<C-y>'] = { 'select_and_accept' }, + -- + -- ['<C-p>'] = { 'select_prev', 'fallback' }, + -- ['<C-n>'] = { 'select_next', 'fallback' }, + -- + -- ['<C-b>'] = { 'scroll_documentation_up', 'fallback' }, + -- ['<C-f>'] = { 'scroll_documentation_down', 'fallback' }, + -- + -- ['<Tab>'] = { 'snippet_forward', 'fallback' }, + -- ['<S-Tab>'] = { 'snippet_backward', 'fallback' }, + -- + -- "super-tab" keymap + -- you may want to set `completion.trigger.show_in_snippet = false` + -- or use `completion.list.selection = "manual" | "auto_insert"` + -- + -- ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' }, + -- ['<C-e>'] = { 'hide', 'fallback' }, + -- + -- ['<Tab>'] = { + -- function(cmp) + -- if cmp.snippet_active() then return cmp.accept() + -- else return cmp.select_and_accept() end + -- end, + -- 'snippet_forward', + -- 'fallback' + -- }, + -- ['<S-Tab>'] = { 'snippet_backward', 'fallback' }, + -- + -- ['<Up>'] = { 'select_prev', 'fallback' }, + -- ['<Down>'] = { 'select_next', 'fallback' }, + -- ['<C-p>'] = { 'select_prev', 'fallback' }, + -- ['<C-n>'] = { 'select_next', 'fallback' }, + -- + -- ['<C-b>'] = { 'scroll_documentation_up', 'fallback' }, + -- ['<C-f>'] = { 'scroll_documentation_down', 'fallback' }, + -- + -- "enter" keymap + -- you may want to set `completion.list.selection = "manual" | "auto_insert"` + -- + -- ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' }, + -- ['<C-e>'] = { 'hide', 'fallback' }, + -- ['<CR>'] = { 'accept', 'fallback' }, + -- + -- ['<Tab>'] = { 'snippet_forward', 'fallback' }, + -- ['<S-Tab>'] = { 'snippet_backward', 'fallback' }, + -- + -- ['<Up>'] = { 'select_prev', 'fallback' }, + -- ['<Down>'] = { 'select_next', 'fallback' }, + -- ['<C-p>'] = { 'select_prev', 'fallback' }, + -- ['<C-n>'] = { 'select_next', 'fallback' }, + -- + -- ['<C-b>'] = { 'scroll_documentation_up', 'fallback' }, + -- ['<C-f>'] = { 'scroll_documentation_down', 'fallback' }, + keymap = { preset = 'default' }, + + -- Enables keymaps, completions and signature help when true + enabled = function() return vim.bo.buftype ~= "prompt" and vim.b.completion ~= false end, + -- Example for blocking multiple filetypes + -- enabled = function() + -- return not vim.tbl_contains({ "lua", "markdown" }, vim.bo.filetype) + -- and vim.bo.buftype ~= "prompt" + -- and vim.b.completion ~= false + -- end, + + snippets = { + -- Function to use when expanding LSP provided snippets + expand = function(snippet) vim.snippet.expand(snippet) end, + -- Function to use when checking if a snippet is active + active = function(filter) return vim.snippet.active(filter) end, + -- Function to use when jumping between tab stops in a snippet, where direction can be negative or positive + jump = function(direction) vim.snippet.jump(direction) end, + }, + + signature = { + enabled = true, + trigger = { + blocked_trigger_characters = {}, + blocked_retrigger_characters = {}, + -- When true, will show the signature help window when the cursor comes after a trigger character when entering insert mode + show_on_insert_on_trigger_character = true, + }, + window = { + min_width = 1, + max_width = 100, + max_height = 10, + border = 'padded', + winblend = 0, + winhighlight = 'Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder', + scrollbar = false, -- Note that the gutter will be disabled when border ~= 'none' + -- Which directions to show the window, + -- falling back to the next direction when there's not enough space, + -- or another window is in the way + direction_priority = { 'n', 's' }, + -- Disable if you run into performance issues + treesitter_highlighting = true, + }, + }, + + sources = { + -- Static list of providers to enable, or a function to dynamically enable/disable providers based on the context + default = { 'lsp', 'path', 'snippets', 'buffer' }, + -- Example dynamically picking providers based on the filetype and treesitter node: + -- providers = function(ctx) + -- local node = vim.treesitter.get_node() + -- if vim.bo.filetype == 'lua' then + -- return { 'lsp', 'path' } + -- elseif node and vim.tbl_contains({ 'comment', 'line_comment', 'block_comment' }, node:type()) then + -- return { 'buffer' } + -- else + -- return { 'lsp', 'path', 'snippets', 'buffer' } + -- end + -- end + + -- You may also define providers per filetype + per_filetype = { + -- lua = { 'lsp', 'path' }, + }, + + -- By default, we choose providers for the cmdline based on the current cmdtype + -- You may disable cmdline completions by replacing this with an empty table + cmdline = function() + local type = vim.fn.getcmdtype() + -- Search forward and backward + if type == '/' or type == '?' then return { 'buffer' } end + -- Commands + if type == ':' then return { 'cmdline' } end + return {} + end, + + -- Function to use when transforming the items before they're returned for all providers + -- The default will lower the score for snippets to sort them lower in the list + transform_items = function(_, items) + for _, item in ipairs(items) do + if item.kind == require('blink.cmp.types').CompletionItemKind.Snippet then + item.score_offset = item.score_offset - 3 + end + end + return items + end, + -- Minimum number of characters in the keyword to trigger all providers + -- May also be `function(ctx: blink.cmp.Context): number` + min_keyword_length = 0, + -- Example for setting a minimum keyword length for markdown files + -- min_keyword_length = function() + -- return vim.bo.filetype == 'markdown' and 2 or 0 + -- end, + + -- Please see https://github.com/Saghen/blink.compat for using `nvim-cmp` sources + providers = { + lsp = { + name = 'LSP', + module = 'blink.cmp.sources.lsp', + -- Filter out text items from the LSP provider, since we have the buffer provider for that + transform_items = function(_, items) + return vim.tbl_filter( + function(item) return item.kind ~= require('blink.cmp.types').CompletionItemKind.Text end, + items + ) + end, + + --- *All* providers have the following options available + --- NOTE: All of these options may be functions to get dynamic behavior + --- See the type definitions for more information. + enabled = true, -- Whether or not to enable the provider + async = false, -- Whether we should wait for the provider to return before showing the completions + timeout_ms = 2000, -- How long to wait for the provider to return before showing completions and treating it as asynchronous + transform_items = nil, -- Function to transform the items before they're returned + should_show_items = true, -- Whether or not to show the items + max_items = nil, -- Maximum number of items to display in the menu + min_keyword_length = 0, -- Minimum number of characters in the keyword to trigger the provider + -- If this provider returns 0 items, it will fallback to these providers. + -- If multiple providers falback to the same provider, all of the providers must return 0 items for it to fallback + fallbacks = { 'buffer' }, + score_offset = 0, -- Boost/penalize the score of the items + override = nil, -- Override the source's functions + }, + path = { + name = 'Path', + module = 'blink.cmp.sources.path', + score_offset = 3, + fallbacks = { 'buffer' }, + opts = { + trailing_slash = false, + label_trailing_slash = true, + get_cwd = function(context) return vim.fn.expand(('#%d:p:h'):format(context.bufnr)) end, + show_hidden_files_by_default = false, + } + }, + snippets = { + name = 'Snippets', + module = 'blink.cmp.sources.snippets', + opts = { + friendly_snippets = true, + search_paths = { vim.fn.stdpath('config') .. '/snippets' }, + global_snippets = { 'all' }, + extended_filetypes = {}, + ignored_filetypes = {}, + get_filetype = function(context) + return vim.bo.filetype + end + } + + --- Example usage for disabling the snippet provider after pressing trigger characters (i.e. ".") + -- enabled = function(ctx) + -- return ctx ~= nil and ctx.trigger.kind == vim.lsp.protocol.CompletionTriggerKind.TriggerCharacter + -- end, + }, + luasnip = { + name = 'Luasnip', + module = 'blink.cmp.sources.luasnip', + opts = { + -- Whether to use show_condition for filtering snippets + use_show_condition = true, + -- Whether to show autosnippets in the completion list + show_autosnippets = true, + } + }, + buffer = { + name = 'Buffer', + module = 'blink.cmp.sources.buffer', + opts = { + -- default to all visible buffers + get_bufnrs = function() + return vim + .iter(vim.api.nvim_list_wins()) + :map(function(win) return vim.api.nvim_win_get_buf(win) end) + :filter(function(buf) return vim.bo[buf].buftype ~= 'nofile' end) + :totable() + end, + } + }, + }, + }, + + appearance = { + highlight_ns = vim.api.nvim_create_namespace('blink_cmp'), + -- Sets the fallback highlight groups to nvim-cmp's highlight groups + -- Useful for when your theme doesn't support blink.cmp + -- Will be removed in a future release + use_nvim_cmp_as_default = false, + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', + kind_icons = { + Text = '', + Method = '', + Function = '', + Constructor = '', + + Field = '', + Variable = '', + Property = '', + + Class = '', + Interface = '', + Struct = '', + Module = '', + + Unit = '', + Value = '', + Enum = '', + EnumMember = '', + + Keyword = '', + Constant = '', + + Snippet = '', + Color = '', + File = '', + Reference = '', + Folder = '', + Event = '', + Operator = '', + TypeParameter = '', + }, + }, +} + +local map = vim.keymap.set +local unmap = vim.keymap.del +local event = vim.api.nvim_create_autocmd +map("n", "<leader>xf", function() + event({"CmdwinEnter"}, { + once = true, + callback = function() + map("i","<c-j>", function() + blink.hide() + vim.schedule(function() + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes("<cr>", true, false, true), + "c", false) + end) + end,{buffer=true}) + map("i","<bs>","<c-o>vT/d",{buffer=true}) + end + }) + event({"CmdwinLeave"}, { + once = true, + callback = function() + unmap("i","<c-j>",{buffer=true}) + unmap("i","<bs>",{buffer=true}) + end + }) + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes(":edit <c-r>=expand('%:p:h')<cr><c-f>A/", true, false, true), + "c", false) +end) diff --git a/mut/neovim/lua/my/packages/go.lua b/mut/neovim/lua/my/packages/go.lua index 372d94b..4abf384 100644 --- a/mut/neovim/lua/my/packages/go.lua +++ b/mut/neovim/lua/my/packages/go.lua @@ -1,5 +1,10 @@ +local M = {} local go = require("go") +local gotest = require("go.gotest") go.setup { + test_efm = false, -- errorfomat for quickfix, default mix mode, set to true will be efm only + luasnip = true, + goimports = false, fillstruct = false, gofmt = false, @@ -29,6 +34,42 @@ go.setup { build_tags = "", test_runner = "go", run_in_floaterm = false, - luasnip = true, iferr_vertical_shift = 4, } + +local efm = function() + local indent = [[%\\%( %\\)]] + local efm = [[%-G=== RUN %.%#]] + efm = efm .. [[,%-G]] .. indent .. [[%#--- PASS: %.%#]] + efm = efm .. [[,%G--- FAIL: %\\%(Example%\\)%\\@= (%.%#)]] + efm = efm .. [[,%G]] .. indent .. [[%#--- FAIL: (%.%#)]] + efm = efm .. [[,%A]] .. indent .. [[%\\+%[%^:]%\\+: %f:%l: %m]] + efm = efm .. [[,%+Gpanic: test timed out after %.%\\+]] + efm = efm .. ',%+Afatal error: %.%# [recovered]' + efm = efm .. [[,%+Afatal error: %.%#]] + efm = efm .. [[,%+Apanic: %.%#]] + -- + -- -- exit + efm = efm .. ',%-Cexit status %[0-9]%\\+' + efm = efm .. ',exit status %[0-9]%\\+' + -- -- failed lines + efm = efm .. ',%-CFAIL%\\t%.%#' + efm = efm .. ',FAIL%\\t%.%#' + -- compiling error + + efm = efm .. ',%A%f:%l:%c: %m' + efm = efm .. ',%A%f:%l: %m' + efm = efm .. ',%f:%l +0x%[0-9A-Fa-f]%\\+' -- pannic with adress + efm = efm .. ',%-G%\\t%\\f%\\+:%\\d%\\+ +0x%[0-9A-Fa-f]%\\+' -- test failure, address invalid inside + -- multi-line + efm = efm .. ',%+G%\\t%m' + -- efm = efm .. ',%-C%.%#' -- ignore rest of unmatched lines + -- efm = efm .. ',%-G%.%#' + + efm = string.gsub(efm, ' ', [[\ ]]) + -- log(efm) + return efm +end +gotest.efm = efm +M.efm = efm +return M diff --git a/mut/neovim/lua/my/packages/init.lua b/mut/neovim/lua/my/packages/init.lua index 082cea4..849527e 100644 --- a/mut/neovim/lua/my/packages/init.lua +++ b/mut/neovim/lua/my/packages/init.lua @@ -1,5 +1,6 @@ require("my.packages.oil") -require("my.packages.cmp") +-- require("my.packages.cmp") +require("my.packages.blink") require("my.packages.lint") require("my.packages.luasnip") require("my.packages.dap") diff --git a/mut/neovim/lua/my/packages/oil.lua b/mut/neovim/lua/my/packages/oil.lua index 49c82c2..fa66001 100644 --- a/mut/neovim/lua/my/packages/oil.lua +++ b/mut/neovim/lua/my/packages/oil.lua @@ -1,5 +1,7 @@ local oil=require("oil") local fzf=require("fzf-lua") +local map = vim.keymap.set +local unmap = vim.keymap.del oil.setup({ default_file_explorer = true, diff --git a/mut/neovim/pack/plugins/start/vim-yaml-folds b/mut/neovim/pack/plugins/start/vim-yaml-folds new file mode 160000 +Subproject 890ccd8e5370808d569e96dbb06cbeca2cf5993 diff --git a/overlays/suckless.nix b/overlays/suckless.nix index e22e81c..d63b2f1 100644 --- a/overlays/suckless.nix +++ b/overlays/suckless.nix @@ -6,7 +6,7 @@ })); dwm = (prev.dwm.overrideAttrs (oldAttrs: { src = home + "/mut/dwm"; - version = "0.1.5"; + version = "0.1.6"; })); dwmblocks =(prev.stdenv.mkDerivation { pname = "dwmblocks"; diff --git a/profiles/core/home.nix b/profiles/core/home.nix index 7aed1db..5a7570d 100644 --- a/profiles/core/home.nix +++ b/profiles/core/home.nix @@ -53,6 +53,7 @@ with lib; { # fonts.fontconfig.enable = true; # https://github.com/nix-community/home-manager/issues/4692 # home.file.".local/bin".source = config.lib.meta.mkMutableSymlink /mut/bin; + home.file.".config/ghostty".source = config.lib.meta.mkMutableSymlink /mut/ghostty; xdg = { enable = true; mime.enable = !machine.isDarwin; @@ -185,7 +186,7 @@ with lib; { ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock fi export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock - ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk + # ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk if [[ $TERM != "dumb" ]]; then eval "$(/etc/profiles/per-user/ivi/bin/starship init zsh)" @@ -197,7 +198,7 @@ with lib; { fi export MANPAGER='nvim +Man!' export EDITOR="nvim" - export TERMINAL="st" + # export TERMINAL="st" export PATH="''${KREW_ROOT:-$HOME/.krew}/bin:$PATH" export PASSWORD_STORE_GPG_OPTS='--no-throw-keyids' @@ -405,7 +406,7 @@ with lib; { enable = false; bashrcExtra = '' export EDITOR="nvim" - export TERMINAL="st" + # export TERMINAL="st" ( command -v brew ) &>/dev/null && eval "$(/opt/homebrew/bin/brew shellenv)" ( command -v docker ) &>/dev/null && eval "$(docker completion bash)" ( command -v kubectl ) &>/dev/null && eval "$(kubectl completion bash)" @@ -424,7 +425,7 @@ with lib; { ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock fi export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock - ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk + # ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk ''; shellAliases = { k9s = "k9s "; |
