I'm trying to auto-add ; , or whatever is needed in the end of expression by a keystroke, and go to another line.
Basicly it'll be something like inoremap <leader>; <C-o>A;, but i want a little improvement. If next line is empty (or doesn't exist) i want it to do <C-o>A;<cr>, and if it isn't empty just <C-o>A;<Down>. In other words i need an idiomatic way to check if next line exist and if it's empty. Thanks.
Answer to the actual question:
"Expression" mappings allow you to execute different macros depending on the result of one or more expressions. Here, we check if the line below is empty within a straightforward ternary operator.
Reference:
Original answer to the original question:
^Mis a literal<C-m>(synonym of<CR>) that you obtain by pressing<C-v>then<CR>.