VonHeikemen / fine-cmdline.nvim

Enter ex-commands in a nice floating input.
MIT License
445 stars 7 forks source link

Feature Request: Integration with coq_nvim #13

Closed yingzhu146 closed 2 years ago

yingzhu146 commented 2 years ago

Similar to https://github.com/VonHeikemen/fine-cmdline.nvim/issues/7, but with https://github.com/ms-jpq/coq_nvim.

I think coq_nvim provides a fairly good plugin support. I have opened a sister issue there, too https://github.com/ms-jpq/coq_nvim/issues/398 to avoid duplication!

Thanks a ton!

VonHeikemen commented 2 years ago

Does coq_nvim have a source to complete from the built-in cmdline?

If so, try using Ctrl + Space in the floating input. It says on the readme is the default keybinding to trigger a completion. That should work.

If the source needs a specific prefix, like :, try changing the prompt in your config to remove the extra whitespace.

require('fine-cmdline').setup({
  hooks = {
    before_mount = function(input)
      input.input_props.prompt = ':'
    end
  }
})

If it works, then the next step is to disable default keymap of <Tab> in the floating input. So, the entire example would look like this.

local fineline = require('fine-cmdline')
local fn = fineline.fn

fineline.setup({
  cmdline = {
    enable_keymaps = false
  },
  hooks = {
    before_mount = function(input)
      input.input_props.prompt = ':'
    end,
    set_keymaps = function(imap, feedkeys)
      imap('<Esc>', fn.close)
      imap('<C-c>', fn.close)

      imap('<Up>', fn.up_history)
      imap('<Down>', fn.down_history)
    end
  }
})
yingzhu146 commented 2 years ago

thanks so much for the help time and code! This doesn't appear to work - my knowledge of both coq_nvim and fine-cmdline is very limited unfortunately.

1) I know that coq provides via lap viml support - not sure if you just need to set filetype correctly there? 2) complete-as-you-type would defs be requirement to compete with my current wilder.nvim setup, not sure if this is possible?

VonHeikemen commented 2 years ago

I know that coq provides via lap viml support - not sure if you just need to set filetype correctly there?

Interesting. So if you are in .vim file it can autocomplete commands? If that's the case then there is hope.

You can set the filetype in the popup options.

local fineline = require('fine-cmdline')
local fn = fineline.fn

fineline.setup({
  cmdline = {
    enable_keymaps = false
  },
  popup = {
    buf_options = {
      filetype = 'vim'
    }
  },
  hooks = {
    before_mount = function(input)
      input.input_props.prompt = ':'
    end,
    set_keymaps = function(imap, feedkeys)
      imap('<Esc>', fn.close)
      imap('<C-c>', fn.close)

      imap('<Up>', fn.up_history)
      imap('<Down>', fn.down_history)
    end
  }
})
VonHeikemen commented 2 years ago

I can't find any mention of completion sources for command-line-mode in their documentation. And vim-language-server doesn't seem to help either.

There is nothing I can do if they don't support completion for ex-commands.

VonHeikemen commented 2 years ago

The author of coq_nvim closed the issue on their repo. They won't add support for this plugin.

At this point the only possibility to make it happen is using null-ls with a custom completion source. A completion source for ex-commands doesn't exists just yet... so there is nothing I can do.