When you use ! or :! Vim builds the invoking command based on whatever is specified in the various 'shell...' settings (i.e. 'shell', 'shellcmdflag', 'shellquote', to name three). On Unix systems the defaults for the first two are usually the default shell ($SHELL) and -c so if I'm using Bash and I do :!foo bar the call Vim makes will look like:
/bin/bash -c ...
Is there a way to see exactly what shell command is being called out?
To see what exactly is run,
will show vim's PID, e.g. 1234, with which you can then in another terminal run:
sudo strace -fe trace=execve -p 1234
then in vim you can use any shell-invoking command like:
and in the terminal running strace see something like:
The command you are trying to use is the following:
% The range: All lines in buffer
s the substitution command
/ / / the separators of the substitution command
\/\/ in the matching pattern you need to escape both slashes
\/ you also need to escape the slash in the replacement string
It is mentioned in direct comments below the question itself. But just in case:
If you use tmux you may need to tweak escape-time. See explanation here and solution here.
set -g escape-time 10
# Or for tmux >= 2.6
set -sg escape-time 10
Do not forget to call tmux source-files ~/.tmux.conf after you change your config.
Also note that Neovim ...
An easy check is :!foo that (probably) will print something like bash: line 1: foo: command not found. Also see :h job_start() (or :h jobstart() for Neovim) and so on.
:! always uses &shell (as well as &shellcmdflag, &shellquote, &shellxqoute and so on);
:h system() and :h systemlist() use &shell in Vim; in Neovim it ...
So I went digging for this one and as far as I can tell this behavior has been present ever since the user-defined command feature was introduced in Vim 5.2.
Initially I thought this was present because a user comand takes its arguments from <...> special sequences, such as <args> or <bang>, which makes it so that it takes <lt> to ...
You can use two single quotes to do this:
let @e = '\\''0<80>kd'
See :help literal-string:
This string is taken as it is. No backslashes are removed or have a special meaning. The only exception is that two quotes stand for one quote.
You could also have done this by using a regular double quoted string. The disadvantage is that ...
As pointed out, this is an encoding problem. The sequence formed by the three bytes 0xe2 (â), 0x80, 0x99 (three bytes denoted by their hexadecimal number) corresponds to the UTF-8 encoding of Unicode character U+2019, which is the Right Single Quotation Mark: ’
You can use the Normal-mode command ga to tell you about the character under the cursor (for ...
(Doesn't look like @filbranden or @AndrewHo-Lee are planning to answer this, so adding a Community Wiki answer with the diagnosis they figured out.)
The problem turned out to be that 'compatible' was set when the mapping was defined.
With this set, the 'cpoptions' setting contains the < flag, which means that Vim will not treat the <Esc> in the ...
The comment above was indeed the solution.
.vimrc now reads as below, probably I can remove some the earlier experiments.
highlight LineNr NONE
hi CursorLine NONE
hi Normal cterm=none ctermfg=none ctermbg=none
Using :substitute to replace end/beginning of line with return got the results OP wanted.
nnoremap o :s/$/\r/ <cr>
nnoremap O :s/^/\r/ <cr>
I can't get just o to be remapped without a recursive error. But a reasonable compromise you might consider from this answer is to use oo for new line. This leaves single o ...
Looks like you adapted this from the regex in the previous question matching *s.
But * is a metacharacter to match 0 or more of the previous token. That means:
You should still use * (not ") after \s to match optional whitespace at the beginning of the line.
You shouldn't use a backslash to escape the ", since " is not a metacharacter. It was ...
To overcome the lagging caused by naive mapping inoremap jk <ESC>. I have written a plugin called better-escape.vim. Here is how to use it:
let g:better_escape_shortcut = 'jk'
let g:better_escape_interval = 200
By default, the time interval threshold for the pressing of j and k is set to 150 ms. That is, if the time interval between pressing k and ...