I'm using the following commands to move a line of text up and down in the file.
:move +1<CR> :move -2<CR>
However, these commands don't work on the edges of the file. If I try to move the first line up or the last line down I get an error that says
E14: Invalid Address. Is there a way to avoid this error? I'd prefer if attempting to move past the edges of the file became a no-op instead.
I'm wondering if there is another way to specify the target address instead of +1 and -2, which would tell Vim that I don't want to go outside the bounds of the file.