Giter Club home page Giter Club logo

context_filetype.vim's People

Contributors

aiya000 avatar bb010g avatar crazymaster avatar dear avatar endaaman avatar freed-wu avatar hrsh7th avatar jagua avatar kosukemizuno avatar msr1k avatar nilsboy avatar osyo-manga avatar shougo avatar syngan avatar tmsanrinsha avatar tsuyoshicho avatar tyru avatar weirongxu avatar yymm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

context_filetype.vim's Issues

バッファローカルな filetypes 定義を追加したい。

最近 dein.vim 用にtomlで hook_* 系にマッチするルールを追加してみて、これは便利だと感動しながら他にも使い所を考えてたらすぐに感じた事です。

例えばTOML一つにしても、今はまだ toml を使う機会はあまり多くありませんが、今後は色んなアプリケーションでtoml形式のファイルを扱うようになってくる予感がしています。
そうしてグローバルな g:context_filetype#filetypes の同じ filetype に対する設定を追加しはじめると設定の競合が起きてきそうな事と不用なパターンの検索で遅くなりそうな事を問題に感じました。

ファイル名が dein*.toml のときだけ toml に hook_* 系のルールを追加したいという場合は、autocmdb:context_filetype#filetypes を定義してやることでグローバル設定と合わせてこれも使うという事が出来ると良いのかなと思います。

VueJS custom block

Hi,

Would it be possible to add support for VueJS custom blocks ? The custom blocks can have any name:

<someName>
</someName>

Here, get_filetype() could return someName or vue-someName. This would be useful for toggling comments inside those blocks. (currently i'm copying the default configuration for vue and adding each custom block manually)

Thanks.

ソースコードのコーディングスタイルの統一

Shougo さんとコーディングスタイルがだいぶ違う感じなので共通化する為のまとめとか。

コーディングスタイル

  • インデント
    • スペース2
  • fold
    • foldmethod=marker
    • 関数を折りたたむ
  • \ の位置
    • インデントよりも→

他に決めておいたほうがいいものがあれば教えて下さい。
そこまで多人数で開発する予定はない(と思う)ので、大まかな部分(全体的なインデントとか)だけ決めておいて細かい部分(どこにスペースを開けるかとか)は特に決めないでもいいと思っているんですがどうでしょうか。

HTMLファイル内のstyle属性でCSSの補完が出来ない

neosnippet.vimのissue
から移ってきました
吉永です

ただ補完が出来ないと言うより、制限、仕様のような気がしていますが、念の為ご報告ということで

最後に動画を載せましたが

  1. style 属性の属性値が「"」ではなく「'」で挟まれている場合は、そもそも CSS扱いにならない←これは osyo-manga/vim-precious の問題?
  2. style タグ/属性どちらでも、CSS の補完が出る
  3. ただし条件が有り、タグや属性名 style=と CSS のプロパティが同一行に有る場合は、補完候補が現れない

感想として

  • styleタグを用いる場合は、たいてい次の行から CSS を書くので現状で何の不便もなし
  • HTML の属性値内部で改行するのは、文法違反なので上の制限は少し残念

他環境は直近のissueと同じです
context_filetype_html-css

正規表現エンジン NFA を使用している場合に context_filetype#get() が遅い

正規表現エンジン NFA を使用している場合に context_filetype#get() が遅くなるケースがあったので報告しておきます。
同じバッファで処理時間を測ってみた場合、以下のようになりました。

行位置 NFAの有無 処理時間(ms)
1000 なし 0.0019
1000 あり 0.0151
2500 なし 0.0034
2500 あり 0.0828

g:context_filetype#search_offset はデフォルト値

現状では g:context_filetype#search_offset の値を小さくしたり、NFA を使用しないようにすることで回避することが可能です。
この問題は context_filetype.vim を使用しているプラグイン(neocomplete.vim 等)に影響してくると思います。

javascript in html can't work

if !exists('g:context_filetype#same_filetypes')
  let g:context_filetype#filetypes = {}
endif
let g:context_filetype#filetypes.svelte = [
\ {'filetype' :'javascript', 'start': '<script>', 'end': '</script>'},
\ {'filetype' :'css', 'start': '<style>', 'end': '</style>'},
\ ]
call deoplete#custom#var('omni', 'functions', {
\ 'css': ['csscomplete#CompleteCSS'],
\})

