First commit

This commit is contained in:
Yann 2022-01-26 15:17:48 +01:00
commit fac5782b20
4 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,9 @@
local function greet()
print('My lord?')
local pos = vim.api.nvim_win_get_cursor(0)[2]
local line = vim.api.nvim_get_current_line()
local nline = line:sub(0, pos) .. 'hello' .. line:sub(pos + 1)
vim.api.nvim_set_current_line(nline)
end
return greet

5
lua/greetings/init.lua Normal file
View File

@ -0,0 +1,5 @@
local greet = require('greetings.greetings')
return {
greet = greet
}

1
lua/test.lua Normal file
View File

@ -0,0 +1 @@

34
plugin/crown.vim Normal file
View File

@ -0,0 +1,34 @@
" if exists('g:loaded_crown')
" finish
" endif
" ! : Redefini la fonction quand le fichier est relu
function! ReloadPlugin()
" Les paquets sont en caches, le passer à nil, permet qu'il soit rechargé de
" zéro au prochain appel
" Attention à ne pas mettre d'espace devant lua et EOF
lua << EOF
for k in pairs(package.loaded) do
if k:match("^greetings")
then package.loaded[k] = nil
end
end
require("greetings")
EOF
endfunction
command! Greet lua require'greetings'.greet()
augroup ReloadingGroup
autocmd!
au BufWritePost * :call ReloadPlugin()
augroup END
" command! ColorizerDetachFromBuffer lua require'colorizer'.detach_from_buffer(0)
" command! ColorizerReloadAllBuffers lua require'colorizer'.reload_all_buffers()
" command! ColorizerToggle lua local c = require'colorizer'
" \ if c.is_buffer_attached(0) then c.detach_from_buffer(0) else
" \ c.attach_to_buffer(0) end
" let g:loaded_crown = 1