pendulum.nvim
August 22, 2024 ยท View on GitHub
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.
https://github.com/user-attachments/assets/1c9c6452-87aa-47f5-a8c8-5c3f016ce20f
Features ๐ฅ
- 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) :heavy_minus_sign:
Status ๐ทโโ๏ธ
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
Requirements ๐ฐ
NVIM >= v0.9.0
Installation ๐คพโโ๏ธ
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
}
Usage
:TimerStart <some number>starts the timer:TimerPausepause the timer:TimerResumeresumes the timer from where it was paused:TimerStopstops the timer:TimerRestartrestarts the timer with the last used start time:TimerTemplateselect any predefined timer templates to kick start:StartYourCustomTimerstart 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'})