Practice coding on neovim to boost your productivity
CPM means characters per minute (similar measurement to words per minute). I used CPM instead of WPM to produce more accurate results since the concept of "words" in programming languages isn't clear.
keylab.nvim aims to aid new neovim users to boost their productivity by practicing their keybinding configurations multiple times. When used enough times, improvements in typing ability are noticeable.
keylab.nvim also serves as a plugin to measure the user's coding speed. Similar to https://www.speedtyper.dev/ (by codicocodes)
, except this has custom scripts and your personal vim configuration as possible options. Measure your true coding speed on neovim and aim for even higher results. All languages supported by your neovim configuration, are also supported.
- Customizable configuration and setup
- Simple mechanics and free controls (easy-to-use)
- Multilingual support
- Clean documentation
- Efficient & optimized plugin
To use keylab effectively, I would suggest 3-5 practice sessions everyday before you get into work. Try to beat your past session in every session you play and keep your average CPM high. In less than a week's time, you will realise how much you have improved over a short time period.
My biggest improvements were: being able to locate and press weird keys (like ">(#{") without having to look at the keyboard. I also saw a decent increase in accuracy which means I don't mess up on weird keys that often anymore.
To start a session, you can use :KeylabStart
or use the preferred keybinding you used in your nvim configuration setup.
This will open up a script window (script excerpt) and a blank window (typing playground). The goal is to copy the script into the blank window as fast as possible. Your typing speed will be measured and recorded for you.
After you finish copying the excerpted script into the typing playground window
, the windows will close an open a separate individual window with the measured statistics of your performance of the current session.
These statistics will be measured for quality of usage and the measured data can be reset very easily using :KeylabClearPerf
Press q
to quit the current keylab session and CR
to start a new session with the same buffer of the excerpted script.
The excerpted script won't necessarily be the same.
:KeylabStart
: Start a keylab session:KeylabStop
: Stops a keylab session:KeylabClearPerf
: Clear the performance database and reset all data. (Lost data can't be restored so use it carefully):keylabReload
: Reloads keylab in the current neovim instance (more useful for contribtors)
Make sure to check you have nvim >= 0.9
(with nvim -v
) for full lua support.
Keylab also requires plenary.nvim dependencies to store performance data and development testing (in case you want to contribute).
If you are using telescope.nvim, you have probably already installed plenary dependencies before which means you won't have to install it again.
Use your plugin manager of choice to install keylab after checking the prerequisites:
Packer
- Paste the following template in your
vimrc
file:return require('packer').startup(function(use) use { 'BooleanCube/keylab.nvim', requires = 'nvim-lua/plenary.nvim' } -- without plenary.nvim use 'BooleanCube/keylab.nvim' end)
- Run
:PackerInstall
in neovim to install the plugin.
Vim-Plug
- Paste the following template in your
vimrc
file:call plug#begin() Plug 'BooleanCube/keylab.nvim' " ignore if you don't need plenary.nvim Plug 'nvim-lua/plenary.nvim' call plug#end()
- Run
:PlugInstall
in neovim to install the plugin
Vundle
- Paste the following template into your
vimrc
file:call vundle#begin() Plugin 'BooleanCube/keylab.vim' " ignore if you don't need plenary.nvim Plugin 'nvim-lua/plenary.nvim' call vundle#end()
- Run
:PluginInstall
in neovim to install the plugin
-
Plugin configuration with Lua:
local keylab = require("keylab") keylab.setup({ lines = 15, -- 10 by default force_accuracy = false, -- true by default correct_fg = "#FFFFFF", -- #B8BB26 by default wrong_bg = "#000000" -- #FB4934 by default })
-
Plugin configuration with Vimscript:
" idk vimscript lmfao lua << EOF local keylab = require("keylab") keylab.setup({ lines = 10, force_accuracy = true, correct_fg = "#B8BB26", wrong_bg = "#FB4934" }) EOF
-
Keybinding the start function in Lua:
vim.keymap.set('n', '<leader>kl', require('keylab').start, { desc = "Start a keylab session" }) vim.keymap.set('n', '<leader>ks', require('keylab').close_game, { desc = "Stop a keylab session" })
-
Keybinding the start function in Vimscript:
nnoremap <silent> <leader>kl :KeylabStart<cr> nnoremap <silent> <leader>ks :KeylabStop<cr>
"The only way to learn a new programming language is by writing programs in it."
- Dennis Ritchie
Created by BooleanCube ;]