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

respect dot operator #45

Open
Konfekt opened this issue Jul 6, 2018 · 0 comments
Open

respect dot operator #45

Konfekt opened this issue Jul 6, 2018 · 0 comments

Comments

@Konfekt
Copy link

Konfekt commented Jul 6, 2018

:help i_CTRL-G_U gives examples of movement mappings in insert mode that respect the dot operator, for example <home>, <end>, <left>, <right>. How about vim-rsi piggybacking on these, for example,

inoremap <expr> <C-A> col('.') == match(getline('.'), '\S') + 1 ?
                      \ repeat('<C-G>U<Left>', col('.') - 1) :
                      \ (col('.') < match(getline('.'), '\S') ?
                      \     repeat('<C-G>U<Right>', match(getline('.'), '\S') + 0) :
                      \     repeat('<C-G>U<Left>', col('.') - 1 - match(getline('.'), '\S')))
inoremap <expr> <C-E> col('.')>strlen(getline('.'))<bar><bar>pumvisible()?"\<Lt>C-E>":repeat("\<Lt>C-G>U\<Lt>Right>", col('$') - col('.'))
inoremap <expr> <C-B> getline('.')=~'^\s*$'&&col('.')>strlen(getline('.'))?"0\<Lt>C-D>\<Lt>Esc>kJs":"\<Lt>C-G>U\<Lt>Left>"
inoremap <expr> <C-F> col('.')>strlen(getline('.'))?"\<Lt>C-F>":"\<Lt>C-G>U\<Lt>Right>"
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

1 participant