nvim: rename functions: my_ -> MY_

This commit is contained in:
tastytea 2022-08-12 22:56:33 +02:00
parent 4c2416563c
commit 1c361ebb4a
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -1,5 +1,5 @@
-- remove trailing whitespace -- remove trailing whitespace
function my_remove_trailing_whitespace() function MY_remove_trailing_whitespace()
local curpos = vim.api.nvim_win_get_cursor(0) local curpos = vim.api.nvim_win_get_cursor(0)
vim.cmd([[keeppatterns %s/\s\+$//e]]) vim.cmd([[keeppatterns %s/\s\+$//e]])
vim.api.nvim_win_set_cursor(0, curpos) vim.api.nvim_win_set_cursor(0, curpos)
@ -14,11 +14,11 @@ vim.api.nvim_create_autocmd(
'*.lua', '*.cpp', '*.lua', '*.cpp',
'*.hpp', '*.conf', '*.cfg', '*.ini' '*.hpp', '*.conf', '*.cfg', '*.ini'
}, },
callback = my_remove_trailing_whitespace callback = MY_remove_trailing_whitespace
} }
) )
function my_insert_modeline() function MY_insert_modeline()
local comment_string = vim.o.commentstring local comment_string = vim.o.commentstring
local space_maybe = '' local space_maybe = ''
if string.match(comment_string, '%%s(.*)') ~= '' then if string.match(comment_string, '%%s(.*)') ~= '' then
@ -55,10 +55,10 @@ function my_insert_modeline()
print('modeline inserted') print('modeline inserted')
end end
end end
vim.cmd([[command! ModelineInsert lua my_insert_modeline()]]) vim.cmd([[command! ModelineInsert lua MY_insert_modeline()]])
-- set colorcolumn to textwidth after buffer is displayed or option is changed -- set colorcolumn to textwidth after buffer is displayed or option is changed
function my_set_colorcolumn() function MY_set_colorcolumn()
if vim.o.textwidth > 0 then if vim.o.textwidth > 0 then
vim.opt_local.colorcolumn = { vim.o.textwidth } vim.opt_local.colorcolumn = { vim.o.textwidth }
else else
@ -70,7 +70,7 @@ vim.api.nvim_create_autocmd(
{ 'BufEnter' }, { 'BufEnter' },
{ {
group = 'config_settings', group = 'config_settings',
callback = my_set_colorcolumn callback = MY_set_colorcolumn
} }
) )
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
@ -78,6 +78,6 @@ vim.api.nvim_create_autocmd(
{ {
group = 'config_settings', group = 'config_settings',
pattern = { 'textwidth' }, pattern = { 'textwidth' },
callback = my_set_colorcolumn callback = MY_set_colorcolumn
} }
) )