Hot answers tagged

10

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 ...


6

Is there a way to see exactly what shell command is being called out? To see what exactly is run, :echo getpid() 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: :!echo foo and in the terminal running strace see something like: [...


5

It is a little bit faster to use a string expression than a lambda (and arguably easier to understand in this case), call filter(a, 'index(b, v:val)<0') This naive implementation is O(N^2) but is still fairly fast in practice as index() is implemented in C. If you have a very large number of elements in the RHS, it may be faster to use a pre-computed ...


4

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. To summarize: :! always uses &shell (as well as &shellcmdflag, &shellquote, &shellxqoute and so on); :h system() and :h systemlist() use &shell in Vim; in Neovim it ...


3

To keep it simple, I assume all elements are different (i.e. it's "set difference"): :call filter(list1, {_, v -> index(list2, v) < 0})


3

When using a relative path, awk assumes the path is relative to the current directory. In the comments, you note that :pwd gives /home/user; that means you need to give either an absolute path to denorm.awk, or a path relative to /home/user (in general, relative to the :pwd) As far as keeping the existing csv, you should use the filter syntax (:%!awk -f ...


1

It's actually possible to get Vim (7.4) on a Chromebook without using Crostini nor Crouton! You can get it from the Chrome Web Store.


Only top voted, non community-wiki answers of a minimum length are eligible