gaoDean / autolist.nvim

Automatic list continuation and formatting for neovim, powered by lua
MIT License
248 stars 6 forks source link

Cursor movement when revising in normal mode #69

Closed ted1277 closed 1 year ago

ted1277 commented 1 year ago

Thank you for this great plugin!

I find that when make revision in normal mode, such as using operation x to delete a character, the cursor is moved to the end of the line after the operation. This behavior doesn't occur when I disable the autocmd autolist.force_recalculate.

While automatically recalculating list numbers is very useful, the cursor movement after each modification makes revisions inconvenient (the cursor is moved to the end of the line right after operations like x and r). Am I configuring the plugin incorrectly, or is this behavior intentional?

gaoDean commented 1 year ago

yeah, i think I'll just disable that, and have semi-manual renumbering like in org-mode.

gaoDean commented 1 year ago

Hi, how's this readme config:

{
  "gaoDean/autolist.nvim",
  ft = {
    "markdown",
    "text",
    "tex",
    "plaintex",
  },
  config = function()
    local autolist = require("autolist")
    autolist.setup()
    autolist.create_mapping_hook("i", "<CR>", autolist.new)
    autolist.create_mapping_hook("i", "<Tab>", autolist.indent)
    autolist.create_mapping_hook("i", "<S-Tab>", autolist.indent, "<C-D>")
    autolist.create_mapping_hook("n", "o", autolist.new)
    autolist.create_mapping_hook("n", "O", autolist.new_before)
    autolist.create_mapping_hook("n", ">>", autolist.indent)
    autolist.create_mapping_hook("n", "<<", autolist.indent)
    autolist.create_mapping_hook("n", "<leader>r", autolist.force_recalculate)
    autolist.create_mapping_hook("n", "<leader>x", autolist.invert_entry, "")

    -- optional, recalculate when deleting line
    autolist.create_mapping_hook("n", "dd", autolist.force_recalculate)
  end,
},
gaoDean commented 1 year ago

Actually, I think I'll direct this to #33, since its the same issue.