1

The vim version on my Mac is 8.1.1000, installed by homebrew:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Mar 11 2019 08:36:53)
macOS version
Included patches: 1-1000
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     +tag_old_static
+arabic            -farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +textprop
+byte_offset       -hangul_input      +num64             +timers
+channel           +iconv             +packages          +title
+cindent           +insert_expand     +path_extra        -toolbar
-clientserver      +job               +perl              +user_commands
+clipboard         +jumplist          +persistent_undo   +vartabs
+cmdline_compl     +keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      +langmap           +profile           +visual
+comments          +libcall           -python            +visualextra
+conceal           +linebreak         +python3           +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          +rightleft         +wildmenu
+cursorshape       +lua               +ruby              +windows
+dialog_con        +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             -X11
+digraphs          +modify_fname      +smartindent       -xfontset
-dnd               +mouse             +startuptime       -xim
-ebcdic            -mouseshape        +statusline        -xpm
+emacs_tags        +mouse_dec         -sun_workshop      -xsmp
+eval              -mouse_gpm         +syntax            -xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
   system vimrc file: "$VIM/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: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.28.1/lib/perl5/5.28.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.6     

It's strange that I cannot map <C-S> to any thing, for example, nnoremap <C-S> dd, or map <C-S> echom<Space>'hi'<CR>, nothing happens, the information from :map is

n  <C-S>       * dd

When I change <C-S> to <C-P>, it's working well, (however the result of :map is still n <C-P> * dd, still un-remappable? but it's working)

chrisyue
  • 203
  • 2
  • 5
  • Have a look at how to debug a mapping also saying "I can't map <C-s> to anything" will not let us help you. nnoremap <C-s> :echo "foo"<CR> works perfectly fine for me for example. – statox Mar 20 '19 at 09:03
  • Have you tried verbose map <C-s> to see what is remapping the key? – statox Mar 20 '19 at 09:16
  • @statox it shows n <C-S> * dd Last set from ~/.vim/vimrc line 29. after I add verbose, and I do map <C-S> in vimrc line 29 – chrisyue Mar 20 '19 at 09:18
  • So it's your own vimrc file which create this mapping at the line 29 right? Have you tried deleting the line 29 of your vimrc file located at ~/.vim/vimrc? EDIT Oh wait you are saying that map shows the correct mapping but when you press <C-s> it doesn't delete the line? – statox Mar 20 '19 at 09:19
  • @statox well, after I remove it from my vimrc, verbose map <C-S> says No mapping found – chrisyue Mar 20 '19 at 09:21
  • @statox yes you are right, neither it deletes a line (map to dd), nor echoes 'hi' (map to echom<Space>'hi'<CR>), however <C-P> works, so I think the problem is related to <C-S> only, not mapping – chrisyue Mar 20 '19 at 09:30
  • Well you could check the section "Check if your mapping is actually intercepted by Vim" of the answer I liked before. It seems like the keycode can't reach Vim. You should also specify which terminal emulator you're using and try to see if it's a known issue. – statox Mar 20 '19 at 10:28
  • Open Vim and enter insert mode. Than hit <C-V> followed by <C-S>. See what is displayed. If nothing happens, then <C-S> does not reach Vim. If you can't do anything afterwards (Vim seems dead), then see this question. – Ralf Mar 20 '19 at 10:52
  • suspends your terminal. I have these lines in my .vimrc silent !stty -ixon
    autocmd VimLeave * silent !stty ixon to resolve it.
    – Alex Kroll Mar 20 '19 at 13:31
  • 1
    @AlexKroll this is likely the correct answer. Please post it as such. – D. Ben Knoble Mar 20 '19 at 14:19
  • Here is a descriptive answer to what causes this behaviour. And I think using bash itself to do this is better, because for some reason (version conflict or something) vim might give out errors, you know, one of those times when the errors keep coming and you can't do anything except exit. Then it might be a problem because VimLeave autocmd's wouldn't have been executed. So, might be the terminal itself should be customized, not from vim – 3N4N Mar 20 '19 at 14:31

0 Answers0