Vim cli: Difference between revisions

From wikinotes
 
Line 21: Line 21:
</source>
</source>


You can also pass a script-file in
You can also pass a script-file in of vim-commands
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
vim -s <(cat <<EOF
vim -s <(cat <<EOF

Latest revision as of 18:38, 8 April 2023

Documentation

:help starting https://vimhelp.org/starting.txt.html

Useful Params

vim -p a b c  # open in new tabs
vim -o a b c  # open in vert splits
vim -O a b c  # open in horiz splits

vim --cmd "let foo=bar" --cmd "let bar=baz"  # run commands before reading vimrc
vim -c "echo foo" -c "echo bar"              # run commands after reading vimrc, and first file

vim '+/[0-9] foo' file.txt                    # open at first line matching regex

You can also pass a script-file in of vim-commands

vim -s <(cat <<EOF
:echom 'hi'
:messages

:function DoThing()
  echom 'bye'
endfunc
EOF
)