From fa16efaeb6a3e61d2915c28fb04f21c267e551c2 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 22 Sep 2020 09:58:20 -0400 Subject: [PATCH] scratch: minimal init vim --- scratch/fast_split.lua | 28 ++++++++++++++++++++++++++++ scratch/minimal_init.vim | 7 +++++++ 2 files changed, 35 insertions(+) create mode 100644 scratch/fast_split.lua create mode 100644 scratch/minimal_init.vim diff --git a/scratch/fast_split.lua b/scratch/fast_split.lua new file mode 100644 index 0000000..0c5ea88 --- /dev/null +++ b/scratch/fast_split.lua @@ -0,0 +1,28 @@ +local test_line = "/home/tj/hello/world.lua" + +local function fast_split(line, split) + -- local split_line = vim.split(line, split) + local areas = {} + + local processed = 1 + local line_length = #line + 1 + + local part, start + repeat + start = string.find(line, split, processed, true) or line_length + part = string.sub(line, processed, start - 1) + + if start - processed > 0 then + table.insert(areas, { + word = part, + offset = processed + }) + end + + processed = start + 1 + until start == line_length + + return areas +end + +print(vim.inspect(fast_split(test_line, '/'))) diff --git a/scratch/minimal_init.vim b/scratch/minimal_init.vim new file mode 100644 index 0000000..1d53c29 --- /dev/null +++ b/scratch/minimal_init.vim @@ -0,0 +1,7 @@ + + +set rtp+=/home/tj/plugins/popup.nvim/ +set rtp+=/home/tj/plugins/plenary.nvim/ +set rtp+=/home/tj/plugins/telescope.nvim/ + +nnoremap ,,x :luafile %