I am trying to code a function that replaces the character in the sixth column of my current line with a dollar symbol ($), but I would like my cursor to remain at the position it was before calling the function. So I tried to store the current column, execute my changes, and then come back with the following function :function! DollarSplit()   let col_number=col(.)     stores the current column number of the cursor   normal! 6|r$                 replaces the 6th caracter in line with a $   execute col_number.| endfunctionI am probably misunderstanding something about the execute command... Or maybe I should create a string containing the command I want to be executed ? 
How to restore the position of the cursor after executing a normal command?
vimscript;cursor movement
You should use getpos():To save you position in a variable:let save_pos = getpos(.)getpos() takes as argument a mark, here . represents the current position of your cursor.And to restore it:call setpos('.', save_pos)Here the first argument indicate that you will move the mark of the current position of your cursor (hence your current position) and the second is where to put the mark (the position that you saved earlier).Your function would look like this:function! DollarSplit()   let save_pos = getpos(.)   normal! 6|r$                 replaces the 6th caracter in line with a $   call setpos(., save_pos)endfunctionFor more details see: :h getpos() and :h setpos()For more details about your usage of execute: this function will take a string and execute it. Your string can be only hardcoded characters between double quotes or the contents of variables.When you write execute col_number.|If you are on the 12th column the expanded string will be 12|. Execute will try to execute this command but it won't work because 12| is not a vimscript function but a normal mode command.To execute it from a vimscript you have to say execute it as if I had typed it in normal mode`, that's what normal is used for.So without the execute you would have wrote:normal 12|Now to make your execute call work you have to add the normal keyword to your expanded string, like this:execute normal  . col_number . |