diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-03-10 23:54:24 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-03-10 23:54:24 -0600 |
commit | 183241c17a246ab97c60f78bbd4adc6b40cc9016 (patch) | |
tree | 13d7c66ecb267ac42800d813844cebeb1d0587c9 /lua | |
parent | 2aff69b0bb55f398d199db687617ed35d0335d5b (diff) | |
download | nvim-warp-183241c17a246ab97c60f78bbd4adc6b40cc9016.tar.gz nvim-warp-183241c17a246ab97c60f78bbd4adc6b40cc9016.tar.bz2 nvim-warp-183241c17a246ab97c60f78bbd4adc6b40cc9016.zip |
run lua-format.
Diffstat (limited to 'lua')
-rw-r--r-- | lua/warp.lua | 3 | ||||
-rw-r--r-- | lua/warp/strategy/default.lua | 6 | ||||
-rw-r--r-- | lua/warp/strategy/null.lua | 6 | ||||
-rw-r--r-- | lua/warp/strategy/words.lua | 24 |
4 files changed, 15 insertions, 24 deletions
diff --git a/lua/warp.lua b/lua/warp.lua index a2332f4..563e177 100644 --- a/lua/warp.lua +++ b/lua/warp.lua @@ -145,8 +145,7 @@ M.run = function(strat_fn) w = M.open_horiz() local disp = strat.display() if disp then - vim.api - .nvim_buf_set_lines(M.horiz_bufnr, 0, -1, 0, {' ' .. disp}) + vim.api.nvim_buf_set_lines(M.horiz_bufnr, 0, -1, 0, {' ' .. disp}) local ch = next_char() while ch ~= '\x1b' and strat.on_char(ch) do vim.api.nvim_buf_set_lines(M.horiz_bufnr, 0, -1, 0, diff --git a/lua/warp/strategy/default.lua b/lua/warp/strategy/default.lua index 55019d8..c48bdf3 100644 --- a/lua/warp/strategy/default.lua +++ b/lua/warp/strategy/default.lua @@ -39,11 +39,11 @@ end local big_line, col_map = make_big_line() -M.default_strategy = function () +M.default_strategy = function() local filter return { - display = function () + display = function() local curpos = vim.api.nvim_win_get_cursor(0) local line_at = vim.fn.getline(curpos[1]) local unfiltered = big_line:sub(1, #line_at + 1) @@ -66,7 +66,7 @@ M.default_strategy = function () return line end, - on_char = function (ch) + on_char = function(ch) if not filter then if ch == '$' or ch == '^' then vim.cmd("normal! " .. ch) diff --git a/lua/warp/strategy/null.lua b/lua/warp/strategy/null.lua index 9464547..eb00921 100644 --- a/lua/warp/strategy/null.lua +++ b/lua/warp/strategy/null.lua @@ -2,10 +2,10 @@ local vim = assert(vim) local M = {} -M.null_strategy = function () +M.null_strategy = function() return { - display = function () return nil end, - on_char = function () return false end + display = function() return nil end, + on_char = function() return false end } end diff --git a/lua/warp/strategy/words.lua b/lua/warp/strategy/words.lua index d255203..a42ada0 100644 --- a/lua/warp/strategy/words.lua +++ b/lua/warp/strategy/words.lua @@ -11,13 +11,9 @@ local function split_lines(line) local col_to_chars = {} local run_regex = function(rx, off) - if #alphabet < j then - return - end + if #alphabet < j then return end - if not off then - off = 0 - end + if not off then off = 0 end i = 0 while true do @@ -25,9 +21,7 @@ local function split_lines(line) if i == nil then break end i = i + 1 - if #alphabet < j then - return - end + if #alphabet < j then return end local nextalph = alphabet:sub(j, j) j = j + 1 @@ -38,7 +32,7 @@ local function split_lines(line) run_regex("%W%w") run_regex("%s%S") - run_regex("%w%W", - 1) + run_regex("%w%W", -1) local winstr = "" i = 1 @@ -54,11 +48,11 @@ local function split_lines(line) return winstr, chars_to_col end -M.words_strategy = function () +M.words_strategy = function() local chartab return { - display = function () + display = function() local curpos = vim.api.nvim_win_get_cursor(0) local line_at = vim.fn.getline(curpos[1]) local str, tab = split_lines(line_at) @@ -66,15 +60,13 @@ M.words_strategy = function () return str end, - on_char = function (ch) + on_char = function(ch) if ch == '$' or ch == '^' then vim.cmd("normal! " .. ch) elseif not ch:match('[a-z]') then vim.cmd("normal! f" .. ch) else - if chartab[ch] then - vim.cmd("norma! " .. chartab[ch] .. "|") - end + if chartab[ch] then vim.cmd("norma! " .. chartab[ch] .. "|") end end return false end |