Closed ahmedelgabri closed 5 years ago
This should be fixed now. Thanks!
Still not working for me, although echo b:pear_tree_pairs
shows the right config.
I can no longer reproduce your problem. Are you using a plugin for .html.twig
filetype support, and if so which one? Could you also copy/paste the output of :verbose autocmd FileType
I'm using https://github.com/sheerun/vim-polyglot which uses https://github.com/lumiliet/vim-twig
Here is the output of :verbose autocmd FileType
--- Autocommands ---
filetypeplugin FileType
* call s:LoadFTPlugin()
Last set from /usr/local/Cellar/neovim/HEAD-89d7e24/share/nvim/runtime/ftplugin.vim
filetypeindent FileType
* call s:LoadIndent()
Last set from /usr/local/Cellar/neovim/HEAD-89d7e24/share/nvim/runtime/indent.vim
syntaxset FileType
* exe "set syntax=" . expand("<amatch>")
Last set from /usr/local/Cellar/neovim/HEAD-89d7e24/share/nvim/runtime/syntax/syntax.vim
MyAutoCmds FileType
* if functions#should_quit_on_q() | nmap <buffer> <silent> q :q<cr> | endif
Last set from ~/.dotfiles/files/.vim/plugin/autocmnds.vim
gitcommit setlocal cursorline
Last set from ~/.dotfiles/files/.vim/plugin/autocmnds.vim
gina-status
setlocal cursorline
Last set from ~/.dotfiles/files/.vim/plugin/autocmnds.vim
todo setlocal cursorline
Last set from ~/.dotfiles/files/.vim/plugin/autocmnds.vim
qf setlocal cursorline
Last set from ~/.dotfiles/files/.vim/plugin/autocmnds.vim
lisp RainbowParentheses
Last set from ~/.dotfiles/files/.vim/plugin/autocmnds.vim
clojure RainbowParentheses
Last set from ~/.dotfiles/files/.vim/plugin/autocmnds.vim
scheme RainbowParentheses
Last set from ~/.dotfiles/files/.vim/plugin/autocmnds.vim
PROSE_MAPPINGS FileType
markdown inoremap <buffer> . .<c-g>u
Last set from ~/.dotfiles/files/.vim/plugin/mappings.vim
text inoremap <buffer> . .<c-g>u
Last set from ~/.dotfiles/files/.vim/plugin/mappings.vim
markdown inoremap <buffer> ? ?<c-g>u
Last set from ~/.dotfiles/files/.vim/plugin/mappings.vim
text inoremap <buffer> ? ?<c-g>u
Last set from ~/.dotfiles/files/.vim/plugin/mappings.vim
markdown inoremap <buffer> ! !<c-g>u
Last set from ~/.dotfiles/files/.vim/plugin/mappings.vim
text inoremap <buffer> ! !<c-g>u
Last set from ~/.dotfiles/files/.vim/plugin/mappings.vim
markdown inoremap <buffer> , ,<c-g>u
Last set from ~/.dotfiles/files/.vim/plugin/mappings.vim
text inoremap <buffer> , ,<c-g>u
Last set from ~/.dotfiles/files/.vim/plugin/mappings.vim
languageClient FileType
* call LanguageClient#handleFileType()
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/LanguageClient-neovim/plugin/LanguageClient.vim
ALEEvents FileType
* call ale#events#FileTypeEvent( str2nr(expand('<abuf>')), expand('<amatch>'))
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/ale/autoload/ale/events.vim
_fzf_statusline FileType
fzf call s:fzf_vim_term()
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/fzf.vim/plugin/fzf.vim
necovim FileType
vim call necovim#helper#make_cache()
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/neco-vim/plugin/necovim.vim
pear_tree FileType
* if index(g:pear_tree_ft_disabled, &filetype) > -1 | call <SID>BufferDisable() | endif
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/pear-tree/plugin/pear-tree.vim
dirvish_ftdetect FileType
dirvish if exists('#fugitive') | call fugitive#detect(@%) | endif
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-dirvish/plugin/dirvish.vim
dirvish_git FileType
dirvish call dirvish_git#init()
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-dirvish-git/plugin/dirvish_git.vim
fugitive FileType
netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('<amatch>')), ':p'))
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-fugitive/plugin/fugitive.vim
git if exists('b:git_dir') | call fugitive#MapJumps() | call fugitive#MapCfile() | endif
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-fugitive/plugin/fugitive.vim
gitcommit if exists('b:git_dir') | call fugitive#MapCfile('fugitive#MessageCfile()') | endif
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-fugitive/plugin/fugitive.vim
fugitive if exists('b:git_dir') | call fugitive#MapCfile('fugitive#StatusCfile()') | endif
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-fugitive/plugin/fugitive.vim
gitrebase let &l:include = '^\%(pick\|squash\|edit\|reword\|fixup\|drop\|[pserfd]\)\>' | if exists('b:git_dir') | let &l:includeexpr = 'v:fname =~# ''^\x\{4,40\}$'' ? FugitiveFind(v:fname) : ' . (len(&l:includeexpr) ? &l:includeexpr : 'v:fname') | endif | let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . '|setl inex= inc='
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-fugitive/plugin/fugitive.vim
VimGitHubHubFtDetect FileType
gitcommit call s:overrideHubFiletype()
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-github-hub/ftdetect/github.vim
matchup_filetype FileType
* call matchup#loader#init_buffer()
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-matchup/autoload/matchup/loader.vim
filetypedetect FileType
apiblueprint
set syntax=apiblueprint
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-polyglot/ftdetect/polyglot.vim
set makeprg=drafter\ -l\ %
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-polyglot/ftdetect/polyglot.vim
ember-script
set tabstop=2|set shiftwidth=2|set expandtab
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-polyglot/ftdetect/polyglot.vim
emblem set tabstop=2|set shiftwidth=2|set expandtab
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-polyglot/ftdetect/polyglot.vim
purescript
let &l:commentstring='{--%s--}'
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-polyglot/ftdetect/polyglot.vim
python compiler python
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-polyglot/ftdetect/polyglot.vim
projectionist FileType
* if (&filetype ==# 'netrw' && !exists('b:projectionist')) || &buftype !~# 'nofile\|quickfix' | call ProjectionistDetect(expand('%:p')) | endif
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-projectionist/plugin/projectionist.vim
scriptease FileType
help call scriptease#setup_help()
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-scriptease/plugin/scriptease.vim
vim call scriptease#setup_vim()
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-scriptease/plugin/scriptease.vim
if get(g:, 'scriptease_iskeyword', 1) | setlocal iskeyword-=: | endif
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-scriptease/plugin/scriptease.vim
MyCommentary FileType
ruby setl commentstring=#\ %s
Last set from ~/.dotfiles/files/.vim/after/plugin/commentary.vim
python setl commentstring=#\ %s
Last set from ~/.dotfiles/files/.vim/after/plugin/commentary.vim
htmldjango
setl commentstring={#\ %s\ #}
Last set from ~/.dotfiles/files/.vim/after/plugin/commentary.vim
jinja2 setl commentstring={#\ %s\ #}
Last set from ~/.dotfiles/files/.vim/after/plugin/commentary.vim
MyGrepper FileType
GrepperSide
silent execute 'keeppatterns v#'.b:grepper_side.'#>'| silent normal! ggn| setl wrap
Last set from ~/.dotfiles/files/.vim/after/plugin/grepper.vim
ncm2_hooks FileType
* call s:try_rnotify('load_plugin', &rtp)
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/ncm2/autoload/ncm2.vim
fugitive_blame FileType
fugitiveblame
setlocal nomodeline | if exists('b:git_dir') | let &l:keywordprg = s:Keywordprg() | endif
Last set from ~/.dotfiles/files/.vim/pack/minpac/start/vim-fugitive/autoload/fugitive.vim
__TEST__ FileType
html.twig let b:pear_tree_pairs = extend(deepcopy(g:pear_tree_pairs), { '<*>': { 'closer': '</*>', 'not_if': ['br', 'hr', 'img', 'input', 'link', 'meta', 'area', 'base', 'col', 'command', 'embed', 'keygen', 'param', 'source', 'track', 'wbr'], }}, 'keep')
Last set from ~/Sites/work/.local.vim
And it doesn't work on completely empty Twig files? What about for normal HTML files?
Perhaps b:pear_tree_pairs
is being set too late to take effect. Please edit a Twig file, enter insert mode, leave insert mode, and then show the outputs of :echo g:pear_tree_pairs
, :echo b:pear_tree_pairs
, :echo b:traverser
, and :verbose imap >
.
And it doesn't work on completely empty Twig files? What about for normal HTML files?
Doesn't work with twig at all even new files, HTML works fine.
Perhaps
b:pear_tree_pairs
is being set too late to take effect. Please edit a Twig file, enter insert mode, leave insert mode, and then show the outputs of:echo g:pear_tree_pairs
,:echo b:pear_tree_pairs
,:echo b:traverser
, and:verbose imap >
.
:echo g:pear_tree_pairs
{'"': {'closer': '"'}, '{': {'closer': '}'}, '''': {'closer': ''''}, '(': {'closer': ')'}, '[': {'closer': ']'}}
:echo b:pear_tree_pairs
{'"': {'closer': '"'}, '[': {'closer': ']'}, '''': {'closer': ''''}, '(': {'closer': ')'}, '{': {'closer': '}'}, '<*>': {'not_if': ['br', 'hr', 'img', 'input', 'link', 'meta', 'area', 'base', 'col', 'command', 'embed', 'keygen', 'param', 'source', 'track', 'wbr'], 'closer'
: '</*>'}}
:echo b:traverser
E121: Undefined variable: b:traverser
:verbose imap >
No mapping found
The fact that >
is not mapped to anything makes it sound like your autocmd is defining b:pear_tree_pairs
after Pear Tree initializes its mappings. The file (~/Sites/work/.local.vim
) containing your autocmd may be getting sourced too late. Try moving the autocmd to your vimrc and check if it works.
I already tried adding it to .vimrc
& after/plugin/pear-tree.vim
& it didn't work. That's how my setup works, I like to use vim folder structure instead of one big vimrc
/init.vim
file. If it makes a difference also I'm mainly using neovim.
Have you tried it since the update that first closed this issue? When you first opened the issue, the autocmd wouldn't have worked even in a vimrc, but that should have been fixed.
Yeah, I updated before I did my latest tests, I even removed it and installed it from scratch multiple times too.
I may have figured it out. Pear Tree is initializing before vim-polyglot sets the filetype to html.twig
. By default, Vim sets the filetype of *.twig files to twig
, unlike vim-polyglot which sets the filetype to html.twig
. Change your autocmd from FileType html.twig
to FileType twig
and let me know if it works.
This works in after/plugin/pear-tree.vim
now, thanks! I need to figure out how to make it work with .local.vim
per project files, I think there loaded before after/plugin/*
so I'll have to fix that.
I'm trying to do this, which doesn't work
I tried this & still the
<*>
expansion doesn't work but everything else worksIf I set it globally it works thought