scratch: minimal init vim
This commit is contained in:
28
scratch/fast_split.lua
Normal file
28
scratch/fast_split.lua
Normal file
@@ -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, '/')))
|
||||||
7
scratch/minimal_init.vim
Normal file
7
scratch/minimal_init.vim
Normal file
@@ -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 %<CR>
|
||||||
Reference in New Issue
Block a user