'My conceal options are not loading in vim
I have some conceal options (syntax match Normal '\.md\]' conceal cchar=]) added in a $HOME/.vim/after/syntax/base.vim.
They are not loaded when I open a file. But if i do :source $HOME/.vim/after/syntax/base.vim the conceal is activated.
In .vimrc I have also this:
syntax on
set conceallevel=2
I even tried with this options in my .vimrc
source ~/.vim/after/syntax/base.vim
let g:mysyntaxfile = '~/.vim/after/syntax/base.vim'
au VimEnter,BufEnter source ~/.vim/after/syntax/base.vim
Nothing works. Only source from vim Command Mode.
Solution 1:[1]
base.vim should have been markdown.vim. Now it works.
Solution 2:[2]
When they are not sourced explicitly, with something like source /path/to/foo.vim or runtime foo.vim, syntax scripts are sourced automatically on a per-filetype basis. Basically…
:e foo.jscreates a buffer for that file,- Vim picks up that it is a JavaScript file so it assigns the
javascriptfiletype and thejavascriptsyntax, - Vim sources all the
*/syntax/javascript.vimscripts it can find in$RUNTIMEPATH.
Conclusion: if you want to source a specific syntax script for a specific filetype, name it appropriately:
<filetype>.vim
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Samar |
| Solution 2 | romainl |
