joshuadanpeterson / typewriter.nvim

A Neovim plugin that emulates a typewriter, keeping the cursor centered on the screen for a focused writing experience.
MIT License
23 stars 0 forks source link

BUG - Breaks default nvim behaviour which retains column when moving between lines #16

Closed Ajaymamtora closed 1 month ago

Ajaymamtora commented 1 month ago

When moving between lines with j and k, and:

1) the next line has a shorter length than the current column 2) then the cursor moves to the end of the line. 3) when moving to the next line which has enough columns for the original cursor position (from 1)) -- vim will set it to that column instead of the max length of the previous line.

Step 3 is broken, which means the cursor follows this path:

image

Instead of:

image

Hopefully that makes sense

I've tried changing the config but its broken no matter what i set horizontal scroll and keep cursor position to:

modules["joshuadanpeterson/typewriter"] = {
  dependencies = {
    'nvim-treesitter/nvim-treesitter',
  },
  version = false,
  config = editor_config.typewriter,
}

....

function config.typewriter()
  local opts = {
    enable_horizontal_scroll = false,
    keep_cursor_position = true,
  }
  require("typewriter").setup(opts)
  vim.cmd(":TWEnable")
end
joshuadanpeterson commented 1 month ago

@Ajaymamtora Just issued a patch. Try it now and see what you think

Ajaymamtora commented 1 month ago

@Ajaymamtora Just issued a patch. Try it now and see what you think

Thank you, seems to works perfectly!