Coder Social home page Coder Social logo

Comments (17)

luukvbaal avatar luukvbaal commented on June 13, 2024 1

It uses the non-recursive :h tnoremap instead of the :h tmap command. Meaning that it will use internal vim mappings rather than potential user-defined mappings. I should have included that from the start.

from nnn.nvim.

luukvbaal avatar luukvbaal commented on June 13, 2024

Hmm, I cannot reproduce this. It should open the hovered file or the active selection if it exists.

from nnn.nvim.

Svenum avatar Svenum commented on June 13, 2024

Maybe the issue is somewhere else in my config:
https://github.com/Svenum/nvim-config

from nnn.nvim.

luukvbaal avatar luukvbaal commented on June 13, 2024

Can you make a screen recording of your problem?

from nnn.nvim.

Svenum avatar Svenum commented on June 13, 2024
Peek.2023-02-05.17-30.mp4

from nnn.nvim.

luukvbaal avatar luukvbaal commented on June 13, 2024

I have no idea what could cause this sorry. If it is splitting the window, it must mean it is executing the mapping. Could you try adding a debug print statement?

+++ b/lua/nnn.lua
@@ -422,6 +422,7 @@ end
 local function open_in(files, command)
        for _, file in ipairs(files) do
                c(command.." "..file)
+               vim.pretty_print(command.." "..file)
        end
 end

from nnn.nvim.

Svenum avatar Svenum commented on June 13, 2024

I am added it like this in my "~/.config/nvim/autoload/plugged/nnn.nvim/lua/nnn.lua":
image

Where should I see the debug-code?

from nnn.nvim.

luukvbaal avatar luukvbaal commented on June 13, 2024

It should show up in :messages after using a mapping.

from nnn.nvim.

luukvbaal avatar luukvbaal commented on June 13, 2024

But you should just add the single pretty_print() line to the existing open_in() function, not define a new function at the top of the file:

nnn.nvim/lua/nnn.lua

Lines 421 to 426 in 440ddfd

-- Builtin mapping functions
local function open_in(files, command)
for _, file in ipairs(files) do
c(command.." "..file)
end
end

from nnn.nvim.

Svenum avatar Svenum commented on June 13, 2024

I got the output:
"vsplit /home/user/test/nnn-test/cloud.txt"
(vsplit first item in the list and not hovered)

from nnn.nvim.

luukvbaal avatar luukvbaal commented on June 13, 2024

I don't understand how it could happen, there must be something interfering. Can you try this in NnnExplorer instead? That way you should be able to see what actually happens in the terminal window as it stays open.

from nnn.nvim.

Svenum avatar Svenum commented on June 13, 2024

In NnnExplorer it is switching to the first item and then opening it in the new window.

from nnn.nvim.

Svenum avatar Svenum commented on June 13, 2024

If Try it a second time in NnnExplorer it opens as it should be. Until i reopen it.

from nnn.nvim.

luukvbaal avatar luukvbaal commented on June 13, 2024

Is it really switching to the first item in a directory with more than two files? Or perhaps just the file above it? The mapping must be feeding either a g, or k key somehow.

from nnn.nvim.

luukvbaal avatar luukvbaal commented on June 13, 2024

Can you check if this fixes the issue?

+++ b/lua/nnn.lua
@@ -221,14 +221,15 @@ local function buffer_setup()
                a.nvim_buf_set_option(0, opt, val)
        end

+       local opts = { noremap = true }
        for i, mapping in ipairs(cfg.mappings) do
-               a.nvim_buf_set_keymap(0, "t", mapping[1], "<C-\\><C-n><cmd>lua require('nnn').handle_mapping("..i..")<CR>", {})
+               a.nvim_buf_set_keymap(0, "t", mapping[1], "<C-\\><C-n><cmd>lua require('nnn').handle_mapping("..i..")<CR>", opts)
        end

-       a.nvim_buf_set_keymap(0, "t", cfg.windownav.left, "<C-\\><C-n><C-w>h", {})
-       a.nvim_buf_set_keymap(0, "t", cfg.windownav.right, "<C-\\><C-n><C-w>l", {})
-       a.nvim_buf_set_keymap(0, "t", cfg.windownav.next, "<C-\\><C-n><C-w>w", {})
-       a.nvim_buf_set_keymap(0, "t", cfg.windownav.prev, "<C-\\><C-n><C-w>W", {})
+       a.nvim_buf_set_keymap(0, "t", cfg.windownav.left, "<C-\\><C-n><C-w>h", opts)
+       a.nvim_buf_set_keymap(0, "t", cfg.windownav.right, "<C-\\><C-n><C-w>l", opts)
+       a.nvim_buf_set_keymap(0, "t", cfg.windownav.next, "<C-\\><C-n><C-w>w", opts)
+       a.nvim_buf_set_keymap(0, "t", cfg.windownav.prev, "<C-\\><C-n><C-w>W", opts)
 end

  -- Restore buffer to previous state

from nnn.nvim.

Svenum avatar Svenum commented on June 13, 2024

It resolved it :)

from nnn.nvim.

Svenum avatar Svenum commented on June 13, 2024

What does this change do?

from nnn.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.