Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable <cr> mapping #105

Open
mangkoran opened this issue Jun 21, 2023 · 3 comments
Open

Disable <cr> mapping #105

mangkoran opened this issue Jun 21, 2023 · 3 comments

Comments

@mangkoran
Copy link

mangkoran commented Jun 21, 2023

First of all, thank you for keeping this plugin maintained. I started to write in Latex and this plugin helped me so much.

I have an issue with the plugin's <cr> mapping. Currently it is in conflict with my nvim-cmp. Every time I want to insert the completion's suggestion, vim-pencil will also trigger the undo feature (I'm not pretty sure).

How can I disable vim-pencil built-in <cr> mapping?

Related #43

wezterm-gui_HrHWfpP8Kw.mp4
@mangkoran
Copy link
Author

Just some suggestions, how if we make the mapping (and "enhanced" undo feature which do the key remapping) optional? Users would have the choice to whether to enable the "enhanced" undo or not.

@reedes
Copy link
Collaborator

reedes commented Jun 23, 2023

This cr conflicting mapping issue came up several years ago. (Should be somewhere in issue history.)

The solution then was to only remap cr if the key was not yet mapped.

Does the remap of cr still occur if pencil is initialized AFTER your plugin is loaded?

Edit: removed brackets from cr

@mangkoran
Copy link
Author

mangkoran commented Jun 24, 2023

Thank you for your reply.

This cr conflicting mapping issue came up several years ago. (Should be somewhere in issue history.)

I suppose it's #43. I linked it in my first post above :)

Does the remap of cr still occur if pencil is initialized AFTER your plugin is loaded?

I will try to check for this but just FYI I lazy-load nvim-cmp on InsertEnter event as I'm using LazyVim, which has this config. So vim-pencil will always loaded before nvim-cmp unfortunately 😔

Friendly cc @folke if loading vim-pencil on ft latex and after nvim-cmp is loaded is possible. My current config for this plugin is below.

{
  "preservim/vim-pencil",
  dependencies = { -- not really sure if this is correct
    "hrsh7th/nvim-cmp",
  },
  config = function()
    vim.g["pencil#autoformat"] = 1
    vim.g["pencil#textwidth"] = 100
    vim.g["pencil#wrapModeDefault"] = "hard"
    vim.fn["pencil#init"]({ wrap = "hard" })
  end,
  ft = {
    "mkd",
    "markdown",
    "tex",
    "latex",
  },
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants