Compare commits

..

No commits in common. "a11caa4c503f6a76e2ad9d570ec92ea71b32f334" and "88969e03a2fd4b1d378cdb1403d2db91062e5dd9" have entirely different histories.

3 changed files with 0 additions and 30 deletions

View file

@ -1,7 +0,0 @@
-- get directory of this file
local config_dir = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h")
-- prepend it to Lua's search path
package.path = config_dir .. "/?.lua;" .. config_dir .. "/?/init.lua;" .. package.path
require("sentence_lines")

0
lua/.gitkeep Normal file
View file

View file

@ -1,23 +0,0 @@
local function split_sentences_paragraph()
-- save cursor and window view
local view = vim.fn.winsaveview()
-- find the paragraph boundaries
local start_line = vim.fn.search('^\\s*$', 'bnW') + 1
if start_line == 1 then start_line = 1 end
local end_line = vim.fn.search('^\\s*$', 'nW') - 1
if end_line < start_line then end_line = vim.fn.line('$') end
-- build a range and run substitute with 'e' flag
local cmd = string.format("%d,%ds/\\([.?!]\\)\\s\\+/\\1\r/ge", start_line, end_line)
vim.cmd(cmd)
-- restore cursor
vim.fn.winrestview(view)
end
-- run after leaving insert mode
vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
pattern = { "*.md", "*.txt" },
callback = split_sentences_paragraph
})