Skip to content

Bug: Multiple typos and reference errors causing runtime failures #39

@yzcj105

Description

@yzcj105

Summary

Found 4 bugs in the codebase that cause runtime errors or incorrect behavior. All verified with Neovim v0.11.6.


Bug 1: Typo in isMAC() function - maxunic should be macunix

File: lua/insis/utils/global.lua:54

Current code:

function _G.isMAC()
  return vim.fn.has("maxunic") == 1
end

Problem: "maxunic" is a typo. The correct Vim feature flag is "macunix".

Test result:

:echo has("macunix")  --> 1 (correct)
:echo has("maxunic")  --> 0 (typo - always false)

Impact: isMAC() always returns false on macOS systems.

Fix:

function _G.isMAC()
  return vim.fn.has("macunix") == 1
end

Bug 2: isLinux() function has incorrect self reference

File: lua/insis/utils/global.lua:57-58

Current code:

function _G.isLinux(self)
  return not self.is_wsl() and not self.is_mac()
end

Problem: The function takes a self parameter and calls self.is_wsl() and self.is_mac(), but these are global functions named _G.isWSL() and _G.isMAC().

Test result:

ERROR: attempt to index local 'self' (a nil value)

Impact: Calling isLinux() crashes with a nil error.

Fix:

function _G.isLinux()
  return not _G.isWSL() and not _G.isMAC()
end

Bug 3: nvim-tree keymapping references missing keys. prefix

File: lua/insis/plugins/nvim-tree.lua:42-43

Current code:

keymap("n", cfg.copy_absolute_path, api.fs.copy.absolute_path, opts("Copy Absolute Path"))
keymap("n", cfg.toggle_file_info, api.node.show_info_popup, opts("Info"))

Problem: These reference cfg.copy_absolute_path and cfg.toggle_file_info, but in config.lua (lines 213-214) they are defined inside the keys table:

keys = {
  -- ...
  copy_absolute_path = "gy",
  toggle_file_info = "gh",
},

Impact: These two keymaps (gy and gh) silently fail to be set in nvim-tree.

Fix:

keymap("n", cfg.keys.copy_absolute_path, api.fs.copy.absolute_path, opts("Copy Absolute Path"))
keymap("n", cfg.keys.toggle_file_info, api.node.show_info_popup, opts("Info"))

Bug 4: Wrong require path for fix-yank

File: lua/insis/init.lua:27

Current code:

if M.config.fix_windows_clipboard then
  require("utils.fix-yank")
end

Problem: The module path should be "insis.utils.fix-yank" to match the project's module structure. All other requires in the file use the insis. prefix.

Test result:

module 'utils.fix-yank' not found

Impact: Enabling fix_windows_clipboard causes a runtime error.

Fix:

if M.config.fix_windows_clipboard then
  require("insis.utils.fix-yank")
end

Environment

  • Neovim: v0.11.6
  • InsisVim: v0.11.3
  • OS: macOS (Darwin 25.3.0)

I can submit a PR with all fixes if you'd like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions