nvim: fix insert_modeline with empty commentstring, add (no)wrap
This commit is contained in:
parent
298b215c3d
commit
1981113faa
@ -29,6 +29,9 @@ vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
|
||||
-- Insert or update a modeline at the bottom of the buffer
|
||||
function M.insert_modeline()
|
||||
local comment_string = vim.o.commentstring
|
||||
if comment_string == '' then
|
||||
comment_string = '%s'
|
||||
end
|
||||
local space_maybe = ''
|
||||
if string.match(comment_string, '%%s(.*)') ~= '' then
|
||||
space_maybe = ' '
|
||||
@ -47,6 +50,7 @@ function M.insert_modeline()
|
||||
' tw=' .. vim.o.textwidth,
|
||||
' ft=' .. vim.o.filetype,
|
||||
(vim.o.spell and ' spell' .. ' spl=' .. vim.o.spelllang or ''),
|
||||
(vim.o.wrap and ' wrap' or ' nowrap'),
|
||||
':',
|
||||
space_maybe
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user