Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ALE interfering with the execution/evaluation of imap definitions #1941

@sriedel

Description

@sriedel

Information

VIM version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 29 2018 20:42:12)
Included patches: 1-333

Operating System: ArchLinux

:ALEInfo

Current Filetype: ruby
Available Linters: ['brakeman', 'rails_best_practices', 'reek', 'rubocop', 'ruby']
Enabled Linters: ['rubocop', 'ruby']
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'rubocop' - Fix ruby files with rubocop --auto-correct.
'rufo' - Fix ruby files with rufo
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:
let g:ale_ruby_rubocop_executable = 'rubocop'
let g:ale_ruby_rubocop_options = ''
let g:ale_ruby_ruby_executable = 'ruby'
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_lint_on_insert_leave = 0
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let b:ale_linters = {'ruby': ['ruby', 'rubocop']}
let g:ale_linters_explicit = 0
let g:ale_list_window_size = 10
let g:ale_list_vertical = 0
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 1
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) rubocop
(finished - exit code 0) ['/bin/bash', '-c', '''rubocop'' --format json --force-exclusion --stdin ''/home/sr/foo.rb'' < ''/tmp/vFk9Rpk/1/foo.rb''']
<<>>
{"metadata":{"rubocop_version":"0.59.1","ruby_engine":"ruby","ruby_version":"2.5.0","ruby_patchlevel":"0","ruby_platform":"x86_64-linux"},"files":[{"path":"foo.rb","offenses":[]}],"summary":{"offense_count"
:0,"target_file_count":1,"inspected_file_count":1}}
<<>>

What went wrong

I have an imap command in order to annotate comments with my initials and the current date:
imap #sr (sr<Space><C-R>=strftime("%Y-%m-%d")<Space><CR>)

As soon as the ALE plugin is loaded, triggering the map becomes very non-deterministic, failing more often than not. To be clear: when I mean "it doesn't trigger", vim actually writes the character sequence '#sr' instead of e.g. '(sr 2018-09-20)'. It seems to be harder to trigger the map within a comment (~ 1 in 10 success rate), while outside a comment the success rate is higher(~1 in 3).

I've tried removing the linter definition for ruby (and thus having ale in its default configuration), without change in the behaviour. I've tried changing the prefix '#' of the imap sequence to '$', without change in the behaviour. Removing the ale plugin altogether has the map working again as expected.

I'm also using the vim-ruby plugin, for syntax and highlighting definitions. I'm mostly using gvim, however the behaviour of pure vim seems to be identical.

Reproducing the bug

  1. Start gvim with a ruby file.
  2. Start a comment
  3. Try to trigger the imap definition above.
  4. See the trigger character sequence appearing in the buffer instead of the expected outcome, more often than not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions