irongit

A Neovim plugin enabling you to solve LeetCode problems.

fix(`Leet yank`): change window and buffer

kawreauthored
parent b4aaa84commit e1ab3062cfd89ea7187c647c6268ae3c60f0ee6bBrowse files

2 files changed, +5 -3

+3-1lua/leetcode/command/init.lua
@@ -177,8 +177,10 @@ function cmd.yank()
177177 local q = utils.curr_question()
178178 if not q then return end
179179
180- if vim.api.nvim_win_is_valid(q.winid) then
180+ if vim.api.nvim_buf_is_valid(q.bufnr) and vim.api.nvim_win_is_valid(q.winid) then
181181 vim.api.nvim_set_current_win(q.winid)
182+ vim.api.nvim_set_current_buf(q.bufnr)
183+
182184 local start_i, end_i = q:range()
183185 vim.cmd(("%d,%dyank"):format(start_i, end_i))
184186 end
+2-2lua/leetcode/config/template.lua
@@ -53,8 +53,8 @@ local M = {
5353
5454 ---@type lc.storage
5555 storage = {
56- home = vim.fn.stdpath("data") .. "/leetcode/",
57- cache = vim.fn.stdpath("cache") .. "/leetcode/",
56+ home = vim.fn.stdpath("data") .. "/leetcode",
57+ cache = vim.fn.stdpath("cache") .. "/leetcode",
5858 },
5959
6060 ---@type boolean