-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Renaming rhs: expected string|function #302
Comments
Failed to reproduce with the following init.lua Do other keymaps have similar issues? I feel might be related to lazyloading. vim.cmd([[set runtimepath=$VIMRUNTIME]])
local uv = vim.uv or vim.loop
local os_name = uv.os_uname().sysname
local is_windows = os_name == 'Windows' or os_name == 'Windows_NT'
local package_root = '/tmp/nvim/lazy'
local sep = '/'
if is_windows then
local tmp = os.getenv('TEMP')
vim.cmd('set packpath=' .. tmp .. '\\nvim\\lazy')
package_root = tmp .. '\\nvim\\lazy'
sep = '\\'
else
vim.cmd([[set packpath=/tmp/nvim/lazy]])
end
local plugin_folder = function()
local host = os.getenv('HOST_NAME')
if host and (host:find('Ray') or host:find('ray')) then
return [[~/github/ray-x]] -- vim.fn.expand("$HOME") .. '/github/'
else
return ''
end
end
local lazypath = package_root .. sep .. 'lazy.nvim'
if not uv.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local function load_plugins()
return {
{
'nvim-treesitter/nvim-treesitter',
config = function()
require('nvim-treesitter.configs').setup({
ensure_installed = { 'go' },
highlight = { enable = true },
})
end,
build = ':TSUpdate',
},
{ 'neovim/nvim-lspconfig' },
{ 'ray-x/lsp_signature.nvim', dev = (plugin_folder() ~= '') },
{
'ray-x/navigator.lua',
dev = (plugin_folder() ~= ''),
-- '~/github/ray-x/navigator.lua',
dependencies = { 'ray-x/guihua.lua', build = 'cd lua/fzy && make' },
config = function()
require('navigator').setup({
keymaps = {
{
key = '<Leader>rn',
func = require('navigator.rename').rename,
desc = 'rename',
},
},
lsp = {
-- disable_lsp = { 'rust_analyzer', 'clangd' },
},
})
end,
},
{
'hrsh7th/nvim-cmp',
dependencies = {
'neovim/nvim-lspconfig',
'hrsh7th/cmp-nvim-lsp',
},
config = function()
-- Add additional capabilities supported by nvim-cmp
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation.
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
}),
sources = {
{ name = 'nvim_lsp' },
},
})
end,
},
}
end
local opts = {
root = package_root, -- directory where plugins will be installed
default = { lazy = true },
dev = {
-- directory where you store your local plugin projects
path = plugin_folder(),
},
}
require('lazy').setup(load_plugins(), opts)
vim.cmd('colorscheme murphy')
|
I'm not sure there are other keymaps with issues. I tried removing the lazy loading using I've seen this for quite a while and have assumed that it's something in my config. I'm mainly reporting here because I'm looking for help/ideas debugging this. Could you help point me to the code that looks up the keymaps? |
I think one of the function you trying to set keybinding is nil (maybe because of lazy loading etc) for _, km in pairs(keymaps) do
print('loading ' .. km.key, km.func)
vim.keymap.set(km.mode, km.key, km.func, opts)
end and check which key failed to load. |
Everytime I run rename I get this error message:
FWIW ignoring the error and continuing seems to work just fine.
Here's my config that I think is relevant:
The text was updated successfully, but these errors were encountered: