I came across some odd vimscript syntax while reading through the source of the fugitive plugin that I haven't been able to find any documentation on or figure out what it does. It's a user command followed by a space and a colon like so (third line):
function! s:Status() abort
try
Gpedit :
wincmd P
setlocal foldmethod=syntax foldlevel=1
nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
catch /^fugitive:/
return 'echoerr v:errmsg'
endtry
return ''
endfunction
I've never seen this before! I've worked through Steve Losh's Learn Vimscript the Hardway book, read plenty of articles on vimscript, read help often and have never come across this other than here. Anyone know?
There is nothing special about this syntax. Since :Gpedit
is a user command, it can take any argument its author has provided some handling logic for.
When you look up the documentation for :Gpedit
you can see that it takes a 'revision' argument.
You'll also find in the documentation that :
is short for the Git index.