Filetype specific linespace setting
I would like to have a higher number in my linespace
setting开发者_StackOverflow 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 command
is working, but even though it's using :setlocal
, the option can't be applied to
a 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
au FileType markdown setlocal linespace=4
To
au BufEnter *.markdown setlocal linespace=4
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 your
usual mardown extension).
To reset the option, add the following auto-command as well to your .vimrc:
au BufLeave *.markdown setlocal linespace=2
It will set the linespace option to 2 (or whatever value you want) once you leave a buffer containing a markdown file.
精彩评论