From 203c696230cb00ffa0225c0bbc7ac96ec95273bb Mon Sep 17 00:00:00 2001 From: Senghan Bright Date: Wed, 23 Sep 2020 06:20:38 +0200 Subject: [PATCH] fix: small fixes from sunjon (#107) * Don't execute `command` if target buffer is already loaded in window. * Print node_text before entry.kind in ordinal string. * Add new builtin for listing and reloading Lua modules. * Revert "Add new builtin for listing and reloading Lua modules." This reverts commit 65d9d0294eae92b347b38b8dcf807fbcdd5783fe. --- lua/telescope/actions.lua | 8 +++++--- lua/telescope/make_entry.lua | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/telescope/actions.lua b/lua/telescope/actions.lua index 326773d..f8c3453 100644 --- a/lua/telescope/actions.lua +++ b/lua/telescope/actions.lua @@ -98,10 +98,12 @@ local function goto_file_selection(prompt_bufnr, command) vim.cmd(string.format(":%s #%d", command, entry_bufnr)) end else - vim.cmd(string.format(":%s %s", command, filename)) - local bufnr = vim.api.nvim_get_current_buf() - a.nvim_buf_set_option(bufnr, 'buflisted', true) + if filename ~= vim.api.nvim_buf_get_name(bufnr) then + vim.cmd(string.format(":%s %s", command, filename)) + a.nvim_buf_set_option(bufnr, "buflisted", true) + end + if row and col then local ok, err_msg = pcall(a.nvim_win_set_cursor, 0, {row, col}) if not ok then diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index 3077661..3ec663b 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -268,7 +268,7 @@ function make_entry.gen_from_treesitter(opts) valid = true, value = entry.node, - ordinal = entry.kind .. " " .. node_text, + ordinal = string.format("%s [%s]", node_text, entry.kind), display = make_display, node_text = node_text,