1

I have this little augroup that contains a simple autocommand that hides the /home/devs/ text on top of nerdtree:

augroup HideHOME
  autocmd! FileType nerdtree
  autocmd FileType nerdtree syntax match NERDTreeHideCWD 
        \ #^[</]home[/]devs[/]# conceal
augroup end

It works well on my neovim setup.. but not on vim(8.1), I even tried pasting this into a separate file then source using vim -u HideHome.vim but it still doesn't work..

The weird thing is when I typed it manually on the commandline it works.

:syntax match NERDTreeHideCWD #^[</]home[/]devs[/]# conceal

they also have the same concealcursor and conceallevel values so what might be the problem in vim?

EDIT: Okay I still don't know what's the cause but I'm sourcing this from the system-wide vimrc in /usr/local/share/vim/vim81/vimrc and when I tried from ~/vimrc it works.. If anybody can enlighten me I'll gladly accept it as the answer.

  • Okay I still don't know what's the cause but I'm sourcing this from the system-wide vimrc in /usr/local/share/vim/vim81/vimrc and when I tried from ~/vimrc it works.. If anybody can enlighten me I'll gladly accept it as the answer. – John Fred Fadrigalan Feb 2 at 16:56
  • Avoid putting custom code in system-wide vim configs (unless multiuser machine and your intention is to update the config for everyone). – swalladge Feb 3 at 23:58
  • You're sourcing it from an already initialized instance of vim? It may have a run-once conditional (something like if <condition> | finish | endif). Just a guess since I don't have your system vimrc. – B Layer Feb 8 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.