How to inspect the cursor position in Vim command line (Cmdline mode) from Vim script?
I would like to configure my Command-line mode key bindings in Vim to behave like in tcsh. In particular, i would like Ctrl-d to delete one character after the cursor except at the end of the command line, and to list all possible completions otherwise (what Ctrl-d does in Cmdline mode by default). The first thing that comes to mind is to make some mapping similar to the following one:
cnoremap <expr> <C-d> (col('.')==col('$')?'<C-d>':'<Del>')
Of course, this one does not do what i want because it is the cursor position in the text that is being inspected, not the cursor position in the command line.
So, what Vim functions can inspect the cursor position in Vim command line?
I would also be interested to know how to move the cursor in the command line and how to modify the command line from Vim script.
:help getcmdpos()
and the topics referred to there.cnoremap <expr> <C-d> (getcmdpos()==len(getcmdline())+1?'<C-d>':'<Del>')
.