Skip to content

kevalin/tomato-timer.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 

Repository files navigation

tomato-timer.nvim

Focus tomato timer πŸ… πŸ•— 🎯

Install

Packer

use { 'Kevalin/tomato-timer.nvim', requires = 'rcarriga/nvim-notify' }

Configuration

You can setup four variables:

  • chunk, it means a long break after running how many rounds. Default value is 4 times.
  • round, it means the time of each focus. Default value is 25 minutes.
  • short_break, it means the time of each short break, and after every focus there is a short break. Default value is 5 minutes.
  • long_break, it means the time of each long break, and after 4 times focus there is a long break. Default value is 15 minutes.
local ok, tomato = pcall(require, 'tomato')
if not ok then return end

tomato.setup({
  chunk = 4,
  round = 25,
  short_break = 5,
  long_break = 15,
})

Usage

To add configuration to lualine, you can edit the require'lualine'.setup function in your init.lua file.

For example, to add a new section to lualine that displays the current git branch, you can add the following code to the require'lualine'.setup function:

lualine.setup {
  options = {
    icons_enabled = true,
    theme = "tokyonight",
    component_separators = { left = "ξ‚±", right = "ξ‚³" },
    section_separators = { left = "ξ‚°", right = "ξ‚²" },
    disabled_filetypes = {},
    always_divide_middle = true,
  },
  sections = {
    lualine_a = { "mode" },
    lualine_b = { "branch", "diff", "diagnostics" },
    lualine_c = {
      { "filename" },
      require('tomato').message
    },
    lualine_x = { "encoding", "fileformat", "filetype" },
    lualine_y = { "progress" },
    lualine_z = { "location" },
  },
  inactive_sections = {
    lualine_a = {},
    lualine_b = {},
    lualine_c = { "filename" },
    lualine_x = { "location" },
    lualine_y = {},
    lualine_z = {},
  },
  tabline = {},
  extensions = {},
}

You can get a timer on your lualine. Like this:

图片

图片

图片

图片

start timer

lua require('tomato').start_round()

Next, It will automatically start the timer in a loop.

reset timer

lua require('tomato').reset()

keymaps

You can also set some shortcut keys, such as my current configuration:

local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }

map('n', '<C-t>', "<cmd>lua require('tomato').start_round()<CR>", opts)
map('n', '<C-r>', "<cmd>lua require('tomato').reset()<CR>", opts)

TODO

  • a control float window
  • a stats html about focus detail data

About

Focus tomato timer πŸ… πŸ•— 🎯

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages