CSV.vim plugin has an ability to change the column deliminator/separator. I would like to find a plugin by which I can change all decimal points (such as comma) to dot, does there exist plugin to do such conversion?

P.s. This is the command that does this, :%s/\([0-9]\)\.\([0-9]\)/\1,\2/g, but I would like to find a plugin that brings this kind of common conversions as scripts.

  • 2
    For such a simple command, you don't need a plugin. Jan 25, 2017 at 17:38

1 Answer 1


Why don't you define a command from this line? Drop it in $HOME/.vim/plugin/yourpluginname.vim, and you're done. (at least, this is enough for something that simple)

command! -range=% ChangeDotToComa <line1>,<line2>s/\d\zs\.\ze\d/,/g

PS: Honestly, in that case, I'd rather change the locale of my machine to tell it that I want to use . as the decimal point and not ,. (But then I've troubles with CSV files produced by excel running with unmodified French locale. They are fortunately rare enough)

  • 2
    For a one liner like this one which isn't defined for a specific filetype, is there a reason to put it in a plugin rather than directly in the vimrc?
    – statox
    Jan 25, 2017 at 14:38
  • 1
    @statox, Good question. Plugins can be easily installed/distributed, and potentially their maintenance can be centralized. For instance, one may want to use the character returned by locale -k decimal_point. If this was a distributed plugin, everyone could take advantage of it. Now ... is this the reason why the OP asked for a plugin? I don't know. Jan 25, 2017 at 15:44
  • 1
    My mistake. I've fixed the path of the file. Files under $HOME/.vim/plugin are automatically loaded. Those under $HOME/.vim/aren't. Jan 25, 2017 at 22:13
  • Does every file.vim in .vim folder get automatically loaded?
    – hhh
    Jan 26, 2017 at 7:19
  • I've answered your question in the comment that precedes it. Jan 26, 2017 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.