From 67c038a4ddf62ef81a4e4351e5838553944390e2 Mon Sep 17 00:00:00 2001 From: Greg Hurrell Date: Sat, 21 Oct 2023 01:27:28 +0200 Subject: [PATCH 1/2] style: make some cosmetic improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On my machine: - ◭ ("Up-pointing triangle with left half black") - ◮ ("Up-pointing triangle with right half black") look pretty bad in the terminal, so swap them for something else. --- chatbot.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/chatbot.lua b/chatbot.lua index c22f087..04bce5b 100644 --- a/chatbot.lua +++ b/chatbot.lua @@ -4,9 +4,10 @@ local is_receiving = false local bot_cmd = os.getenv("SHELLBOT") local separator = "===" +local nbsp = ' ' local roles = { - USER = "◭🧑 " .. os.getenv('USER'), - ASSISTANT = "◮🤖 vimbot", + USER = " 🤓 «" .. os.getenv('USER') .. "»" .. nbsp, + ASSISTANT = " 🤖 «vimbot»" .. nbsp, } local buffer_sync_cursor = {} @@ -95,9 +96,9 @@ function ChatBotSubmit() local function get_transcript() local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) for i, line in ipairs(lines) do - if line:match("^◭") then -- '^' means start of line + if line:match("^ 🤓") then -- '^' means start of line lines[i] = separator .. "USER" .. separator - elseif line:match("^◮") then + elseif line:match("^ 🤖") then lines[i] = separator .. "ASSISTANT" .. separator end end From b42c5a953d43cd490357be4f0b9c5346930fd4b1 Mon Sep 17 00:00:00 2001 From: Greg Hurrell Date: Sat, 21 Oct 2023 12:45:27 +0200 Subject: [PATCH 2/2] refactor!: use NBSP at front of headers as well Trying to distinguish from "normal" lines a little more explicitly. --- chatbot.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chatbot.lua b/chatbot.lua index 04bce5b..5643a82 100644 --- a/chatbot.lua +++ b/chatbot.lua @@ -6,8 +6,8 @@ local separator = "===" local nbsp = ' ' local roles = { - USER = " 🤓 «" .. os.getenv('USER') .. "»" .. nbsp, - ASSISTANT = " 🤖 «vimbot»" .. nbsp, + USER = nbsp .. "🤓 «" .. os.getenv('USER') .. "»" .. nbsp, + ASSISTANT = nbsp .. "🤖 «vimbot»" .. nbsp, } local buffer_sync_cursor = {} @@ -96,9 +96,9 @@ function ChatBotSubmit() local function get_transcript() local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) for i, line in ipairs(lines) do - if line:match("^ 🤓") then -- '^' means start of line + if line:match('^' .. nbsp .. '🤓') then -- '^' means start of line lines[i] = separator .. "USER" .. separator - elseif line:match("^ 🤖") then + elseif line:match('^' .. nbsp ..'🤖') then lines[i] = separator .. "ASSISTANT" .. separator end end