I'm pretty new to writing stuff in my .vimrc, and I'm trying to understand how to use conditionals.
I'm using neovim. I'm trying to get (an enhanced version of) nvim's terminal emulator to launch in a split when I open nvim (unless I specify just one thing to open).
""" Split-Term terminal helpers
Plug 'vimlab/split-term.vim'
set splitbelow
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | 10Term | endif
This works. almost the way I expect. The terminal split opens and says
/bin/bash: -c: line 0: syntax error near unexpected token `|'
/bin/bash: -c: line 0: `| endif'
[Process exited 1]
Pretty clearly what's happening is the last couple words of the if-endif block are getting passed as additional arguments to Term
(which it's documented as accepting, it's just that these aren't valid shell commands and they're not supposed to get treated that way).
In fact, if I leave off the | endif
, then it really does work perfectly. Nvim doesn't yeild any kind of warning that I'm missing the endif
. The only weirdness is that I start in insert mode, which isn't ideal and suggests that I really am doing something wrong.
What's the right way to do this?