slashmili/alchemist.vim

Change short keys bindings for ExDoc?

kenny-evitt opened this issue · 7 comments

I followed the instructions on the wiki debugging page and all of the test commands worked as expected.

Questions:

  1. Elixir/OTP/Python version

Elixir: 1.8.0

OTP: 21.2.3

Python: python --version reports Python 2.7.16

  1. Are you using VIM or Neovim? Please provide the version.

I'm using VimR 0.20.3 (255) which uses Neovim. The output of the :version command:

NVIM v0.2.2
Build type: Release
Lua 5.1
Compilation: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -mmacosx-version-min=10.10 -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/neovim/build/config -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/neovim/src -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/neovim/.deps/usr/include -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/neovim/.deps/usr/include -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/neovim/.deps/usr/include -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/neovim/.deps/usr/include -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/third-party/libintl/include -I/usr/include -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/neovim/build/src/nvim/auto -I/Users/hat/.jenkins/workspace/vimr_build/NvimView/neovim/build/include
Compiled by hat@iota.fritz.box

Features: +acl +iconv +jemalloc -tui 
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
     fall-back for $VIM: "/usr/local/share/nvim"

     Run :checkhealth for more info
  1. Which pluging are you using:

[ ] basic omnifunc
[ ] YouCompleteMe
[ ] deoplete

  1. Which steps of Debugging passed?

[x] Elixir Module definition
[x] Elixir Function definition
[x] Elixir Module/Function docs
[x] Your Project Module definition
[x] Your Project Function definition

  1. Do you have a specific setup? Like Docker and etc

I don't think so.

Problems

As I described in this previous issue:

... the short key bindings don't work. The wiki mentions configuration options to change the short key bindings for the ExDef command(s) but not for the ExDoc command(s).

This line seems to setup the binding:

If that's correct, can I add info about it to the main wiki page?

Sure! Feel free to update wiki.

Based on your experience does setting g:alchemist_keyword_map work?

@slashmili I was wrong about the short key binding not working. I was just getting an error because I hadn't previously installed the syntax highlighting plugin too. Or maybe it wasn't working initially because of some other reason I missed.

(I thought the ExDef binding wasn't working but that's because I was missing the Shift, i.e. effectively trying Ctrl+] – wait, it is NOT working! It works when I use Ctrl+Shift+] which I would guess would correspond to '<C-}>', not '<C-]>'. I'm confused!)

So, as you might have guessed based on the above, I'm not sure I'm doing this correctly. I added this line to my 'vimrc' (Neovim init.vim) file (at the end):

let g:alchemist_keyword_map = '<S-F2>'

I sourced the file but the old mapping still works and the new one doesn't.

Yeah the default keybinding for capital k is to lookup for docs! e.g. If you open any file(not elixir) and for example write ls and press K in normal, it open man page of ls

regarding ExDef key binding, it's strange. I suggest you to try map something that you know that it works to Ctrl + ] and see if the binding works or not. It works for me 😢

Regarding ExDoc key binding, I tried this and it works

let g:alchemist_keyword_map = '<C-R>'

But not <S-F2> 😞 Again try to map them to something you know and this key binding is working in other circumstance, I'll dig more into this plug code and debug it.

@slashmili Something's definitely wonky with my setup, or so I'm guessing. K stopped working for me, to run the ExDoc command, but Shift+F2 started working for me, and this is a bit after I'd removed the 'keyword map' command from vimrc file (and re-sourced it).

I'm also getting this error when I try it, but only intermittently:

man.vim: command error (18) man -w retry_settings: No manual entry for retry_settings

man.vim is referring to, or so I gather, a standard Neovim (or Vim?) plugin, which Alchemist should be shadowing/overriding for Elixir files (also so I gather).

I suspect the issue with the ExDef binding might be related, but then, honestly, something more fundamental seems to be somewhat broken with my setup.

Thanks for your help so far!

This also happens to me if I press K in a random file. So this is expected 👍

Screenshot 2019-07-11 at 21 10 36

It means that the rebinding worked and now Alchemist ExDoc binding has changed to something else

@slashmili Yeah, I figured man.vim was running man, but I was seeing that with an Elixir file open and then, after trying the same command again shortly thereafter, without changing my vimrc or anything else, I'd get the Alchemist ExDoc output in a new window as expected.

I'm not sure what could be causing my bindings to change like this. I suspect it might be the way VimR wraps Neovim or maybe something to do with how both of those two resume from system suspension/hibernation. 🤷‍♂

I'm confident that binding configuration setting worked, modulo the weirdness I've personally observed, but I can't seem to edit the wiki page. I don't see the "Edit" button like I'd expect.

I close the issue for now, let me know if I can help further