ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
1.93k stars 119 forks source link

[Question] GoIfErr cursor position after executing command #346

Closed afterlook closed 1 year ago

afterlook commented 1 year ago

I was just wandering why cursor jumps as far as 2 lines below closing bracket of if err statement when executing GoIfErr.

I often find myself out of function bounds and would rather just have a cursor on closing bracket of if err statement and make a choice of my own how many empty lines I want to create.

...
local pos = vim.fn.getcurpos()[2]
vim.fn.append(pos, data)
vim.cmd [[silent normal! j=2j]]
vim.fn.setpos(".", pos)

Code ref

afterlook commented 1 year ago

Solved in https://github.com/ray-x/go.nvim/pull/347#event-9391216353