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

Customize default key mapping #269

Open
Anfid opened this issue Nov 9, 2018 · 3 comments
Open

Customize default key mapping #269

Anfid opened this issue Nov 9, 2018 · 3 comments

Comments

@Anfid
Copy link

Anfid commented Nov 9, 2018

Hello. Is there an option in this plugin to change the default mappings to a different ones? I use 's' key as back motion (vanilla 'b') and would really like not to sacrifice combinations like ds, ys etc. in favor of this plugin.

@graywh
Copy link

graywh commented Dec 17, 2018

Take a look at https://github.com/tpope/vim-surround/blob/master/plugin/surround.vim#L590 to see how the maps are defined. You can define your own in your .vimrc or some other script and disable the default maps by let g:surround_no_mappings=1

@Anfid
Copy link
Author

Anfid commented Dec 19, 2018

Thank you for your help. Then I think it is a documentation issue. I think it should be mentioned in the docs or readme

@gerardbm
Copy link

What if I want to change this line: https://github.com/tpope/vim-surround/blob/master/plugin/surround.vim#L140

Default: let pairs = "b()B{}r[]a<>"

For tihs: let pairs = "b()c{}s[]a<>"

So the s works for deleting (dss), for changing (cssb), for inserting (Ss), and so on.

I tried to remap with this: let b:surround_{char2nr('s')} = "[\r]", however I still have to use the r.

Is it possible to change deeply the default keymapping? Thanks.

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

3 participants