I would like to have a higher number in my linespace setting for markdown files for easier reading. I thought I’d do in my .vimrc:
au FileType markdown setlocal linespace=4
But no luck. The locality of the setting is ignored and linespace is applied to all buffers (even Python and Javascript files).
I’m using Pope’s markdown.vim plugin to provide the markdown filetype.
Ideas?
Actually linespace is a global option (see
:h linespace). Your auto commandis working, but even though it’s using
:setlocal, the option can’t be applied toa specific buffer or window; acting as if you had used
:set.Update
If you want to change the linespace option based on your current buffer, basically
all you need to do is changing your current auto-command from
To
The difference is that now the command will be auto called when you enter a buffer
that has a file name ending with
.markdown(change this pattern to match yourusual mardown extension).
To reset the option, add the following auto-command as well to your .vimrc:
It will set the linespace option to 2 (or whatever value you want) once you leave
a buffer containing a markdown file.