tpope / vim-commentary

commentary.vim: comment stuff out
http://www.vim.org/scripts/script.php?script_id=3695
5.9k stars 214 forks source link

commentary does not properly detect (or use) known filetype #164

Closed wosym closed 1 year ago

wosym commented 1 year ago

I've used this plugin on several machines for quite some time now, and it works flawlessly on all filetypes I work with.

On one machine however, it does not appear to use the filetype properly. I'm not sure yet why.

For example, :set filetype? returns filetype=python, which should be supported. However, it still adds C-type comments (/ --- /) when typing gcc

Not sure what's causing this bug. Is there a way to show what filetype commentary has detected and is using?

tpope commented 1 year ago

Commentary doesn't directly use 'filetype' but rather 'commentstring', which is typically set by the ftplugin. My guess is you're missing filetype plugin indent on in your vimrc. (Many installs enable this in the system vimrc, so that's probably why the issue is specific to one machine.)