I'm writing a vim function to comment the selected lines in visual mode. Then I have written the following function to toggle the "#" character. I want insert the # when thereisn't and remove it when it's there.
function Mycomment() if col(1.)=="^#" :s/^#//g else :s/^/#/g endif endfunction
Obviously doesn't work. The biggest problem is to know what's the content of the column 1.