Shougo / neobundle.vim

Next generation Vim package manager
MIT License
2.29k stars 168 forks source link

neobundle-options-on_map's {mode} doesn't work #483

Closed toshi32tony3 closed 8 years ago

toshi32tony3 commented 8 years ago

on_mapのヘルプには以下のように記載されていますが、{mode}を指定しても"nxo"が適用されています。

on_map (List) or (String) Mappings list. The items are {mapping} or [{mode}, {mapping1}, [{mapping2}, ...]]. If {mode} is omitted, "nxo" is used.

以下の箇所でtype(v:val) == type([])の結果が期待した通りになっておらず、常にfalseと判定されているようです。 neobundle.vim\autoload\neobundle\config.vim

function! s:add_dummy_mappings(bundle) "{{{ let a:bundle.dummy_mappings = [] for [modes, mappings] in map(copy(a:bundle.on_map), " \ type(v:val) == type([]) ? \ [v:val[0], v:val[v:key]] : ['nxo', [v:val]] \ ") if mappings ==# ['']

Shougo commented 8 years ago

mode を指定するときは、 'on_map': [['nxo', '%', 'g%']] のようにしなければなりませんが、そうなっていますか。

Shougo commented 8 years ago

問題が発生する具体的な .vimrc の例を示してください。調査します。

toshi32tony3 commented 8 years ago

確認ありがとうございます。

mode を指定するときは、 'on_map': [['nxo', '%', 'g%']] のようにしなければなりませんが、そうなっていますか。

[[ ]]を2重に括っていなかったことが原因でした。例示して頂いたように修正したところ、指定したmodeでマッピングされていることを確認しました。

念のため問題が発生していた.vimrcを転記します。

set encoding=utf-8
scriptencoding utf-8

filetype plugin indent off

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

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

NeoBundle 'kana/vim-textobj-user'
NeoBundle 'sgur/vim-textobj-parameter', {
      \   'depends' : 'kana/vim-textobj-user',
      \   'on_map'  : ['xo', 'i,', 'a,'],
      \ }
call neobundle#end()

filetype plugin indent on
syntax enable
Shougo commented 8 years ago
                        *neobundle-options-on_map*
        on_map      (List) or (String)
        Mappings list. The items are {mapping} or
        [{mode}, {mapping1}, [{mapping2}, ...]].  If {mode} is
        omitted, "nxo" is used.
        Note: You can use plugin prefix mappings.
        For example, you can use "<Plug>(ref-" instead of
        "<Plug>(ref-back)" and so on.

となっているので、mode を指定するにはリストのリストにしなければなりません。 仕様です。

toshi32tony3 commented 8 years ago

迅速な対応ありがとうございました!