Can I call multiple functions when starting Vim?
I often send files to Vim from Visual Studio. I configured it as an external tool with the following parameter:
"+call cursor($(CurLine), $(CurCol))"
However, I also want to be able to call my own function. When I edit a file from VS I want the window to be large, so I expected to be able to do something like this:
"+call cursor($(CurLine), $(CurCol)); +call Embiggen()"
However, this doesn't work. I have tried several options (eg, , call Embiggen()
etc.).
Obviously, I could write my own function PlaceCursorAndEmbiggen
, but I really don't want to. Is there a way to call multiple functions when Vim starts up?
source to share
These exact commands can be combined into one using the pipe symbol:
"+call cursor($(CurLine), $(CurCol)|call Embiggen()"
... There is a lot more that can be combined this way, but some, for example, :normal
cannot use @ Ingo Karkats or their own answer for them. If you are short * on + commands and still don't want to create a file .vim
, you can use either:execute
vim -c "execute 'normal! 1' | execute 'normal! 2'"
or (bash / zsh) -S
with process replacement:
vim -S <(echo '
normal! 1
normal! 2
')
... Most of the time, though, it's best to just create the .vim
.
* You can send up to 10 +
or -c
(they are equivalent and do not count separately) and 10 others --cmd
, although the letter is less useful.
source to share