It let css-completion work,
but javascript doesn't work with YCM, inside HTML.

Even with deoplete, comment out the YCM.

call deoplete#custom#option('omni_patterns', { 
\ 'javascript': '[^. *\t]\.\w*',
\ 'go': '[^. *\t]\.\w*',
\})

In .js it work.
But in html it doesn't work too.

filetypedetection is a little weird with comments

Hi there, love your work,
am using dein with toml configuration and im using caw for commenting which uses context_filetype.

in the gif im trying to show that the context_filetype is behaving a little weird with comments.
normally when at the end of a multiline comment in toml (''') the detected filetype is toml, but when i comment the line out it becomes vim.
i try to show this by moving around and echoing g:context_filetype#get_filetype() in diffrent places, commented and not.

in the end you can see when i try to toggle the comments for block and my cursor ends up at the bottom, it detects vim filetype and creates new vim comments instead of removing the toml comments.
but if i end up at the top where it detects toml it uncomments.

context_filetype_comment

error: after #44 merged, end match fail

#44 マージ後に追加設定なしで、以下の操作がエラーします

手順

  1. deinのtomlを開く
  2. hookの領域に入る

ログ

function precious#context_filetype[2]..99[5]..context_filetype#get_filetype[2]..context_filetype#get[3]..<SNR>327_get_nest[1]..<SNR>327_get_context[20]..<SNR>327_search_range の処理中にエラーが検出されました:
行   28:
E65: 不正な後方参照です
function precious#context_filetype[2]..99[5]..context_filetype#get_filetype の処理中にエラーが検出されました:
行    2:
E121: 未定義の変数です: filetype

(preciousのエラーも出ますが、参考までに付けています)

確認

以下のデバッグコードを入れ

echom 'end forward search:' end_pattern
let end_forward = searchpos(end_pattern, 'ncW', stopline_forward)

再現させると

end forward search: \1\V'''\m

となりました。

searchposへ \1 を含んだパターンが入ったためのようです。

備考

マージ前のcontext_filetypeが残っている環境での動作に問題ないことは確認しました。

omnicomplete issue in markdown.

in markdown file

``` java
//here can use neosnippet,and java syntax identity
//but can not use javacomplete2,maybe it is issue of jc2
```html
omnifunc works well
```javascript
omnifunc not work

Using syntax completion inside a markdown block

Hi Shougo

Please help me - I tried all I could think of, but couldn't get this done..
I am using your neco syntax for filename.m files and getting completion with deoplete all right.
I also confirm that context_filetype plugin works well with deoplete-jedi within markdown like this

markdown

``` python
# python complete works here with jedi
```

My problem

When I use the filetype (mathematica) mma associated with files filename.m,

markdown

``` mma
syntax completion doesn't work here
```

I have tried adding (after reading some of the questions here)

call deoplete#custom#source('omni', 'functions', {
\ 'mma': ['syntaxcomplete#Complete']
\})

to my init.vim, but it doesn't work. I don't know what I should do!

And more importantly, thank you so much for your plugin. Your work is awesome!

Idea/Question: neocomplcache migration guide?

Hello Shougo.

I've been using neocomplcache and I have some configurations options in my .vimrc of course...

So, in order to migrate to neocomplete, do we have to do anything? or just doing something like %s/neocomplache/neocomplete/g would be enough?

Finally, if there's anything we need to do for this migration, it might be a good idea to include it in the README somewhere?

Thanks for the great plugin(s)!

context_filetype#get() の改善案

現在(branch/precious)、コンテキストのデータを取得する関数として

  • context_filetype#get() - コンテキストの filetype を返す
  • context_filetype#get_range() - コンテキストの範囲を返す

を使用する事ができます。

で、この2つの関数なのですが場合によってはcontext_filetype#get()context_filetype#get_range()を同時に呼び出すこともあると思います。
しかし、この場合、2つの関数の内部で殆ど同じ処理を行なっているので処理が重複してしまい無駄が発生します。
そこで次のような関数に変更するのはどうでしょうか。

  • context_filetype#get_range() - コンテキストの範囲を返す(変更なし)
  • context_filetype#get_filetype() - コンテキストの filetype を返す(context_filetype#get()から名前の変更)
  • context_filetype#get() - コンテキストの範囲と filetype をまとめて返す(機能変更)

context_filetype#get_range()context_filetype#get_filetype()context_filetype#get()のラッパー関数です。
context_filetype#get()が返す内容は下記のようなフォーマットを考えています。

{
    "filetype" : "vim",
    "range" : [[3, 2], [10, 2]]
}

" もうちょっと細かく分割するのもあり?
" {
"   "filetype" : "vim",
"   "range" : {
"       "start" : [3, 2],
"       "end"   : [10, 2]
"   }
" }

片方のデータが欲しい場合は context_filetype#get_range()context_filetype#get_filetype()を使用し、両方(全て)のデータが欲しい場合はcontext_filetype#get()を使用します。

こんな感じに変更するのはどうでしょうか。
(あとこれを考えて思ったんですが、プラグイン名はcontext_filetypeよりもcontextの方がすっきりするんじゃないかと思いました。context#get_filetype()context#get_range()

vim-preciousとの統一をする

@osyo_mangaさんが独自にvim-preciousというよく似たプラグインを開発しているようです。
ライブラリが分散するのは良くないので、統一しようと考えています。

https://github.com/osyo-manga/vim-precious

まずは、@osyo_mangaさんが何をやりたいのか説明してもらえますか?

Setting up

Hello; I am trying to figure out how to configure and use this library/plugin. I am using https://github.com/preservim/nerdcommenter plugin for comments, and would like to comment CSS block in HTML document correctly as well, for that I have the following configuration in vimrc:

if !exists('g:context_filetype#filetypes')
  let g:context_filetype#filetypes = {}
endif

let g:context_filetype#filetypes.vim =
\ [
\   {'filetype' : 'css', 'start' : '<style>', 'end' : '</style>'},
\ ]

But it does not work, because apparently I need somehow else to connect nerdcommenter, but do not understand how. Can you point to a solution/mistakes? Thx!

Does it detect front matter of markdown as YAML?

This is a test.md:

---
title: "Habits"
author: John Doe
date: March 22, 2005
output:
  pdf_document:
    includes:
      in_header: header.tex
      before_body: doc_prefix.tex
      after_body: doc_suffix.tex
---

# H1 Title

## H2 Title

I try caw.vim and I expect:

---
title: "Habits"
author: John Doe
# date: March 22, 2005
output:
  pdf_document:
    includes:
      in_header: header.tex
      before_body: doc_prefix.tex
      after_body: doc_suffix.tex
---

# H1 Title

## H2 Title

However:

---
title: "Habits"
author: John Doe
<!-- date: March 22, 2005 -->
output:
  pdf_document:
    includes:
      in_header: header.tex
      before_body: doc_prefix.tex
      after_body: doc_suffix.tex
---

# H1 Title

## H2 Title

I notice caw.vim use context_filetype.vim. So does it detect front matter of markdown as YAML?

Does it work by default?

I found that there is nothing mentioned about the usage of context_filetype.vim. It should be mentioned in the wiki or the doc at least.

not working in my case with html

Hi there, I've tried this plugin with Deoplete and omnicomplete, and It didn't work when typing css in style tag in html. I've read the doc to try to set some values, but I found that this plugin comes with default values that should work without settings. Something wrong? more info on this issue
2017-01-30 08 14 45

git による開発手順

git を使用した多人数の経験がないので正しいのかはわからないんですがわたしの開発イメージをまとめてみました

  • 互換性のない変更や大きな追加機能を行う場合はその都度ブランチを切ってそこで作業を行う
    • 最終的に両人(Shougo さんとわたしと+α?)が問題ないと判断すれば master へ merge
  • typo や g:context_filetype#filetypes への設定追加などの細かい修正は直接 master へ push する

とか考えているんですがどうでしょう。
他にも『ガンガン master へ push していく』や『いや、branch/dev を作ってそこで開発するべきだ!』みたいな意見があったら教えてもらえると助かります。
ここら辺は最初にある程度の方針だけ決めておいて、開発していくうちに修正していけばいいかなーと考えています。
まぁそこまで頻繁に開発が行われるのかはわかりませんが。

context_filetype.vim を vital の外部モジュール化する

今すぐやるわけではないですが覚書程度につくっておきます。

メリット

  • context_filetype.vim プラグインに依存しなくなる

デメリット

  • vital-context_filetype(仮)に設定をした場合、使用している各プラグインの vital-context_filetype モジュールを更新する必要がある

課題・問題点

  • g:context_filetype#filetypes 等のグローバルオプションの扱いをどうするか

add css in 'html' file inline

in case of <div sytle="***"
i wrote this for reference:

{
      \    'start': '\sstyle="',
      \    'end': '\sstyle="[^"]*\zs"', 'filetype': 'css',
}

Markdownの中にMarkdownを書こうとするとエラーが出る

エラー内容

Error detected while processing function neocomplete#handler#_do_auto_complete..neocomplete#helper#is_omni..neocomplete#get_context_filetype..neocomplete#context_filetype#set..context_filet
ype#get_filetype..context_filetype#get..<SNR>45_get_nest..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest
_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl
..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SN
R>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_
get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_n
est_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_i
mpl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..
<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>
45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_ge
t_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nes
t_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_imp
l..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_nest_impl..<SNR>45_get_context..<SNR>45_search_range:
line    1:
E132: Function call depth is higher than 'maxfuncdepth'

再現する最小のvimrc

set nocompatible
filetype off

if has('vim_starting')
  set runtimepath+=~/.vim/bundle/neobundle.vim/
endif

call neobundle#rc(expand('~/.vim/bundle/'))

NeoBundleFetch 'Shougo/neobundle.vim'

NeoBundle 'Shougo/neocomplete', {
\   'depends': ['Shougo/context_filetype.vim']
\ }
filetype plugin indent on

let g:neocomplete#enable_at_startup = 1

再現するファイル

https://gist.github.com/pocke/36989eb82b1315d78a6e

再現方法

  1. 上記vimrcで上記ファイルを開く
  2. set ft=markdownする
  3. 上記ファイルのhogeの部分にカーソルを移動する、インサートモードに入る

インサートモードに入らなくても再現する場合もありました。


  • 他のファイルタイプの時に、同じファイルタイプを内包している場合については調べていません、ごめんなさい。
  • 上記vimrcから、'depends': ['Shougo/context_filetype.vim']の部分を削除したところ、再現しませんでした。

fileencodingが変更される

  • kaoriya-vim 7.4.475 (Windows7 64bit)
  • vim 7.4.142 (CentOS 6.5 64bit ソースからコンパイル)
  • set fileencodings=utf-8,cp932 および set fileencodings=cp932,utf-8 両方で発生

CP932の日本語を含むhtmlファイルを開いた時、scriptタグ内にカーソルを移動するとfileencodingがUTF-8に変更されます。html部、js部両方に2バイト文字が含まれます。

g:context_filetype#filetypes をライブラリ側とユーザ側で変数を分けたい

ざっとまとめてみたので上げてみます。
#1 でも話に出てきたのですが、ユーザが設定する変数とライブラリ側のデフォルトの設定を明確に区別したいという考えです。

ライブラリ側の設定をg:context_filetype#filetypes_default、ユーザ側の設定をg:context_filetype_filetypesというのはどうでしょうか。

メリット

  • 明示的に区別して使用する事が出来る
    • !exists('g:context_filetype#filetypes') 等でチェックを行う必要がない
  • ユーザがうっかりg:context_filetype#filetypesを初期化したり破壊してしまう危険性が減る
    • 現在はg:context_filetype#filetypesを直接操作している為、その危険性は十分ありうる
  • あとからデフォルト値を参照する事が出来る
  • 下記に記述してあるような設定の書き方を行える
    • g:context_filetype_filetypes へ1回の記述で設定する方がわかりやすいのではないだろうか

デメリット

  • 毎回マージするコストが掛かる
  • 似たような名前の変数があり混乱する
    • 個人的には末尾に _default をつければそこまで混乱はしないと思う

動作イメージ

  • ライブラリ側では g:context_filetype#filetypes_default のみを容易しておく
    • g:context_filetype_filetypes は定義しない(もしくは {} を初期値として変数だけ用意しておく?
  • ユーザ側が filetypes を追加する必要があれば g:context_filetype_filetypes へと追加してもらう
  • context filetype を取得する場合、g:context_filetype#filetypes_defaultg:context_filetype_filetypesの両方を使用して判定する
    • この場合、g:context_filetype_filetypes の設定が優先される

設定の記述例

let g:context_filetype_filetypes = {
\   "perl6" : {
\       [
\           {
\               'filetype' : 'pir',
\               'start' : 'Q:PIR\s*{',
\               'end' : '}'
\           }
\       ],
\   },
\   "vim" : {
\       [
\           {
\               'filetype' : 'python',
\               'start' : '^\s*python <<\s*\(\h\w*\)',
\               'end' : '^\1'
\           }
\       ]
\   }
\}

" if !exists('g:context_filetype#filetypes')
"   let g:context_filetype#filetypes = {}
" endif
" let g:context_filetype#filetypes.perl6 =
" \ [{'filetype' : 'pir', 'start' : 'Q:PIR\s*{', 'end' : '}'}]
" let g:context_filetype#filetypes.vim =
" \ [{'filetype' : 'python',
" \   'start' : '^\s*python <<\s*\(\h\w*\)', 'end' : '^\1'}]

気になるのは毎回マージするコストですかね。

Improve (or revert) cgo support

Current s:default_filetypes.go definition is here.
bf0ff13

      \ 'go': [
      \   {
      \    'start': '^\s*/\*$',
      \    'end': '^\s*\*/\n\s*import\s\+"C"$', 'filetype': 'c',
      \   },

'end' pattern matches lines after "*/"(?),
So context_filetype.vim sets 'c' to filetype in and after(!) C-style comment lines.

I made simple fix,

diff --git a/autoload/context_filetype.vim b/autoload/context_filetype.vim
index 1d3ba8a..b5ebb09 100644
--- a/autoload/context_filetype.vim
+++ b/autoload/context_filetype.vim
@@ -319,7 +319,7 @@ let s:default_filetypes = {
       \ 'go': [
       \   {
       \    'start': '^\s*/\*$',
-      \    'end': '^\s*\*/\n\s*import\s\+"C"$', 'filetype': 'c',
+      \    'end': '^\s*\*/\s*\_.\{1}\s*import\s\+"C"$', 'filetype': 'c',
       \   },
       \ ],
 \}"}}}

but, it does not work for a file with multi C-sytle comments.

package main

`go`

/*

`go`

*/

`go`

/*

`c`

*/
import "C"

`go`

Second and third 'go' are not correctly set(c).

context_filetype のパフォーマンスに関して

#1 から派生。

巨大なファイルの場合だと重いという事で実際の処理速度を測ってみました。


#### 実測のチェック関数
function! s:context_filetype(num)
    let start_time = reltime()

    for i in range(a:num)
        call context_filetype#get()
    endfor

    return str2float(reltimestr(reltime(start_time))) / a:num
endfunction


function! Check()
    let num = 10

    " context_filetype#get() の1回辺りの処理時間を計測
    echo s:context_filetype(num)
endfunction

#### 対象のファイル

適当なファイルが無かったので eval.txt(約8000行)をバッファにコピーし、行頭python << HOGEHOGE、行末にHOGEHOGEを追加して、set filetype=vim として試してみました。


#### 実行速度

以下の各行でcall Check()した結果です。
また、stopline と timeout は使用していない状態です。

  • 500行 - 0.003553ms
  • 1000行 - 0.004264ms
  • 2000行 - 0.006412ms
  • 4000行 - 0.010499ms
  • 6000行 - 0.014656ms
  • 8000行 - 0.018460ms

また、コンテキストがネストしているとその分だけ searchpos を処理する回数が増えるので更に時間がかかると思います。


#### 原因 - 行数に比例して searchpos の処理が遅くなる為
#### 対応策 - stopline を設定 - timeout を設定

個人的には stopline の閾値だけがユーザ側で設定出来れば十分だと思います。


#### その他

試しに下記のように autocmd CursorMoved で処理するようにしてみました。
これを↑のファイルで動作させてみたんですが個人的にはあまり重いとは感じないレベルでした。

augroup test-context_filetype
    autocmd!
    autocmd CursorMoved,CursorMovedI * echo context_filetype#get()
augroup END

Neovim could be blocked for more than a second somtimes.

When this plugin enabled and using nvim >= 0.6.0 with iTerm2 on Mac, nvim could be blocked for more than a second sometimes.

To reproduce, type command :h a and :h b many times.

My computer:

MacOS 12.1
Processor: 2.6 GHz 6-Core Intel Core i7
Memory: 16 GB 2667 MHz DDR4

No happens on vim8 or other terminal.

javascript inside HTML error

I have added following lines to my .vimrc:

if !exists('g:context_filetype#same_filetypes')
  let g:context_filetype#filetypes = {}
endif
let g:context_filetype#filetypes.svelte = [
\ {'filetype' :'javascript', 'start': '<script>', 'end': '</script>'},
\ {'filetype' :'css', 'start': '<style>', 'end': '</style>'},
\ ]
call deoplete#custom#var('omni', 'functions', {
\ 'css': ['csscomplete#CompleteCSS'],
\})

It lets css-completion work, but javascript doesn't work with YCM, inside HTML.

then to add following lines to my .vimrc:

call deoplete#custom#option('omni_patterns', { 
\ 'javascript': '[^. *\t]\.\w*',
\ 'go': '[^. *\t]\.\w*',
\})

In .js it work.
But in html it doesn't work too.

Originally posted by @yangxyo in #41 (comment)

Problem with svelte and deoplete

I have added following lines to my .vimrc:

if !exists('g:context_filetype#same_filetypes')
    let g:context_filetype#filetypes = {}
endif
let g:context_filetype#filetypes.svelte =
            \ [
            \    {'filetype' : 'javascript', 'start' : '<script>', 'end' : '</script>'},
            \    {'filetype' : 'css', 'start' : '<style>', 'end' : '</style>'},
            \ ]

This helps with javascript autocompletion but css autocompletion does not work.

Adding this helps with css autocomplete but I think this shouldn't be necessary:

autocmd FileType svelte setlocal omnifunc=csscomplete#CompleteCSS

Any ideas what's wrong?

My .vimrc can be found here https://github.com/daliusd/cfg/blob/master/.vimrc if it is necessary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.