diff --git a/lua/timer.lua b/lua/timer.lua new file mode 100644 index 0000000..aae88a5 --- /dev/null +++ b/lua/timer.lua @@ -0,0 +1,30 @@ +local augroup = vim.api.nvim_create_augroup("ScratchBuffer", { clear = true }) + + +local function focus_gained() + print("Huiii Fokus") +end + +local function focus_lost() + print("Hokus pokus fort ist der fokus") +end + +local function main() + print("Hello from our plugin") + print(os.time()) +end +local function setup() + vim.api.nvim_create_autocmd("VimEnter", + { group = augroup, desc = "Set a fennel scratch buffer on load", once = true, callback = main }) + vim.api.nvim_create_user_command( + 'Timer', -- The name of the command (accessible via :TimerStart) + function() + print("Timer started!") -- The function executed when the command is called + end, + { nargs = 0 } -- No arguments for this command (you can configure this later) + ) + vim.api.nvim_create_autocmd("FocusGained", { callback = focus_gained }) + vim.api.nvim_create_autocmd("FocusLost", { callback = focus_lost }) +end + +return { setup = setup } diff --git a/lua/timer/init.lua b/lua/timer/init.lua deleted file mode 100644 index 11cbe70..0000000 --- a/lua/timer/init.lua +++ /dev/null @@ -1,12 +0,0 @@ --- Creates an object for the module. All of the module's --- functions are associated with this object, which is --- returned when the module is called with `require`. -local M = {} - -function M.greet() - print("Hello World") -end - --- Routes calls made to this module to functions in the --- plugin's other modules. -return M diff --git a/plugin/timer.vim b/plugin/timer.vim deleted file mode 100644 index 31f0358..0000000 --- a/plugin/timer.vim +++ /dev/null @@ -1,19 +0,0 @@ -" Title: Example Plugin -" Description: A plugin to provide an example for creating Neovim plugins. -" Last Change: 8 November 2021 -" Maintainer: Example User - -" Prevents the plugin from being loaded multiple times. If the loaded -" variable exists, do nothing more. Otherwise, assign the loaded -" variable and continue running this instance of the plugin. -if exists("g:loaded_exampleplugin") - finish -endif -let g:loaded_exampleplugin = 1 - -" Defines a package path for Lua. This facilitates importing the -" Lua modules from the plugin's dependency directory. -let s:lua_rocks_deps_loc = expand(":h:r") . "/../lua/example-plugin/deps" -exe "lua package.path = package.path .. '" -" Exposes the plugin's functions for use as commands in Neovim. -command! -nargs=0 Greet lua require("example-plugin").greet()