For instance, :echo strftime(%c) will show the current time on the bottom, but how to insert this time string to the text (right after the cursor)?
|
|
||||
|
|
|
You can use the expression register, In normal mode:
In insert mode:
If you want to insert the result of the same expression many times, then you might want to map them onto keys in your
|
|||||
|
|
see |
|||||||
|
Will put it on the next line, then you could press Or if you need it all in one command, you could do
or
depending on whether you want a space inserted before the date or not. |
||||
|
|
|
These commands will insert the output of
and
There are other ways to do what you want (like, for example, those on Mikel's answer). Edit: Even better, for in-place insert, use the |
||||
|
|
|
If you want to insert the output of a vim command (as opposed to the return value of a function call), you have to capture it. This is accomplished via the
Once you've declared such a function, you can use the expression register (as explained by Chris Johnsen) to insert the output of a command at the cursor position. So, from normal mode, hit Be aware that the command will execute in the function namespace, so if you use a global variable you will have to explicitly namespace it by prefixing it with Also see http://stackoverflow.com/questions/2573021/vim-how-to-redirect-ex-command-output-into-current-buffer-or-file/2573054#2573054 for more blathering on about |
||||
|
|