Skip to content

respect dot operator #45

@Konfekt

Description

@Konfekt

: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>"

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