88480cb

Branches > main > 88480cb > files / nvim / syntax

Merge new commits to main

Grahp, 2026-07-08

Commit: 88480cbd200eed534c5c3906829a6e7089ebf743
Parent: 48e5e95
Parent: 0b0b4e2

7 changed files:

nixos/machines/pc/home.nix modified (view file)

@@ -136,6 +136,11 @@     protontricks       freetype +      ntfs3g++     qgis++    jetbrains.idea-community   ]; }

nvim/.gitignore added (view file)

@@ -0,0 +1 @@+spell/

nvim/ftplugin/clojure.lua modified (view file)

@@ -1 +1,2 @@ require("plugins.conjure")+-- require("parinfer.plugin").setup()

nvim/lua/fuzzy.lua modified (view file)

@@ -1,19 +1,7 @@ local api = vim.api local fn = vim.fn-local o = vim.o -local function open_fullscreen_window()-  local buf = api.nvim_create_buf(false, true)-  return api.nvim_open_win(buf, true, {-    relative = "editor",-    row = 0,-    col = 0,-    width = o.columns,-    height = o.lines,-    style = "minimal",-    border = "none"-  })-end+local ui = require("utils.ui")  local function fzf_window(win)   local tmp = fn.tempname()@@ -37,7 +25,7 @@   if fn.executable("fzf") ~= 1 then     print("You don't have fzf, can't fuzzy find!")   else-    local win = open_fullscreen_window()+    local win = ui.open_fullscreen_window()     local ok = pcall(fzf_window, win)     if not ok then       pcall(api.nvim_win_close, win, true)

nvim/lua/keybindings.lua modified (view file)

@@ -1,6 +1,6 @@---- What happens when you use vim for too long: local keymap = vim.keymap.set +--- What happens when you use vim for too long: keymap("n", "<C-h>", "<C-w><C-h>") keymap("n", "<C-l>", "<C-w><C-l>") keymap("n", "<C-j>", "<C-w><C-j>")

nvim/lua/parinfer/plugin.lua modified (view file)

