remove linebreaks user fun
This commit is contained in:
parent
d2309ca00a
commit
b019fc12d2
1 changed files with 17 additions and 8 deletions
|
|
@ -22,7 +22,7 @@ vim.opt.wrap = false
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'Makefile',
|
pattern = 'Makefile',
|
||||||
callback = function ()
|
callback = function()
|
||||||
vim.opt_local.expandtab = false
|
vim.opt_local.expandtab = false
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
@ -33,12 +33,21 @@ vim.opt.updatetime = 500
|
||||||
vim.opt.colorcolumn = '80'
|
vim.opt.colorcolumn = '80'
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('BufReadPost', {
|
vim.api.nvim_create_autocmd('BufReadPost', {
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local valid_line = vim.fn.line([['"]]) >= 1 and vim.fn.line([['"]]) < vim.fn.line('$')
|
local valid_line = vim.fn.line([['"]]) >= 1 and vim.fn.line([['"]]) < vim.fn.line('$')
|
||||||
local not_commit = vim.b[args.buf].filetype ~= 'commit'
|
local not_commit = vim.b[args.buf].filetype ~= 'commit'
|
||||||
|
|
||||||
if valid_line and not_commit then
|
if valid_line and not_commit then
|
||||||
vim.cmd([[normal! g`"]])
|
vim.cmd([[normal! g`"]])
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('RemoveLinebreaks',
|
||||||
|
function(opts)
|
||||||
|
local startline = opts.line1
|
||||||
|
local endline = opts.line2
|
||||||
|
local rangespec = startline .. "," .. endline
|
||||||
|
vim.cmd(rangespec .. "s/ \\?\\n \\?/ /g")
|
||||||
|
end,
|
||||||
|
{ range = true })
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue