:setfiletype (with a space afterwards), then press
:help cmdline-completion for more on autocompletion in vim's command line.
This solution uses the
'runtimepath' option to get all available syntax directories, and then fetches a list of the vimscript files in those directories with their extensions removed. This may not be the safest way to do it, so improvements are welcome:
" Get a list of all the runtime directories by taking the value of that
" option and splitting it using a comma as the separator.
let rtps = split(&runtimepath, ",")
" This will be the list of filetypes that the function returns
let filetypes = 
" Loop through each individual item in the list of runtime paths
for rtp in rtps
let syntax_dir = rtp . "/syntax"
" Check to see if there is a syntax directory in this runtimepath.
" Loop through each vimscript file in the syntax directory
for syntax_file in split(glob(syntax_dir . "/*.vim"), "\n")
" Add this file to the filetypes list with its everything
" except its name removed.
call add(filetypes, fnamemodify(syntax_file, ":t:r"))
" This removes any duplicates and returns the resulting list.
" NOTE: This might not be the best way to do this, suggestions are welcome.
You can then use this function in whatever way you want, such as printing all of the values in the list. You could accomplish that like so:
for f in GetFiletypes() | echo f | endfor
Note that this probably can be compacted quite a bit, it is just like this for readability. I won't explain every function and command used here, but here are all the help pages for them: