Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 

Repository files navigation

typebreak.nvim

screen

Summary stats Summary stats

Take a brief break from current work and use it to speed up your typing speed.

Install

Use your favorite plugin manager to install it. The refreshed version uses current Neovim APIs and targets Neovim 0.10+.

Plug

Plug 'nagy135/typebreak.nvim'

Packer

use { 'nagy135/typebreak.nvim' }

-- with binding

use { 'nagy135/typebreak.nvim',
    config = function()
        vim.keymap.set('n', '<leader>tb', require('typebreak').start, { desc = "Typebreak" })
    end
}

Usage

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

Setup

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" })

Custom dictionary

By default it tries to fetch random words from a remote API and falls back to the shipped local dictionary if that fails. If you want to force the local dictionary, 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
})

About

Quick type exercise in floating buffer

Resources

Stars

34 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages