I am trying to create a vimrc function which will clean up a line by doing simple substitutions. The function is called upon CARRIAGE RETURN. The function is being called and is cleaning up the line contents. My question is how do I overwrite the previous content with the cleaned up content from inside the function?
function! CleanLine()
let s = getline( '.' )
let s = substitute( s, '( )', '()', 'g' )
let s = substitute( s, ';', '; ', 'g' )
let s = substitute( s, '(', ' (', 'g' )
"HOW DO I SET THE CURRENT LINE CONTENT AS s
endfunction
inoremap <CR> <C-R>=CleanLine()<CR>
thanks.
There is a function called
setline()Type
:help setline()for help.