Skip to content

Commit

Permalink
✨ Show current symbol in rename popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen-Hoang-Nam committed Mar 4, 2022
1 parent 5c9f8af commit 3dd9f92
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/utils/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ local function cmd_option(callback)
end

function M.rename_popup()
local texts = { '' }
local current_name = api.nvim_eval('expand("<cword>")')

local width = 50
local buf = api.nvim_create_buf(false, true)
Expand All @@ -192,6 +192,7 @@ function M.rename_popup()

local win_handle = api.nvim_open_win(buf, 1, opts)

local texts = { current_name }
api.nvim_buf_set_lines(buf, 0, 1, false, texts)

api.nvim_buf_set_keymap(buf, 'n', 'q', ':close<CR>', { silent = true, nowait = true, noremap = true })
Expand All @@ -217,7 +218,8 @@ function M.rename_popup()
api.nvim_buf_set_option(buf, 'bufhidden', 'delete')

-- Normal to insert
api.nvim_command('startinsert')
api.nvim_feedkeys('A', 'n', true)
-- api.nvim_command('startinsert')
end

return M

0 comments on commit 3dd9f92

Please sign in to comment.