Take a brief break from current work and use it to speed up your typing speed.
use your favorite plugin manager to install with plenary as dependency:
Plug
Plug 'nagy135/typebreak.nvim'
Plug 'nvim-lua/plenary.nvim'
Packer
use { 'nagy135/typebreak.nvim', requires = 'nvim-lua/plenary.nvim' }
-- with binding
use { 'nagy135/typebreak.nvim',
requires = 'nvim-lua/plenary.nvim',
config = function()
vim.keymap.set('n', '<leader>tb', require('typebreak').start, { desc = "Typebreak" })
end
}
Bind it first! (using setup section bellow), doesnt bind to anything by default.
Pressing bind opens new floating window with words and puts you in insert mode. You can instantly start typing and words are getting highlighted as you type them, then dissapear. Once you type them all, you see summary prompt with stats and option to play again. Close the window whenever you want ctrl + w, q
Bind start function to some key
nnoremap <leader>tb :lua require("typebreak").start()<CR>
vim.keymap.set('n', '<leader>tb', require('typebreak').start, { desc = "Typebreak" })
There is also option to NOT use herokuapp for fetching words. By default we use it but if you wanna use local dictionary instead, you need to do following:
First you simply pass true to start function
require("typebreak").start(true)
Or better, bind it
vim.keymap.set('n', '<leader><leader>tb', function() require('typebreak').start(true) end, { desc = "Typebreak (local dictionary)" })
nnoremap <leader><leader>tb :lua require("typebreak").start(true)<CR>
This uses 200 words long dictionary shipped with plugin.
If you want to extend or replace those words you need to call setup()
any time before calling start()
require('typebreak').setup({
["dictionary"] = {"tik", "tak", "toe"},
-- also boolean flag if you want to replace default ones with your own only
-- ["replace_dictionary"] = true
})