Comments (12)
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.
from pear-tree.
This should be fixed now. Thanks!
from pear-tree.
Still not working for me, although echo b:pear_tree_pairs
shows the right config.
from pear-tree.
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
from pear-tree.
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
from pear-tree.
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 >
.
from pear-tree.
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
from pear-tree.
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.
from pear-tree.
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.
from pear-tree.
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.
from pear-tree.
Yeah, I updated before I did my latest tests, I even removed it and installed it from scratch multiple times too.
from pear-tree.
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.
from pear-tree.
Related Issues (20)
- Disable smart openers in certain contexts (if the text before matches a certain regexp) HOT 1
- Thank you for this!
- Conflicts with smartindent HOT 1
- pear-tree wont delete auto created closing bracket after expansion
- Feature Request: Jump Backwards Mapping
- UTF-8 quotation marks do not trigger auto-pairing
- How would I make it so that pairs are closed only after a keystroke after them?
- Closing bracket seems to disappear after pressing enter HOT 1
- Intercepting <CR> appears to break other plugins that need it HOT 1
- Breaks vim-textobj-quote
- Plugin not working
- Allow <Plug>(PearTreeExpand) to work even if there is text between pairs
- Smart pairs are fooled by pairs that live inside strings
- Cannot close inside quotes
- unexpected <CR> expansion
- Unwanted angular bracket completion HOT 1
- Is there a way to jump to the position which is just after the current match pairs? HOT 1
- Wildcard modifier for HTML standalone tags HOT 1
- Breaks with treesitter indent
- `not_at` seemingly not working if matching whitespace HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pear-tree.