<C-6>
is a normal mapping (I guess you want to switch to alternate buffer).
But the way you call it is incorrect -- calling it as an ex-command. Normal mode commands in vimscript should be called with :normal! sequenceofkeypresses
. For <C-6>
it would be :normal ^^
where ^^
is generated by pressing <C-v><C-6>
. Even more, with normal
you would have issues using <bar>
and would have to wrap it into :exe "normal ..."
as described in :h :normal
.
Having said this, it would be way easier to use b#
command to do the same...
nnoremap <silent><Leader>bd :b#<Bar>bd#<CR>
:b#
is short for :buffer #
-- switch to alternate buffer.
And to answer your direct question you can map it like this:
nnoremap <silent><leader>bd <C-6>:bd #<CR>
Note
nnoremap
is used instead of noremap
-- map only for normal mode. I doubt you want this mapping to work in insert/select/visual modes. If you do, then you have to change it per mode (they should be slightly different)
<C-6>
is executed in the same normal mode, so no normal
ex command is needed