nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.08k stars 202 forks source link

`:Neorg mode traverse-link<cr>` and then It can not jump to link file when I press `<cr>` under a file link #1465

Open peter-lyr opened 2 weeks ago

peter-lyr commented 2 weeks ago

Prerequisites

Neovim Version

NVIM v0.10.0

Neorg setup

require 'neorg'.setup { load = { ['core.defaults'] = {}, ['core.concealer'] = {}, ['core.esupports.metagen'] = { config = { update_date = false, type = 'empty', author = 'peter-lyr', timezone = 'implicit-local', }, }, ['core.export'] = {}, ['core.export.markdown'] = { config = { extensions = 'all', }, }, ['core.ui'] = {}, ['core.ui.calendar'] = {}, -- 解决中文乱码问题需要将Windows display language改为英文(美国) ['core.tempus'] = {}, ['core.dirman'] = { config = { workspaces = { work = DepeiRepos .. '\work', life = DepeiRepos .. '\life', study = DepeiRepos .. '\study', }, default_workspace = 'work', }, }, ['core.integrations.telescope'] = {}, }, }

Actual behavior

:Neorg mode traverse-link<cr> and then It can jump to link file when I press <cr> under a file link

Expected behavior

:Neorg mode traverse-link<cr> and then It can not jump to link file when I press <cr> under a file link

Steps to reproduce

:Neorg mode traverse-link<cr> and then It can not jump to link file when I press <cr> under a file link

Potentially conflicting plugins

No response

Other information

No response

Help

None

Implementation help

No response

peter-lyr commented 2 weeks ago

I have to :Neorg mode norg<cr>. I don't want it.

sahinf commented 2 weeks ago

I believe the issue stems from a lack of mapping the keybind for traverse-link mode. Enter key gets mapped for mode norg here:

https://github.com/nvim-neorg/neorg/blob/ebf75f57fa8dadd8747a678724b273b398143dc4/lua/neorg/modules/core/keybinds/keybinds.lua#L13

https://github.com/nvim-neorg/neorg/blob/ebf75f57fa8dadd8747a678724b273b398143dc4/lua/neorg/modules/core/keybinds/keybinds.lua#L83

A fix could be to duplicate the mapping into mode traverse-link https://github.com/nvim-neorg/neorg/blob/ebf75f57fa8dadd8747a678724b273b398143dc4/lua/neorg/modules/core/keybinds/keybinds.lua#L156

-- Hop to the destination of the link under the cursor
                    { "<CR>", "core.esupports.hop.hop-link", opts = { desc = "[neorg] Jump to Link" } },
                    { "gd", "core.esupports.hop.hop-link", opts = { desc = "[neorg] Jump to Link" } },
                    { "gf", "core.esupports.hop.hop-link", opts = { desc = "[neorg] Jump to Link" } },
                    { "gF", "core.esupports.hop.hop-link", opts = { desc = "[neorg] Jump to Link" } },

                    -- Same as `<CR>`, except opens the destination in a vertical split
                    {
                        "<M-CR>",
                        "core.esupports.hop.hop-link",
                        "vsplit",
                        opts = { desc = "[neorg] Jump to Link (Vertical Split)" },
                    },

But it might make more sense to refactor keybind mapping to specify a list of modes per keymap.