88480cb
Branches > main > 88480cb > files / nvim / pack
Merge new commits to main
Commit: 88480cbd200eed534c5c3906829a6e7089ebf743
Parent: 48e5e95
Parent: 0b0b4e2
7 changed files:
nixos/machines/pc/home.nix view file
@@ -136,6 +136,11 @@ protontricks freetype + ntfs3g++ qgis++ jetbrains.idea-community ]; }nvim/.gitignore view file
@@ -0,0 +1 @@+spell/nvim/ftplugin/clojure.lua view file
@@ -1 +1,2 @@ require("plugins.conjure")+-- require("parinfer.plugin").setup()nvim/lua/fuzzy.lua 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 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 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 endnvim/lua/utils/ui.lua 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}