Code Monkey home page Code Monkey logo

Comments (2)

pysan3 avatar pysan3 commented on June 7, 2024

Does this happen for every language and every time?

I cannot reproduce this with lua_ls.

On top of that, your repro config contains variables such as keymappings that I have no clue what it is. Please give us a reproducible config!!!

from neo-tree.nvim.

DDGRCF avatar DDGRCF commented on June 7, 2024

Does this happen for every language and every time?

I cannot reproduce this with lua_ls.

On top of that, your repro config contains variables such as keymappings that I have no clue what it is. Please give us a reproducible config!!!

yeh! in my case, it happened in clangd\pyright\lua_ls most each time. And I find that follow_cursor=true cause this error. here is my keymappings:

pluginKeys.neoTree = {
	window = {
		mappings = {
			["<space>"] = "",
			["I"] = "focus_preview",
			["P"] = { "toggle_preview", config = { use_float = false, use_image_nvim = true } },
			["<"] = "prev_source",
			[">"] = "next_source",
			["z"] = "close_all_nodes",
			["Z"] = "expand_all_nodes",
      ["y"] = "",
      ["Y"] = "",
      ["l"] = "",
      ["h"] = ""
		},
	},
	filesystem = {
    commands = {
			my_close_node = function(state)
				local node = state.tree:get_node()
				if node.type == "directory" and node:is_expanded() then
					require("neo-tree.sources.filesystem").toggle_directory(state, node)
				else
					require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
				end
			end,
			my_open_node = function(state)
				local node = state.tree:get_node()
				if node.type == "directory" then
					if not node:is_expanded() then
						require("neo-tree.sources.filesystem").toggle_directory(state, node)
					elseif node:has_children() then
						require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
					end
				end
			end,
			my_copy_filepath_to_clipboard = function(state)
				local node = state.tree:get_node()
				local filepath = node:get_id()
				local filename = node.name
				local modify = vim.fn.fnamemodify

				local results = {
					filepath,
					modify(filepath, ":."),
					modify(filepath, ":~"),
					filename,
					modify(filename, ":r"),
					modify(filename, ":e"),
				}
        local plugin = "Neo-tree"
				vim.ui.select({
					"[1] Absolute path: " .. results[1],
					"[2] Path relative to CWD: " .. results[2],
					"[3] Path relative to HOME: " .. results[3],
					"[4] Filename: " .. results[4],
					"[5] Filename without extension: " .. results[5],
					"[6] Extension of the filename: " .. results[6],
				}, { prompt = "Choose to copy to clipboard:" }, function(choice)
					if choice then
						local i = tonumber(choice:sub(2, 2))
						if i then
							local result = results[i]
							vim.fn.setreg('"', result)
              vim.notify("Copied: ".. result, "info", { title = plugin })
						else
              vim.notify("Invalid selection", "info", { title = plugin })
						end
					else
            vim.notify("Selection cancelled", "info", { title = plugin })
					end
				end)
			end,
      my_copy_file_to_clipboard = function(state)
        require("neo-tree.sources.common.commands").copy_to_clipboard(state)
      end,
      my_cut_file_to_clipboard = function(state)
        require("neo-tree.sources.common.commands").cut_to_clipboard(state)
      end
    },
		window = {
      mappings = {
        ["y"] = "my_copy_file_to_clipboard",
        ["Y"] = "my_copy_filepath_to_clipboard",
        ["x"] = "my_cut_file_to_clipboard",
        ["h"] = "my_close_node",
        ["l"] = "my_open_node"
      },
			fuzzy_finder_mappings = {
				["<down>"] = "move_cursor_down",
				["<C-j>"] = "move_cursor_down",
				["<up>"] = "move_cursor_up",
				["<C-k>"] = "move_cursor_up",
			},
		},
	},
	git_status = {
		window = {
			mappings = {
				["A"] = "git_add_all",
				["gu"] = "git_unstage_file",
				["ga"] = "git_add_file",
				["gr"] = "git_revert_file",
				["gc"] = "git_commit",
				["gp"] = "git_push",
				["gg"] = "git_commit_and_push",
				["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } },
				["oc"] = { "order_by_created", nowait = false },
				["od"] = { "order_by_diagnostics", nowait = false },
				["om"] = { "order_by_modified", nowait = false },
				["on"] = { "order_by_name", nowait = false },
				["os"] = { "order_by_size", nowait = false },
				["ot"] = { "order_by_type", nowait = false },
        ["z"] = "",
        ["Z"] = "",
			},
		},
	},
	document_symbols = {
    commands = {
      my_open_node = function(state)
        local node = state.tree:get_node()
        if not node:is_expanded() then
          require("neo-tree.sources.common.commands").toggle_node(state)
        else
          require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
        end
      end,
      my_close_node = function(state)
        local node = state.tree:get_node()
        if node:is_expanded() then
          require("neo-tree.sources.common.commands").toggle_node(state)
        else
          require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
        end
      end,
    },
		window = {
			mappings = {
        ["l"] = "my_open_node",
        ["h"] = "my_close_node",
        ["z"] = "",
        ["Z"] = "",
			},
		},
	},
}

from neo-tree.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.