pendulum
is a simple timer plugin for Neovim designed to assist competitive programmers or coders in general who wants to practice coding for interviews.
This becomes crucial for increasing the coding speed and efficiency while enhancing the quality of the code.
pendulum
helps you to get zoned in your coding session and have a productive session out of it.
demo.mov
- Set timer for a specified duration ⏲️
- Pause and resume the timer ⏯️
- Stop the timer permanently 🛑
- Restart the timer 🔄
- Select from predefined timer templates to kick start timer 📎
- Create your own custom timer and with one kepmap start it right away 🚀
- Display the timer lualine (if installed) ➖
pendulum
is a very minimialistic timer plugin to create a productive session using the timer.
More improvements is on its way.
Future implementations
-
Added support for minutes and seconds -
Templates selection -
Custom timer -
Add timer for lualine with configuration - Anything if comes in mind
NVIM >= v0.9.0
Install the plugin with your preferred package manager:
Lazy
-- lazy.nvim
{
"SunnyTamang/pendulum.nvim",
config = function()
require"pendulum".setup({
lualine = true, --Enables displaying the timer in Lualine (if lualine installed)
})
end
}
Plug
-- vim-plug
call plug#begin()
Plug 'SunnyTamang/pendulum.nvim'
call plug#end()
lua require("pendulum").setup({
lualine = true, --Enables displaying the timer in Lualine (if lualine installed)
})
Packer
use {
'SunnyTamang/pendulum.nvim',
config = function()
require('pendulum').setup({
lualine = true, -- Enables displaying the timer in Lualine (if lualine installed)
})
end
}
:TimerStart <some number>
starts the timer:TimerPause
pause the timer:TimerResume
resumes the timer from where it was paused:TimerStop
stops the timer:TimerRestart
restarts the timer with the last used start time:TimerTemplate
select any predefined timer templates to kick start:StartYourCustomTimer
start the timer with the already set value in custom options from templates options
Alternatively, you can also use Lua equivalents.
vim.keymap.set('n', 'timer' , ':TimerStart<CR>', { desc = 'Start the timer', callback = start_timer_with_prompt, noremap = true, silent = true })
vim.keymap.set('n', '<leader>ts', ':TimerStop<CR>', { desc = 'Stop the timer' })
vim.keymap.set('n', '<leader>tp', ':TimerPause<CR>', { desc = 'Pause the timer' })
vim.keymap.set('n', '<leader>tr', ':TimerResume<CR>', { desc = 'Resume the timer' })
vim.keymap.set('n', '<leader>tre', ':TimerRestart<CR>', { desc = 'Restart the timer' })
vim.keymap.set('n', '<leader>tt', ':TimerTemplate<CR>', { desc = 'select timer template' })
vim.keymap.set('n', '<leader>sct', ':StartYourCustomTimer<CR>', { desc = 'start your custom timer'})