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?

+3


source to share


3 answers


Eureka!

Just skip two lines:



"+call cursor($(CurLine), $(CurCol));" "+call Embiggen()"

      

+5


source


It might be easier to find a solution if you used an alternative, more conventional syntax: -c "cmd"

instead "+cmd"

. According to :help -c

you, you can transfer up to 10 of them.



+1


source


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.

0


source







All Articles