Git Product home page Git Product logo

speedtyper.nvim's Introduction

NStefan002's GitHub stats

Top Langs

speedtyper.nvim's People

Contributors

bgerazov avatar gerazov avatar github-actions[bot] avatar ivaknez avatar nstefan002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

speedtyper.nvim's Issues

WPM calculated based on the final words typed

Currently the WPM is estimated as the number of characters typed divided by 5 as an average word length. This makes sense when typing words from a dictionary as they tend to be longer than the average word length. Also it nulls the variation of the WPM based on the specific words selected at the start of the game.

        wpm = (n_chars - n_mistakes) / 5 * (60 / time_sec)
        accuracy = (n_chars - n_mistakes) / n_keypresses * 100

On the other hand, when typing sentences, a more adequate calculation would be to take into account the actual content being typed.

It makes sense to keep both approaches and let the user choose as an option.

Also, currently correcting mistakes in typing isn't taken into account. There can be arguments for and against this but it makes sense to also take this into account.

At the end the WPM and Accuracy should be calculated like so:

        wpm = n_words * (60 / time_sec)
        accuracy = n_correct / n_words * 100

Pause/disable user input when displaying stats for countdown game

It would be nice if the user input is paused for a bit, or even better completely disabled, after the game finishes and the stats are displayed.

Otherwise depending on what word your typing you can edit over the displayed text.

I tried the following:

  1. Pause Neovim using vim.wait(500). This doesn't really work, if it does pause Vim the keypresses are still accumulated sent after the wait.

  2. Turn off modifiable via api.nvim_buf_set_option(0, "modifiable", false), this I think is a good choice but can lead to a bunch of E21: Cannot make changes, 'modifiable' is off. I couldn't find if this can be suppressed at a buffer level..

  3. Prompt user for input, e.g. "Press Enter to continue ..." but vim.fn.input() would open a new prompt. Maybe a custom function could be implemented 🤔

I'm pushing the 2. PR - seems the cleanest.

Ignore if it doesn't make sense 😅 :

Add sentence mode

As per the TODO writing sentences is an important option to have; it is faster than writing random words and is a more adequate measure of writing speed.

netrw text 'merges' with the current buffer text

Description

netrw text 'merges' with the current buffer text after closing the Speedtyper window in which the user tried to open netrw
Screenshot from 2024-01-17 01-33-58

Steps to reproduce

  1. :SpeedTyper
  2. :Ex (netrw is not the buffer 'behind' the Speedtyper window)

Expected behavior

Speedtyper window closes normally and netrw opens up in a normal way (or doesn't open up at all, but the first option makes more sense)

Environment

  • Neovim version: [0.9.5, Nightly]

Choosing text for typing

Describe the problem

Any plans on having a text for typing configurable? Or maybe turning it into real typing tutor?

Describe the solution

I decompiled (freed or stole if you will) lessons from Solo On Keyboard Dvorak Edition and I think we could use it. This is the intellectual property of russians, and they abandoned the blob moving to web version a while ago. Besides, hence they bomb city I live right now I don't see how complain from them merits a response.

Error when closing window

Awesome plugin 😎

After finishing the countdown game when I quit the results window with :q it closes with the following error:

"lua/plugins/speedtyper.lua" 46L, 1731B written
Error detected while processing BufLeave Autocommands for "*":
Error executing lua callback: ...dtyper.nvim/lua/speedtyper/game_modes/countdown/init.lua:48: handle 0x55b742f94050 is already closing
stack traceback:
	[C]: in function 'close'
	...dtyper.nvim/lua/speedtyper/game_modes/countdown/init.lua:48: in function 'stop'
	.../lazy/speedtyper.nvim/lua/speedtyper/game_modes/init.lua:37: in function 'end_game'
	.../lazy/speedtyper.nvim/lua/speedtyper/game_modes/init.lua:25: in function <.../lazy/speedtyper.nvim/lua/speedtyper/game_modes/init.lua:24>

And the cursor remains hidden in the original window.

  • Neovim version: 0.9.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.