title: How to invoke the increment and decrement Normal-mode commands in Vimscript?
body: <p>I’m trying to create a Vimscript function that randomly increments ro decrements the number under the cursor, so I can call it from a macro. So far, I’ve got this:</p>
  <pre><code>function! RandomIncDec() 
      python import random
      python vim.command(&quot;let l:random = &quot; + str(random.randint(-15, 15)))
      if l:random &gt; 0
          exec ':normal ' . l:random . '&lt;C-a&gt;'
      elseif l:random &lt; 0
          exec ':normal ' . abs(l:random) . '&lt;C-x&gt;'
      endif
  endfunction
  
  command! RandIncDec :call RandomIncDec()
  </code></pre>
  <p>The problem I’m having is that the <kbd>Ctrl</kbd>-<kbd>A</kbd> and <kbd>Ctrl</kbd>-<kbd>X</kbd> keys don’t seem to work from Vimscript this way.</p>
  <p>I’ve also tried using the <code>feedkeys()</code> function to try and emulate the keypresses as well, but that doesn’t seem to do the trick either. I could probably do this by calling the underlying functions that <kbd>Ctrl</kbd>-<kbd>A</kbd> and <kbd>Ctrl</kbd>-<kbd>X</kbd> are mapped to, but as they are core, I can’t find out what they are from <code>:map</code>.</p>
  <p>What is the correct way to do this from Vimscript?</p>