@@ -7,7 +7,7 @@ vim.g.parinfer_comment_chars = {";"}  local api = vim.api-local diff = (vim.text.diff or vim.diff)+local diff = vim.text.diff or vim.diff local parinfer = require("parinfer.parinfer") local modes = {indent = parinfer.indentMode,                paren = parinfer.parenMode,@@ -20,21 +20,19 @@   return t[k] end}) --- TODO I don't really get the point of this+-- Returns true if 'val' is truthy, and not 0, otherwise returns false+-- 0 and 1 are commonly used in vim functions for true/false, but 0 is a truthy value in Lua local function normalize_bool(val)-  if type(val) == "boolean" then+  if type(val) == "boolean" or val == nil then     return val+  else+    return val ~= 0   end--  if val == nil then-    return nil-  end--  return val ~= 0 end +-- Looks up and returns 'opt' in the buffer-local and global option tables vim.b and vim.g local function get_option(opt)-  local b = vim.b[opt] or vim.g[opt]+  local b = vim.b[opt]   if b == nil then     return vim.g[opt]   else@@ -43,61 +41,60 @@ end  local function invoke_parinfer(bufnr, text, lnum, col)-  local _let_32_ = (state[bufnr]["prev-cursor"] or {})-  local prev_lnum = _let_32_[1]-  local prev_col = _let_32_[2]+  local prev_lnum, prev_col = unpack(state[bufnr]["prev-cursor"])   local changes = state[bufnr].changes-  local request = {commentChars = get_option("parinfer_comment_chars"), prevCursorLine = prev_lnum, prevCursorX = prev_col, cursorLine = lnum, cursorX = (col + 1), changes = changes, forceBalance = normalize_bool(get_option("parinfer_force_balance"))}+  local request = {commentChars = get_option("parinfer_comment_chars"),+                   prevCursorLine = prev_lnum,+                   prevCursorX = prev_col,+                   cursorLine = lnum,+                   cursorX = col + 1,+                   changes = changes,+                   forceBalance = normalize_bool(get_option("parinfer_force_balance"))}   local response = modes[get_option("parinfer_mode")](text, request)-  state[bufnr]["changes"] = {}+  state[bufnr].changes = {}   return response end --- Does kidna flicker--- Also bad still-local function update_buffer(bufnr, old_contents, new_contents)-  api.nvim_command("silent! undojoin")-  state[bufnr]["locked"] = true-  do-    local new_lines = vim.split(new_contents, "\n")-    local hunks = diff(old_contents, new_contents, {result_type = "indices"})-    for _, hunk in ipairs(hunks) do-      local start_a = hunk[1]-      local count_a = hunk[2]-      local start_b = hunk[3]-      local count_b = hunk[4]-      local lines-      do-        local t = {}-        local i = 0-        for num = start_b, start_b + count_b do-          local new_line = new_lines[num]-          if new_line ~= nil then-            i = i + 1-            t[i] = new_line-          else-          end-        end-        lines = t-      end+local function build_replacement_lines(new_lines, start_b, count_b)+  local t = {}+  local i = 0 -      api.nvim_buf_set_lines(bufnr, start_a - 1, start_a + count_a, false, lines)+  for num = start_b, start_b + count_b do+    local line = new_lines[num]+    if line ~= nil then+      i = i + 1+      t[i] = line     end   end-  local function _35_()-    state[bufnr]["locked"] = false-    return nil++  return t+end++local function apply_hunk(bufnr, new_lines, hunk)+  local start_a, count_a, start_b, count_b = unpack(hunk)+  api.nvim_buf_set_lines(bufnr, start_a - 1, start_a + count_a, false, build_replacement_lines(new_lines, start_b, count_b))+end++local function update_buffer(bufnr, old_contents, new_contents)+  api.nvim_command("silent! undojoin")+  state[bufnr].locked = true++  local new_lines = vim.split(new_contents, "\n")+  local hunks = diff(old_contents, new_contents, {result_type = "indices"})+  for _, hunk in ipairs(hunks) do+    apply_hunk(bufnr, new_lines, hunk)   end-  return vim.schedule(_35_)++  return vim.schedule(function()+    state[bufnr].locked = false+  end) end  local function highlight_error(bufnr, err)   api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)   if err then-    local lnum,col = (err.lineNo - 1), (err.x - 1)-    return vim.highlight.range(bufnr, ns, "Error", {lnum, col}, {lnum, (col + 1)}, "c")-  else-    return nil+    local lnum, col = err.lineNo - 1, err.x - 1+    return vim.highlight.range(bufnr, ns, "Error", {lnum, col}, {lnum, col + 1}, "c")   end end @@ -105,17 +102,17 @@   local undotree = vim.fn.undotree()   local seq_cur = undotree["seq_cur"]   local seq_last = undotree["seq_last"]-  return (seq_cur == seq_last)+  return seq_cur == seq_last end  local function should_run(bufnr)-  return (normalize_bool(get_option("parinfer_enabled"))+  return normalize_bool(get_option("parinfer_enabled"))     and not state[bufnr].locked     and not vim.o.paste     and not vim.bo.readonly     and vim.bo.modifiable-    and (vim.b[bufnr].changedtick ~= state[bufnr].changedtick)-    and is_undo_leaf())+    and vim.b[bufnr].changedtick ~= state[bufnr].changedtick+    and is_undo_leaf() end  local elapsed_times = setmetatable({}, {__index = function(t, k)@@ -151,8 +148,8 @@ end  local function slice(lines, start_row, start_col, row_offset, col_offset)-  local start_row0 = (start_row + 1)-  local start_col0 = (start_col + 1)+  local start_row0 = start_row + 1+  local start_col0 = start_col + 1    local function get_offset_or_something()     if row_offset == 0 then@@ -170,7 +167,7 @@     table.insert(out, line)   end -  if (row_offset ~= 0) then+  if row_offset ~= 0 then     local function still_dont_know()       if ((0 < col_offset) and lines[(start_row0 + row_offset)]) then         return string.sub(lines[(start_row0 + row_offset)], 1, col_offset)@@ -207,8 +204,7 @@   end end -local function enter_buffer()-  local bufnr = vim.api.nvim_get_current_buf()+local function enter_buffer(bufnr)   local contents = vim.api.nvim_buf_get_lines(bufnr, 0, -1, true)   state[bufnr]["changedtick"] = -1   state[bufnr]["prev-contents"] = contents@@ -220,13 +216,23 @@ end  local function cursor_moved(bufnr)-  return vim.schedule(-    function()-      local cursor = vim.api.nvim_win_get_cursor(0)-      local lnum = cursor[1]-      local col = cursor[2]-      state[bufnr]["prev-cursor"] = {lnum, (col + 1)}-    end)+  return vim.schedule(function()+    local cursor = vim.api.nvim_win_get_cursor(0)+    local lnum = cursor[1]+    local col = cursor[2]+    state[bufnr]["prev-cursor"] = {lnum, (col + 1)}+  end)+end++local function setup_buffer(bufnr)+  enter_buffer(bufnr)++  vim.api.nvim_exec_autocmds("User", {pattern = "Parinfer"})++  local ag = vim.api.nvim_create_augroup("parinfer", {clear = true})++  vim.api.nvim_create_autocmd({"TextChanged", "TextChangedI", "TextChangedP"}, {buffer = bufnr, group = ag, callback = function() process_buffer(bufnr) end})+  vim.api.nvim_create_autocmd({"CursorMoved", "CursorMovedI"}, {buffer = bufnr, group = ag, callback = function() cursor_moved(bufnr) end}) end  local function should_enable()@@ -235,16 +241,11 @@  --- Sets up parinfer in the current buffer local function setup()+  print("alright")   if should_enable() then+    print("okay")     local bufnr = vim.api.nvim_get_current_buf()-    enter_buffer()--    vim.api.nvim_exec_autocmds("User", {pattern = "Parinfer"})--    local ag = vim.api.nvim_create_augroup("parinfer", {clear = true})--    vim.api.nvim_create_autocmd({"TextChanged", "TextChangedI", "TextChangedP"}, {buffer = bufnr, group = ag, callback = function() process_buffer(bufnr) end})-    vim.api.nvim_create_autocmd({"CursorMoved", "CursorMovedI"}, {buffer = bufnr, group = ag, callback = function() cursor_moved(bufnr) end})+    setup_buffer(bufnr)   end end 

nvim/lua/utils/ui.lua added (view file)

@@ -0,0 +1,18 @@++local api = vim.api+local o = vim.o++local function open_fullscreen_window()+  local buf = api.nvim_create_buf(false, true)+  return api.nvim_open_win(buf, true, {+    relative = "editor",+    row = 0,+    col = 0,+    width = o.columns,+    height = o.lines,+    style = "minimal",+    border = "none"+  })+end++return {open_fullscreen_window = open_fullscreen_window}