Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes indent and adds g:vim_vue_indent_paths for runtime indent overrides #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TaDaa
Copy link

@TaDaa TaDaa commented Dec 10, 2018

Fixes indent and adds g:vim_vue_indent_paths for runtime indent overrides (example usage {'javascript': '../vim-javascript/indent/javascript.vim'}. Docs need updates.

…ides (example usage {'javascript': '../vim-javascript/indent/javascript.vim'}. Docs need updates.
Copy link
Collaborator

@adriaanzon adriaanzon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see what exactly is being fixed here.

execute 'runtime! indent/' . a:language . '.vim'
let path = ""
if exists('g:vim_vue_indent_paths') && has_key(g:vim_vue_indent_paths, a:language)
let path = g:vim_vue_indent_paths[a:language]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent files from plugins are already loaded by default. Isn't this working for you?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for me there were cases where you can have multiple plugins with indent rules. For example, eclim and vim-javascript both contain javascript rules, however vim-javascript is far superior for me. The old method always resulted in eclim loading for vue files.

The other suggested fixes for using set ft= html.javascript or vice-versa worked, but also broke completion and other plugins.

for language in s:languages
let opening_tag_line = searchpair(language.pairs[0], '', language.pairs[1], 'bWr')

if opening_tag_line
execute 'let indent = ' . get(language, 'indentexpr', -1)
let indent = language.indentexpr
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get() was being used here to return -1 (which means "do not change the indentation") when the indent file for that language is not present.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I couldn't tell that this actually affected anything when I changed it-- tested it with missing indent files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants