title: How to move block of code in VIM
body: <p>let's say I have following block of code:</p>
  
  <pre><code>int main(void)
  {
      return 0;
  }
  
  int abc(void)
  {
      printf("First line\n");
      printf("Druhy radek\n");
      printf("tuna fish\n");
  }
  </code></pre>
  
  <p>...and I want to move content of function abc to function main. I tried to use <code>visual selection</code>, but when I select those three lines and paste them, this happens:</p>
  
  <pre><code>int main(void)
  {
      return 0;
      printf("First line\n"); }
      printf("Druhy radek\n");
      printf("tuna fish\n");  int justAregularFunction(void)
  {
  </code></pre>
  
  <p>Instead of this, I want to create a space in main function for the deleted block of text and then paste it.
  I tried to use <code>]p</code> instead of regular <code>p</code> for pasting text, but it didn't work. </p>
  
  <p>Solution would be to use <code>d2j</code> to delete the three lines and then I am able to paste the block like I wanted. But it is not very helpful when you have code with a lot of lines. Also commands <code>:set paste</code> and <code>:set nopaste</code> didn't help. I'm learning VIM and have no experience with vi, so I am probably missing something. <code>Vim tutor</code> was very helpful, but it explained only moving single lines. Also I found a lot of material about moving lines in vim here at stack overflow, but anything helped. I would like to have something like <code>&gt;&gt;</code> <code>&lt;&lt;</code> for moving text, but vertically.</p>
  
  <p>Second thing I can't figure out is how to delete text and space in visual select. When I select text and try to delete it, it leaves empty space. <code>Button D</code> deletes only text without space, also <code>X</code> does the same(and other variants with shift and control). Again, using d number j would help, but I want to achieve it in <code>visual</code> select.</p>
  
  <p>I hope it's not totally dumb question, but I really didn't find a way to do it. Thanks for your help.</p>