w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to execute a vim command following by external commands execution?

There are two problems:

  1. The :read ! ... command cannot be concatenated with other Vim commands; it treats all following text as the command to execute. This causes the shell error. See :help :bar. You can fix this by wrapping with :execute.
  2. 's is a normal mode command; to use it in a command-line, you need to prefix the :normal Ex command.
autocmd! BufWritePost <buffer> mark s | execute "$r ! ruby
% | sed 's/^/#=> /' " | normal! 's




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.