summaryrefslogtreecommitdiff
path: root/lua/warp/strategy/words.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-03-10 23:54:24 -0600
committerJosh Rahm <joshuarahm@gmail.com>2024-03-10 23:54:24 -0600
commit183241c17a246ab97c60f78bbd4adc6b40cc9016 (patch)
tree13d7c66ecb267ac42800d813844cebeb1d0587c9 /lua/warp/strategy/words.lua
parent2aff69b0bb55f398d199db687617ed35d0335d5b (diff)
downloadnvim-warp-183241c17a246ab97c60f78bbd4adc6b40cc9016.tar.gz
nvim-warp-183241c17a246ab97c60f78bbd4adc6b40cc9016.tar.bz2
nvim-warp-183241c17a246ab97c60f78bbd4adc6b40cc9016.zip
run lua-format.
Diffstat (limited to 'lua/warp/strategy/words.lua')
-rw-r--r--lua/warp/strategy/words.lua24
1 files changed, 8 insertions, 16 deletions
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