Skip to content

index out of range, 142_save_by_filetype, line 5, proposed fix #98

@stepds

Description

@stepds

I think you could change something in file easytags.txt to avoid a run-time error.
File easytags.txt says about g:easytags_languages option
[...]

  let g:easytags_languages = {
  \   'language': {
  \     'cmd': g:easytags_cmd,
  \       'args': [],
  \       'fileoutput_opt': '-f',
  \       'stdout_opt': '-f-',
  \       'recurse_flag': '-R'
  \   }
  \}

Each key is a special language definition. The key is a Vim file type in
lowercase. The above snippet shows the defaults; you only need to specify
options that differ.

And so I did, I only specified options that differ, like so (Windows _vimrc):

  let g:easytags_languages = {
  \   'r': {
  \     'cmd': g:easytags_cmd,
  \       'args': [ '"--options='.$VIM.'\ctags\ctags.cnf" ],
  \       'fileoutput_opt': '-f',
  \       'stdout_opt': '-f-',
  \       'recurse_flag': '-R'
  \   }
  \}

But something was missing because when I ran :UpdateTags easytags output an error message

easytags.vim 3.7: Vim(let):E684: list index out of range: 4 (at function xolox#easytags#update..xolox#easytags#update#with_vim..<SNR>142_save_by_filetype, line 5)

I worked around this error by specifying more options for my custom command. I copied some options from the default call to ctags in function s:prep_cmdfile. So now easytags tags .r files just fine with the changed line in _vimrc:

  \       'args': [ '"--options='.$VIM.'\ctags\ctags.cnf" --fields=+l --sort=no' ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions