Skip to content

paredit conflicts with leader when leader set to space #19

@mnebuerquo

Description

@mnebuerquo

When you set your leader to space, paredit gets confused and key mappings don't work correctly.

I have this line of code at the top of my vimrc to set my leader to space:

:let mapleader = " "

This is a problem for paredit, because when I add the plugin it has trouble mapping its keys. I first thought it was a problem with the g:paredit_shortmaps because it remapped my O key.

As it turns out, setting mapleader to space results in the following line of code inserting a space into the string, which doesn't work:

call RepeatableNNoRemap(g:paredit_leader . 'O', ':<C-U>call PareditSplit()') 

https://github.com/kovisoft/paredit/blob/0.9.11/plugin/paredit.vim#L185

To work around this issue I set the g:paredit_leader variable explicitly to <leader> so it doesn't try its own leader logic:

let g:paredit_leader = '<leader>'

This causes paredit to skip its own leader logic, because the variable is already set.
https://github.com/kovisoft/paredit/blob/0.9.11/plugin/paredit.vim#L48-L55

This works, but it required me to read through a bunch of code to figure out what was going on. I think this could be made easier, maybe by detecting that mapleader is set to " " or using <leader> instead of the string in mapleader in the key binding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions