Getting weird error when launching Fern
yatesco opened this issue · 2 comments
Environment (please complete the following information):
-
OS: macOS (latest)
-
(Neo)Vim version:
IM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 23 2023 15:52:48)
macOS version - x86_64
Included patches: 1-1897
Compiled by MacPorts
Huge version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_urxvt -tag_any_white
+arabic +find_in_path +mouse_xterm -tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
-balloon_eval +fork() +netbeans_intg +termresponse
+balloon_eval_term +gettext +num64 +textobjects
-browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand -perl +title
+channel +ipv6 +persistent_undo -toolbar
+cindent +job +popupwin +user_commands
-clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall -python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
-cscope +localmap -ruby +wildignore
+cursorbind +lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con +mksession +smartindent +writebackup
+diff +modify_fname -sodium -X11
+digraphs +mouse +sound -xfontset
-dnd -mouseshape +spell -xim
-ebcdic +mouse_dec +startuptime -xpm
+emacs_tags -mouse_gpm +statusline -xsmp
+eval -mouse_jsbterm -sun_workshop -xterm_clipboard
+ex_extra +mouse_netterm +syntax -xterm_save
+extra_search +mouse_sgr +tag_binary
-farsi -mouse_sysmouse -tag_old_static
system vimrc file: "/opt/local/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -DMACOS_X -DMACOS_X_DARWIN -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch x86_64 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch x86_64 -o vim -lm -lncurses -liconv -lintl -framework AppKit -L/opt/local/lib -llua
- vim-which-key version: 08cf520
- Have you reproduced with a minimal vimrc: YES
let g:mapleader = "\<Space>"
let g:maplocaleader = ','
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
set timeoutlen=500
" additional iterators for tabs
nmap T] :tabnew<CR>
nmap [t :tabprevious<CR>
nmap ]t :tabnext<CR>
nnoremap <BS> <C-^>
" DO NOT map jk to ESC, use C-[ instead ;-)
let g:which_key_map = {
\ ' ' : [':', ':'],
\ 'P' : ['Fern . -drawer -reveal=% -toggle -width=35<CR>', 'Fern'],
\ }
call which_key#register('<Space>', "g:which_key_map")
Describe the bug
Using the above, executing <space>P
shows the following error: [which-key] <Space> - is undefined
AND the character under the cursor is replaced with n
(!).
If I remove <CR>
from the which_key_map
:
let g:which_key_map = {
\ ' ' : [':', ':'],
\ 'P' : ['Fern . -drawer -reveal=% -toggle -width=35', 'Fern'],
\ }
then nothing happens.
I can confirm that Fern . -drawer -reveal=% -toggle -width=35
in the command area opens Fern as I would expect.
To Reproduce
Steps to reproduce the behavior:
- Create the minimal vimrc
min.vim
:
set nocompatible
set runtimepath^=/path/to/vim-which-key
syntax on
filetype plugin indent on
let g:mapleader = "\<Space>"
let g:maplocaleader = ','
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
set timeoutlen=500
" additional iterators for tabs
nmap T] :tabnew<CR>
nmap [t :tabprevious<CR>
nmap ]t :tabnext<CR>
nnoremap <BS> <C-^>
" DO NOT map jk to ESC, use C-[ instead ;-)
let g:which_key_map = {
\ ' ' : [':', ':'],
\ 'P' : ['Fern . -drawer -reveal=% -toggle -width=35<CR>', 'Fern'],
\ }
call which_key#register('<Space>', "g:which_key_map")
-
Start (neo)vim with command:
vim -u min.vim
-
Type
<space>P
-
See error
Expected behavior
Fern should open correctly without the <CR>
.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
It should work by adding :
before Fern . -drawer -reveal=% -toggle -width=35<CR>
. Tested locally, let me know if this does not work for you.
let g:which_key_map = {
\ ' ' : [':', ':'],
\ 'P' : [':Fern . -drawer -reveal=% -toggle -width=35<CR>', 'Fern'],
\
works fine - thank you! I'm not clear on when the ':' is needed or not...