Merge branch 'main' into experimental
Lack of branch protection and pre-commit hooks makes for a minor inconvenience. We make silly little mistakes using git :P
This commit is contained in:
commit
dbebdde8c3
4
README.md
Normal file
4
README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# presser.nvim
|
||||||
|
A collection of word processing tools to press over your files easier with UIs.
|
||||||
|
|
||||||
|
For unstable and latest features, see the [experimental](https://git.closedless.xyz/TheOnePath/presser.nvim/src/branch/experimental) branch.
|
||||||
|
|
@ -23,7 +23,7 @@ presser.setup = function ( opts )
|
||||||
{
|
{
|
||||||
nargs = 1,
|
nargs = 1,
|
||||||
complete = function (ArgLead, CmdLine, CursorPos)
|
complete = function (ArgLead, CmdLine, CursorPos)
|
||||||
return { 'find_replace' }
|
return { 'find_replace', 'hyperlink' }
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,32 @@ M.clean_buf = function ( text )
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
return escape_chars( text )
|
return text:match( "^%s*(.-)%s*$" )
|
||||||
:match( "^%s*(.-)%s*$" )
|
end
|
||||||
|
|
||||||
|
|
||||||
|
M.get_selection = function()
|
||||||
|
local _, csrow, cscol, _ = unpack(vim.fn.getpos("'<"))
|
||||||
|
local _, cerow, cecol, _ = unpack(vim.fn.getpos("'>"))
|
||||||
|
if csrow < cerow or (csrow == cerow and cscol <= cecol) then
|
||||||
|
return csrow - 1, cscol - 1, cerow - 1, cecol
|
||||||
|
else
|
||||||
|
return cerow - 1, cecol - 1, csrow - 1, cscol
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
M.subslice = function(line, col)
|
||||||
|
local i = 0
|
||||||
|
local j = 0
|
||||||
|
while true do
|
||||||
|
j = string.find(line, " ", j+1) -- find 'next' newline
|
||||||
|
if j == nil then break end
|
||||||
|
if j > col then break end
|
||||||
|
i = j
|
||||||
|
end
|
||||||
|
|
||||||
|
return { i, j }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user