dial.nvim icon indicating copy to clipboard operation
dial.nvim copied to clipboard

Can't seem to get dial.nvim to function?

Open miversen33 opened this issue 3 years ago • 4 comments

While reading the Readme, its a little unclear how to get started before diving directly into all the configurations I know nothing about. The readme reads with a bit too much assumed knowledge (IMO).

As an example, I am using the below configuration

-- minimal.lua
require('packer').startup(function(use)
    use 'monaqa/dial.nvim'
    if packer_bootstrap then
        require('packer').sync()
    end
end)

As a test, I open up an unnamed buffer and enter in the following text

1
2
3
4

Entering normal mode, I hover over the first line (1) and use the following command :lua require("dial.map").inc_normal()

I assume I am doing something wrong but the readme doesn't call out a "here is how to get started" so I'm not really sure what I am doing wrong.

Edit: Some basic troubleshooting info

NVIM v0.8.0-dev+494-ge2f9d0332
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az21-224

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

:checkhealth

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $SSH_TTY='/dev/pts/2'

## tmux
  - OK: escape-time: 10
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: xterm-256color
  - INFO: default-terminal: tmux-256color
  - ERROR: $TERM differs from the tmux `default-terminal` setting. Colors might look wrong.
    - ADVICE:
      - $TERM may have been set by some rc (.bashrc, .zshrc, ...).
  - WARNING: Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
    - ADVICE:
      - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
          set-option -sa terminal-overrides ',XXX:RGB'
      - For older tmux versions use this instead:
          set-option -ga terminal-overrides ',XXX:Tc'

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: osc52

## Python 3 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - WARNING: Could not load Python 3:
    /usr/bin/python3 is Python 3.6 and cannot provide Python >= 3.7.
    python3.10 not found in search path or not executable.
    python3.9 not found in search path or not executable.
    /usr/bin/python3.8 does not have the "neovim" module.
    python3.7 not found in search path or not executable.
    /usr/bin/python is Python 3.6 and cannot provide Python >= 3.7.
    - ADVICE:
      - See :help |provider-python| for more information.
      - You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim
  - INFO: Executable: Not found

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.
      - You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim

## Node.js provider (optional)
  - INFO: Node.js: v14.18.1
  - INFO: Nvim node.js host: /home/miversen/.config/yarn/global//node_modules/neovim/bin/cli.js
  - WARNING: Package "neovim" is out-of-date. Installed: 4.10.0, latest: 4.10.1
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

## Perl provider (optional)
  - WARNING: "Neovim::Ext" cpan module is not installed
    - ADVICE:
      - See :help |provider-perl| for more information.
      - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

miversen33 avatar Aug 16 '22 14:08 miversen33

As noted in Installation, dial.nvim can be installed in the same way as a typical plugin. As noted in Usage, to use dial.nvim, you need to assign dial.nvim functions to your favorite keys (such as <C-a> or <C-x>) in your init.vim:

nmap  <C-a>  <Plug>(dial-increment)
nmap  <C-x>  <Plug>(dial-decrement)
vmap  <C-a>  <Plug>(dial-increment)
vmap  <C-x>  <Plug>(dial-decrement)
vmap g<C-a> g<Plug>(dial-increment)
vmap g<C-x> g<Plug>(dial-decrement)

or in init.lua:

vim.api.nvim_set_keymap("n", "<C-a>", require("dial.map").inc_normal(), {noremap = true})
vim.api.nvim_set_keymap("n", "<C-x>", require("dial.map").dec_normal(), {noremap = true})
vim.api.nvim_set_keymap("v", "<C-a>", require("dial.map").inc_visual(), {noremap = true})
vim.api.nvim_set_keymap("v", "<C-x>", require("dial.map").dec_visual(), {noremap = true})
vim.api.nvim_set_keymap("v", "g<C-a>", require("dial.map").inc_gvisual(), {noremap = true})
vim.api.nvim_set_keymap("v", "g<C-x>", require("dial.map").dec_gvisual(), {noremap = true})

Please check first that it works according to the documentation.

:lua require("dial.map").inc_normal()

This should not work, because this function only returns the key sequence.

monaqa avatar Aug 16 '22 14:08 monaqa

I suppose I am confused.

As noted in Installation, dial.nvim can be installed in the same way as a typical plugin.

My configuration provided includes the installation of dial.nvim, seen

-- minimal.lua
require('packer').startup(function(use)
    use 'monaqa/dial.nvim' -- Right here
    if packer_bootstrap then
        require('packer').sync()
    end
end)

Additionally, if it weren't installed, the lua command require("dial.map").inc_normal() would explode, which it does not. I am not receiving an error when using, I am simply seeing nothing. No feedback, no change, etc.

Additionally, there should be no difference between

vim.api.nvim_set_keymap("n", "<C-a>", require("dial.map").inc_normal(), {noremap = true})

and : lua require('dial.map').inc_normal()

The only difference here is I am assigning the above lua command to <C-a>. If the lua command itself does nothing (as you noted), then the keymap will do nothing. I can verify that the keymap indeed does nothing in the above setup.

Please check first that it works according to the documentation.

I did and that is why I am here. I am (it seems) having trouble in getting this to work per the documentation, which leads me to believe I am misunderstanding something in the documentation. This is a relatively popular project so I am certain this is a "me" issue. A bit of guidance as opposed to

Go read the doc

would be greatly appreciated as I did so (and referenced the sections) before posting this issue.

miversen33 avatar Aug 16 '22 15:08 miversen33

Ahh, I am seeing it, so

: lua print(require('dial.map').inc_normal())

This prints out

<Cmd>lua require"dial.command".select_augend_normal()<CR><Cmd>let &opfunc="dial#operator#increment_normal"<CR>g@<Cmd>lua require("dial.command").textobj()<CR>

I assumed that the command was performing the command to increment and we were simply binding that command to a key shortcut. That explains why

This should not work, because this function only returns the key sequence.

I was having issues with a custom binding not working so I figured I would start debugging why the binding wasn't working which is what got me to running the command itself and seeing nothing happen.

Sounds like I turned this into an x/y problem which is my bad.

All that said, the provided minimal config (which is just install dial.nvim and use the documented key bindings as were recommended in the readme) does nothing, so the main issue still persists. Any ideas what I am doing wrong? Is the minimal config wrong? Can you verify my issue or get me on the right track to hunting down what I am doing wrong?

miversen33 avatar Aug 16 '22 16:08 miversen33

All that said, the provided minimal config (which is just install dial.nvim and use the documented key bindings as were recommended in the readme) does nothing, so the main issue still persists. Any ideas what I am doing wrong? Is the minimal config wrong? Can you verify my issue or get me on the right track to hunting down what I am doing wrong?

Can you provide a minimal config file that can reproduce the situation?

monaqa avatar Aug 20 '22 00:08 monaqa

The problem is regarded as resolved and closed.

monaqa avatar Oct 18 '22 23:10 monaqa