othree / javascript-libraries-syntax.vim Goto Github PK
View Code? Open in Web Editor NEWSyntax for JavaScript libraries
Home Page: http://www.vim.org/scripts/script.php?script_id=4428
Syntax for JavaScript libraries
Home Page: http://www.vim.org/scripts/script.php?script_id=4428
I've installed YCM and the following plugins
Plugin 'jelera/vim-javascript-syntax'
Plugin 'othree/javascript-libraries-syntax.vim'
Plugin 'othree/vim-coffee-script'
Plugin 'mattn/jscomplete-vim'
But the native JavaScript is not autocompleted,
But if I put autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
at the end of vimrc, then it'll enable native javscript autocomplete. And other syntax autocomplete will be disabled.
I wonder what's going on, it would be better if could help out.
I don't have TypeScript support.
First i figured out that the filetype was not set to typescript. Vim told me after
:set ft?
that the filetype is xml
filetype=xml
so i have set it manually with
autocmd BuffNewFile,BuffRead *.ts set filetype=typescript
but it didn't solve the problem. A workaround would be to set the filetype to javascript, but i would rather use your specific syntax file. :)
I'd appreciate it if you included support for sugar.js. It's pretty small and simple.
I can't update c2f17e2..13f752f
, it's been few weeks. I am on Neovim.
please add syntax support for Jasmine:
https://github.com/pivotal/jasmine
http://jasmine.github.io/
Jasmine has special functions:
describe
it
expect
not
toBe
toHaveBeenCalled
andCallThrough
andReturn
beforeEach
afterEach
xdescribe
xit
(matchers)
expect(x).toEqual(y); compares objects or primitives x and y and passes if they are equivalent
expect(x).toBe(y); compares objects or primitives x and y and passes if they are the same object
expect(x).toMatch(pattern); compares x to string or regular expression pattern and passes if they match
expect(x).toBeDefined(); passes if x is not undefined
expect(x).toBeUndefined(); passes if x is undefined
expect(x).toBeNull(); passes if x is null
expect(x).toBeTruthy(); passes if x evaluates to true
expect(x).toBeFalsy(); passes if x evaluates to false
expect(x).toContain(y); passes if array or string x contains y
expect(x).toBeLessThan(y); passes if x is less than y
expect(x).toBeGreaterThan(y); passes if x is greater than y
expect(function(){fn();}).toThrow(e); passes if function fn throws exception e when executed
why not work after git clone git clone https://github.com/othree/javascript-libraries-syntax.vim.git ~/.vim/bundle/javascript-libraries-syntax.vim
http://docs.angularjs.org/api/
Unfortunately, I'm not very familiar with making syntax files for Vim.
I recently had an issue with this plugin. Whenever I opened a javascript file in any of my vim sessions scrolling up and down was really slow. I didn't have time initially to narrow down which plugin caused it so I wrote a quick function to toggle syntax on and syntax off which fixed it for that session. After disabling the js libaries syntax vim plugin all is back to normal. I'm using Vim 7.3.854 compiled on OS X with Janus. Thanks!
After #9, javascript-libraries-syntax.vim
loads (my vim setup is in a path that contains whitespace; /Users/tom/Library/Application Support/vim
).
However, the after/*
files do not appear to be sourced as I have to manually call jslibsyntax#load()
. Any ideas why this may be? I'm running javascript-libraries-syntax.vim
via pathogen.
Is it ok?
Bug exists when pangloss/vim-javascript is enabled
Hello there.
Is it possible to support mithril.js view template syntax? https://lhorie.github.io/mithril/
Would be nice to add suport for Vue.js
Should not enable all lib by default
I also use vim-javascript for my normal syntax highlighting. However, I've tried commenting out this library in my setup and I don't see the bug, so something here clashes with the setup there. Without this library, vim-javascript correctly does not highlight javascript keywords used as object properties, like obj.class = 'success'
. With this library, class
gets highlighted according to the syntax highlighting specified by vim-javascript (which is to say, it's the same color "class" would be when used as a class declaration). That by itself isn't really a problem; I could live with it. The problem is that subsequent text is then highlighted erratically because this library seems to think it was an actual class declaration and is expecting the class itself to follow. Here's a screen shot. Note how "MemberService.member.personal.firstname" is yellow. Without this library, it's white, as I'd expect for any object property path.
In the file /autoload/syntax/angular.html.vim
there is:
setlocal iskeyword+=-
But this will change how motion w
works on the symbol -
.
I think syntax iskeyword @,48-57,_,192-255,$,-
is better.
As vim document said,
This defines the keyword characters. It's like the `iskeyword` for but only applies to syntax highlighting.
Excellent work on this package, I absolutely love it. It would be totally awesome if you could add support for express.js !
Can you please tell me how to include mommentJS so I can contribute with you with my favo libraries http://jsbd.io ;)
The commit Change implementation for css selector in jQuery (97ea998) throws me an error when I start editing a new javascript file.
E400: No cluster specified
E475: Invalid argument: cssSelectors containedin=javascriptString contains=cssId,cssClass,cssOperators,cssBasicFilters,cssContentFilters,cssVisibility,cssChildFilters,cssForms,cssFormFilters
There's an Issue on angularjs syntax for the namespace $scope, $rootScope, $routeParams, etc. The only one highlighted is "$locatioon"
For other libs it's working (at least Underscorejs)
Hi othree,
Thanks for this awesome plugin :) It works great for me except after I turned on angularjs highlight, my vim becomes very laggy. Is there anyway to profile the plugin so I can find out which part slows down my vim?
Hi,
I install this plugin with Vundle
,everything seems OK.
Then I open a simple .js file,(I know jQuery
is enabled by default.)just input:
jQuery("#id").ready(function(){
});
Anyhow,the word ready
is displayed as plain text ,rather than function color.
So , did I use it in the wrong way ?
Ps:
Is this plugin conflict with othree/javascript-libraries-syntax.vim'
?
Thanks.
Here is a part of my Vim config file:
" Scripts
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'othree/javascript-libraries-syntax.vim', { 'for': 'javascript' }
Plug 'fleischie/vim-styled-components', { 'for': 'javascript' }
let g:javascript_plugin_jsdoc = 1
let g:used_javascript_libs = 'react,vue,underscore,jasmine'
Your plugin works good for me some time ago. But now it looks like not.
All plugins was updated today. What's wrong here?
When using highlighting for d3, 'd3' is highlighted correctly. But after 'd3' no methods are recognized.
When inspecting which highlight group is attached to d3.selectAll() no highlightgroup is shown.
let g:used_javascript_libs='d3'
When adding jquery highlighting, d3.select() is highlighted as 'javascriptQEvents'.
Unfortunately I seem unable to find a fix myself.
After installing othree/javascript-libraries-syntax.vim
via pathogen, I am not able to get omnicomplete to recognize ng directives (ng-controller, etc.) in html files. Syntax highlighting works when I type out the entire name of a directive, but typing ng-
and then Ctrl-X Ctrl-O
results in no pattern being matched by omnicomplete. I am using Vim version 8.0.494 running in Cygwin through ConEmu. The SyntaxComplete plugin is included in this version of Vim. I have no other syntax highlighting plugins installed. I used the command :syntax
to verify that the syntax highlighting rules in the plugin's angularjs.html.vim file were in place. I used the command :set omnifunc?
to verify that omnifunc=htmlcomplete#CompleteTags
.
I wanted to enable syntax highlighting for chaijs with javascript and committed this file lately 5083ca8. I thought it might benefit other users of this very nice plugin.
I'm not a regular user of coffeescript/ls/typescript. I was hoping there would be an "automated way" to generate the corresponding syntax file, and maybe make a pull request afterwards.
Support for ramda would be great. I don't know anything about vim syntax coloring, otherwise I'd help (might look into it though). However, it should be very similar to lodash—if not exactly the same.
I get the following error when loading sugar.coffee.vim. It seems to be due to using "contains" as an argument to coffeeSFunction.
Error detected while processing
.../javascript-libraries-syntax.vim/autoload/syntax/sugar.coffee.vim:
line 72: E395: contains argument not accepted here
E475: Invalid argument: coffeeSFunction contained clamp clone contains every intersect isValid span toString union
E395: contains argument not accepted here
E475: Invalid argument: coffeeSFunction contained clamp clone contains every intersect isValid span toString union
With both plugins enabled, on these two line:
var a = new RegExp(/.$/i); var b = null;
The second line will be marked as error. Syntax region shows me that starting on the $
character it's matching the javascriptjQuery keyword while we're still inside the regexp literal.
I thought this was an issue with vim-coffee-script at first, but then I found kchmck/vim-coffee-script#143 in which someone else determined the issue actually stemmed from this library. I really like having using this library in coffeescript because I write a lot of tests in coffeescript, so I get highlighting on things like describe
and jasmine.createSpy
so I'd rather not just turn this off for coffeescript files. Any ideas if this could be fixed?
Screen shots below of a highlighting example with this library and without it.
With (tries to treat double quotes inside heredocs as strings and pound symbols as comments . . . also breaks highlighting after the heredoc because of double quote mismatch)
Without (everything looks correct, but I miss the nice highlighting on describe
)
Should this also be using vims/neovims omnicomplete functionality to provide any completion? In particular, loading the plugin does give me syntax highlighting for angular, but not code completion.
Would you please support google closure library? Many thanks.
is it possible to support Ember.js and Handlebars for syntax? Thanks
Seems like neovim should be supported either way, but there's no syntax highlighting when an angular file is opened in neovim. The same file with the same setup in regular vim does work however.
Hi, thanks for your useful plugin.
Look at the following.
As you can see in the url
's value, each time we have a dot, it is considered as a cssClass
so the string's highlighting is not good.
Is there any way to prevent that? Or the only solution will be to have same colors for both cssClass
and javascriptString
groups?
It might maybe be related to #43.
I have a jquery selector $('.ad-native-code');
where the word "native" gets syn highlighted
settings are
let g:used_javascript_libs = 'jquery,underscore,backbone,chai,handlebars'
the offending lib is "jquery"
other plugins included are:
" react/JSX syn highlighting for .cjsx
Plug 'mtscout6/vim-cjsx'
" indenting/highlighting, replaces 'jelera/vim-javascript-syntax', {
Plug 'othree/yajs.vim'
\| Plug 'gavocanov/vim-js-indent'
Plug 'othree/jsdoc-syntax.vim'
Plug 'othree/jspc.vim'
" extends syntax for with jQuery,backbone,etc.
Plug 'othree/javascript-libraries-syntax.vim'
" mxw/vim-jsx - react/JSX syn highlighting for .jsx
" requires a javascript syntax plugin first (e.g. yajs or vim-javascript)
Plug 'mxw/vim-jsx'
Error detected while processing ~/dotfiles/vim/bundle/javascript-libraries-syntax.vim/autoload/syntax/sugar.javascript.vim:
line 72:
E395: contains argument not accepted here
E475: Invalid argument: javascriptSFunction contained clamp clone contains every intersect isValid span toString union
E395: contains argument not accepted here
E475: Invalid argument: javascriptSFunction contained clamp clone contains every intersect isValid span toString union
The list of built-in services in #1 is fairly complete, but in directives, there are also $element
and $attributes
that can be injected. $element
is just a jQuery object, so it wouldn't have any methods attached to it that would need to be highlighted (if jQuery highlighting is already turned on). $attributes
has a few methods, however. From the docs here: $normalize, $addClass, $removeClass, $updateClass, $observe, $set, and $attr. (That last is actually just a property and not a function.) Any chance similar highlighting could be added to these things as is on the built-in services (e.g. $scope.$eval
)?
Vim throws an error when opening a typescript file b:current_syntax is not defined
.
I initially thought this problem was related to the Coffeescript syntax highlighting but apparently it's cause by (or a conflict with) javascript-libraries-syntax.
The original issue is described here: https://github.com/kchmck/vim-coffee-script/issues/165
Essentially only the first line of a multiline string is highlighted correctly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.