Closed Luis-Licea closed 2 years ago
I can reproduce this.
When I start nvimpager and list the mapping (map j
) I get:
n j *@<C-E>
n j * <C-E>
and after your map j <c-d>
it shows
n j *@<C-E>
j <C-D>
According to :help map-listing
the @ marks a buffer lokal mapping and that takes precedence over your global mapping. You could unmap <buffer> j
first or you could map <buffer> j <c-d>
to overwrite it.
I will check if nvimpager really needs to define two mappings here.
Thanks. I got the mappings I wanted. The mappings did not work without the <buffer>
specifier as you mentioned above. I also had to map the keys after the configurations were loaded. The events VimEnter
and SourcePost
only worked for the first buffer, but CursorMoved
works no matter how many buffers I open.
" Fast up movement.
au CursorMoved * nnoremap <buffer> j <c-d>
" Fast down movement.
au CursorMoved * nnoremap <buffer> k <c-u>
" Open manual entry.
nnoremap <cr> K
" Slow down movement.
nnoremap J j
" Slow up movement.
nnoremap K k
At first I tried without the <buffer>
specifier, and with the VimEnter
and SourcePost
events, but
I am trying to remap the j, k keys so that instead of moving one line down or up, I can go one page down or up. However, it looks like the j, k keys cannot be remapped to anything. My other remaps work normally.
To reproduce the error:
man man
to access the nvimpager:map j <c-d>
and then:map k <c-u>
to remap j and kThe remap commands for j and k do not work in normal mode, only in visual mode.
Other things I tried that were unsuccessful:
:nmap
,:noremap
, and:nnoremap
instead of:map
.config/nvimpager/init.vim
with nothing else in the file/usr/share/nvimpager/runtime/lua/nvimpager.lua
and commenting out the linesmap('n', 'k', '<C-Y>')
andmap('n', 'j', '<C-E>')
I found one solution, but I do not like it because it changes the source code:
/usr/share/nvimpager/runtime/lua/nvimpager.lua
map('n', 'k', '<C-Y>')
withmap('n', 'k', '<c-u>')
map('n', 'j', '<C-E>')
withmap('n', 'j', '<c->')